Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Generating image from ASCII or program code.

3 views
Skip to first unread message

Geobird

unread,
Nov 25, 2009, 6:23:47 AM11/25/09
to
Hello all . I am newbie in image processing , so my question may
sound amateur or zig zag.
It is well known to all that raster image is composed of pixel
and each pixel consist of unique value DN . Is it possible to recode
the entire image , so that each pixel is generated by the argument
such as grayscale , DN and other parameters . Once it is done image
can be sampled to store the attribute of the pixel and subsequent
loops can be run to generate the image .
This will save the computer storage space and speed up the
display of raster .
I hope I have been able to clarify the subject matter . If not ,
feel free to ask . I would welcome any relevant idea .

Geobird

unread,
Nov 25, 2009, 6:24:18 AM11/25/09
to

Jonathan Campbell

unread,
Nov 25, 2009, 2:11:00 PM11/25/09
to

Attempting to understand what you are saying.

Assume that I want an image (for now a 2D array of grey values) which
contains pixels as follows:

(i) im[r, c] = sin(2.PI.r/Nr).sin(2.PI.c/Nc), where r = 0..Nr-1 is the
row index and c is the column index.

1. I can store the image in an array, say in C or C++ or Java, as

float im[Nr][Nc];

and execute a nested loop to compute the values and store them in im.

then I can use pixval= im[r][c] to access the value.

2. Or, assuming we have use an image (object) class, we can have

Image im;

im.create(sine);
pixval = im.get(r, c); // which reads and returns im]r][c]

3. Or, instead of storing all the values, I can write an indication that
im has been assigned (i), and have an alternative 'get' that either
(a) computes the nested loop mentioned in 1. and then uses a similar
'get' to 2. or (b) I can compute (i) just for the required (r, c).

You might call 3. 'lazy' implementations ('lazy' in the sense used in
functional programming languages) or something like 'compute on demand'.

Almost like in graphics, raster representation versus vector representation.

Is that what you mean? But I probably interpreted you wrongly.

Best regards,

Jon C.

--
Jonathan Campbell www.jgcampbell.com BT48, UK.

Geobird

unread,
Nov 25, 2009, 10:48:48 PM11/25/09
to

Thanks for your reply .

> (i) im[r, c] = sin(2.PI.r/Nr).sin(2.PI.c/Nc), where r = 0..Nr-1 is the
> row index and c is the column index.

If I am right you have sampled the image to a mathematical formula
in terms of sine , but the raster may contain discrete pixel that
may not necessarily follow this model.

> 1. I can store the image in an array, say in C or C++ or Java, as
>
> float im[Nr][Nc];
>
> and execute a nested loop to compute the values and store them in im.
>
> then I can use pixval= im[r][c] to access the value.
>
> 2. Or, assuming we have use an image (object) class, we can have
>
> Image im;
>
> im.create(sine);
> pixval = im.get(r, c); // which reads and returns im]r][c]
>
> 3. Or, instead of storing all the values, I can write an indication that
>   im has been assigned (i), and have an alternative 'get' that either
> (a) computes the nested loop mentioned in 1. and then uses a similar
> 'get' to 2. or (b) I can compute (i) just for the required (r, c).
>
> You might call 3. 'lazy' implementations ('lazy' in the sense used in
> functional programming languages) or something like 'compute on demand'.
>
> Almost like in graphics, raster representation versus vector representation.

I am afraid to tell that you are more technically strong than
my level of understanding . Even then , I assume that
there must be some sort of statistical computation for breaking
the raster to several segments and each segment follow
the definite mathematical model as ur first formula says .

Then the function imcreate() can be used .
Can you tell me which language you have used to explain the codes .
Is it MATLAB ?

regards ,
Chandan

Jonathan Campbell

unread,
Nov 27, 2009, 12:39:34 PM11/27/09
to
Geobird wrote:
> Thanks for your reply .
>
>> (i) im[r, c] = sin(2.PI.r/Nr).sin(2.PI.c/Nc), where r = 0..Nr-1 is the
>> row index and c is the column index.
>
> If I am right you have sampled the image to a mathematical formula
> in terms of sine , but the raster may contain discrete pixel that
> may not necessarily follow this model.

I was assuming that r, c are integer; hence sampling / spatial
discretisation.
>
[...]


>> Almost like in graphics, raster representation versus vector representation.
>
> I am afraid to tell that you are more technically strong than
> my level of understanding . Even then , I assume that
> there must be some sort of statistical computation for breaking
> the raster to several segments and each segment follow
> the definite mathematical model as ur first formula says .

So you want to take a numerical image and (using a model) deduce the
parameters of the model? --- to get what is in effect a formula?

>
> Then the function imcreate() can be used .
> Can you tell me which language you have used to explain the codes .
> Is it MATLAB ?

I was thinking of Java or C++ --- but if you exclude mention of class /
object, then it may not be too far from MATLAB. I don't really know
MATLAB, and have rarely used it.

ImageAnalyst

unread,
Nov 29, 2009, 10:29:52 AM11/29/09
to
As best I can userstand, you're trying to describing a method of image
compression where you have a model for describing your image, and then
you just save the model instead of all the individual pixels. Sure,
there are image models, and image compression schemes. Lots of them.
Do you have any specific questions?

For the speed question, you'd have to look at the tradeoff between
saving and recalling less data versus the time to decompress it, since
it must be decompressed before display. For example, if I can save a
10 megapixel photo in 500 kb, can I recall and decompress
(reconstruct) the 10 megapixel image in less time that if I simply
saved all 10 megapixels and recalled them all without having to do
decompression?

Geobird

unread,
Dec 5, 2009, 4:32:34 AM12/5/09
to

Excellent . You put laser beam to my point of interest .
Image compression as far I know , is accompained by loss of image
properties ,
which is undesirable in performing core image processing operations.
What can be the algorithm that preserves the original image
content ( radiometric , spectral and spatial aspects ) .

Regards
Chandan

ImageAnalyst

unread,
Dec 5, 2009, 7:12:00 AM12/5/09
to

----------------------------------------------
You can use a lossless compression such as PNG, jpeg2000, etc.

Thomas Richter

unread,
Dec 5, 2009, 7:56:24 AM12/5/09
to
Geobird wrote:
> Excellent . You put laser beam to my point of interest .
> Image compression as far I know , is accompained by loss of image
> properties ,
> which is undesirable in performing core image processing operations.

Not necessarily. Neither are all compression formats lossy. JPEG-LS
isn't, original JPEG has a lossless path (though unknown to many), JPEG
2000 does have a lossless path. The easiest, fastest and one of the best
is probably JPEG-LS. Lossless in the sense that it re-creates a 2D array
of integer values without loss. How that 2D array relates to the
original image is a second question, of course, and just *obtaining*
that array from a real-world scene creates loss of some sort.

> What can be the algorithm that preserves the original image
> content ( radiometric , spectral and spatial aspects ) .

"Radiometric"? That requires you to record more than a matrix of
grey-levels. Spectral properties are neither preserved because, usually,
color images are stored as triples representing colors in a suitable
color space. For that, you would need to use a multi-spectral
representation, but as frequency is a continous signal (similar to
space), you do have some loss already when sampling the signal. JPEG
2000 can compress multi-spectral images, also losslessy.

What do you mean by "spatial aspects"? Again, as soon as you have
pixels, you sampled the original signal already and created loss by a
limited spatial resolution, but this is a sensor problem and not a
compression problem.

So long,
Thomas

0 new messages