LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tough Question

Hi,

Im trying to Display a black and white 320 x 240
image file.

My approach was to read a Binary File, and
send it through a "Build Array" Component, and
then finally route it to an Intensity Chart.

The display, however, looks nothing like it
should (its NOT in black and white, and its just
straight lines everywhere).

I set the Charts attribute's Width and Height
fields to 320 by 240 respectively, but not
sure what else to try.

(Perhaps the problem lies in that the data in
the file is 16 bits (for each pixel), and
Labview cant select only 8 of those bits to show.

Suggestions?
Eric

enliteneer@mindless.com





Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
0 Kudos
Message 1 of 2
(3,685 Views)
enliteneer@mindless.com wrote:

> Hi,
>
> Im trying to Display a black and white 320 x 240
> image file.
>
> My approach was to read a Binary File, and
> send it through a "Build Array" Component, and
> then finally route it to an Intensity Chart.
>
> The display, however, looks nothing like it
> should (its NOT in black and white, and its just
> straight lines everywhere).

You may be running into several issues here. If your source image file
really is a standard image format, then there's going to be a header
portion that defines the characteristics of the image and specifies the
structure of the data to follow. By the sound of your message, I'd
guess that your files don't have any header info and are simply a block
of (320 x 240 x 2 bytes/pixel=) 153,600 bytes of pi
xel value data. If
your files are larger, then you probably do have a header, and you'll
need to skip that information before reading into your array.

Assuming no header, you should be able to use "Read File," specifying a
byte stream type of U16 and a count of 76,800. You would wire the
output array into a "Reshape Array" node, making sure to add a dimension
so that that you get a 2D output, and wiring a 240 and a 320 into the
dimension size inputs. The output should connect right up to an
intensity graph that adapts to display the 16-bit values.

The last piece of the puzzle will involve adjusting the bounds of the
color ramp of the intensity graph to correspond to your desired min and
max values (probably 0 and 2^16) and setting the colors in the ramp--you
can do this with the "Color Array" attribute of the intensity graph.
You may also need to rotate or transpose the image array to achieve the
orientation that you want in the graph.

Best of Luck,
John Lum
0 Kudos
Message 2 of 2
(3,685 Views)