LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use "Read JPEG File.VI"

I am trying to read a JPEG file, run it through unflatten data.vi, and
display it on an intensity graph. I am getting an image that is
recognizable, but not much better.

Anyone done this before?

Also, how come the "Read JPEG File.VI" always outputs a depth of 8 when
I know the JPEG I am reading is 24-bit color?

--
Toby Stensland
toby@stensland.com


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
0 Kudos
Message 1 of 6
(6,958 Views)
> I am trying to read a JPEG file, run it through unflatten data.vi, and
> display it on an intensity graph. I am getting an image that is
> recognizable, but not much better.
>
> Anyone done this before?

The most common problem is that the intensity graph Z Scale isn't set properly.
When displaying something using a color table, you will want to set the
Z Scale
Range Min to 1 and Max to 254. The other thing is that the Y scale is typically
upside down and you may also need to transpose the 2D array. The
easiest way is
to popup on the intensity graph and choose transpose, or of course you
can use
the array node on the diagram.

> Also, how come the "Read JPEG File.VI" always outputs a depth of 8 when
> I know the JPEG I am reading is 24-bit color?
>

Actually, I t
hink all JPEGs are true color. I'm surprised to see the
depth hard-coded to 8. I suspect that it is all the DLL supports for now.

Greg McKaskle
0 Kudos
Message 2 of 6
(6,957 Views)
.... The other thing is that the Y scale is typically
> upside down...

To flip the Y, just type zero, or whatever min is into
the max number to put zero,zero at the top-left.

Greg McKaskle
0 Kudos
Message 3 of 6
(6,957 Views)
I made this changes and was able to get the correct orientation and
better color, but it is still not too great. A simple image like clip-
art comes out recognizable but "speckled". A complex image like a
digital snapshop of my backyard comes out unrecognizable. Perhaps the
values in the flattened data array do correspond directly to an
intensity? What is the "color table" anyway?


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
0 Kudos
Message 4 of 6
(6,957 Views)
> I made this changes and was able to get the correct orientation and
> better color, but it is still not too great. A simple image like clip-
> art comes out recognizable but "speckled". A complex image like a
> digital snapshop of my backyard comes out unrecognizable. Perhaps the
> values in the flattened data array do correspond directly to an
> intensity? What is the "color table" anyway?
>
I suspect the speckling is partly due to the compression of JPEG, and
partly due to the color reduction taking place by only having 256
available colors.

The color table is an array of the 256 colors in the image. The 2D
or flattened 1D array elements are indices into the color table
specifying that pixel 1 uses color N and pixel 2 uses color M.
When drawi
ng the picture, the system will look up N and M in the
table to get the real colors and draw the picture.

Greg McKaskle
0 Kudos
Message 5 of 6
(6,956 Views)
I now have a decent image. Previously, I was taking the flattened
image data, putting it through unflatten pixmap and sending it to the
intensity graph. Now, I use the flattened data to index the color
table and then graph that.

The intensity plot Z (intensity/shade of blue) axis seems to have an 8-
bit limit so I divide the 24-bit color table value by 2^16 before
plotting.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
0 Kudos
Message 6 of 6
(6,955 Views)