Labview realizes simple picture display
Labels (space separated): labview note image processing
It is said that this is not a complicated problem, but since there is very little information on the Internet except for official help, and I think it is a very good example of getting started, I will do some simple sorting according to my own learning process.
The function you want to achieve is actually very simple: select a picture in bmp format from the computer, and then introduce some very simple processing of the picture through the mathscript module, and display it.
image reading
First of all, the official website has an excellent example that can help you get started: http://digital.ni.com/public.nsf/allkb/9C8B020226E5411686256D52002BACA8
Add a module to read the BMP file as shown in the block diagram window:
you can try to run The following program has realized the function of selecting BMP format files from the folder, but in order to make the appearance more in line with the usual operating habits, add a path module, as shown in the figure:
then right-click and select Convert to Input Control, the front panel will display The corresponding VI will appear, as shown in the figure:
At this time, you can run the program and find that the picture reading function has been realized. Note: Since the path selection control and the file input interface of the picture read control have been connected, only pictures in BMP format can be selected at this time.
image processing
As shown in the figure, simply make a black and white reversal of the picture through the mathscript module. The question now is how to display the output matrix as a picture.
image output
The matrix output by the mathscript module is converted into a one-dimensional array, and then the image is drawn by the flattened pixel map VI module, and the new image is output to the two-bit image module (add a two-dimensional image control on the front panel, on the block diagram The corresponding module will appear):
This completes the function.
In fact, the problem is not completely solved here. The output of the mathscript module is actually the four-bit pixel map module of the flattened pixel map VI, so the output graphics are actually yellow and white. In order to solve this problem, the color output of the restored pixmap is simplified to the color input of the flattened pixmap. Realize black and white inversion. At this point, the function you want to achieve is basically completed.