17.12.2018 Views

Image Acquisitionand Proces

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

12 <strong>Image</strong> Acquisition <strong>Proces</strong>sing with LabVIEW<br />

1.3.2 CUSTOM AND OTHER IMAGE FORMATS<br />

Working with images Þles that are not included in the Þve standard types supported<br />

by IMAQ ReadFile can be achieved either by using a third-party toolkit, or decoding<br />

the Þle using IMAQ ReadFile’s advanced features. Consider the example in Figure<br />

1.9, which shows an image being saved in a custom Þle format. The size of the<br />

image (x,y) is Þrst determined and saved as a Þle header, and then the image data<br />

is converted to an unsigned 8-bit array and saved as well. Opening the resulting Þle<br />

in an ASCII text editor shows the nature of the data (Figure 1.10)<br />

FIGURE 1.9 Save an image in a custom format — wiring diagram.<br />

FIGURE 1.10 A custom Þle format image.<br />

The Þrst four characters in the Þle specify the x size of the image, followed by<br />

a delimiting space (this is not required, but has been included to demonstrate the<br />

technique), then the four characters that represent the y size of the image. When<br />

reading this custom Þle format, the header is Þrst read and decoded, and then the<br />

remaining Þle data is read using IMAQ ReadFile (Figure 1.11).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!