LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

picture array

Hi all,
 
I need help on this:
 
The following attachments is my program.  It will open a 8-bit greyscale bmp picture file which will look for a white pixel (value of 255) on a specific location of the picture and determine which pattern it is.
 
The program should run like this:
When running the program, and if you open the pattern A bmp file , a message box will pop up telling you that the file is "pattern A" And if you open the pattern B bmp file , a message box pop up will tell you that it is "pattern B".  The program will know whether it is pattern A or B by determine whether there is a white pixel within a specific location.
 
Problem:
My program is able to determine pattern A picture file succesfully but i encountered a problem in  pattern B file, both message box pop up (this mean that the file is pattern A and pattern B). I went to check the array of pattern B picture file (using imread in matlab) whether is there any white pixel within the specific location for pattern A, but there are no white pixel there. If you open pattern B file in paint, it can be clearly seen that there are no white pixel in the specific location for pattern A.
 
 
Thank you all in advance.
 
Regards,
Lip Seng
 
 
Download All
0 Kudos
Message 1 of 4
(2,737 Views)
Hi Lip Seng,
    I think that the cause may be that you are examining a large area of the picture rather than a single pixel. The second parameter for each array dimension in the "Array Subset" function is the length of the sub-array to return, not the index of the end of the desired sub array. If you change these to 1, the vi seems to work as required (as far as I understand it anyway!). Modified vi attached
cheers,
    Simon
.
Message 2 of 4
(2,726 Views)
If you want a single pixel from a picture array use index array (2d version will take 2 parameters)  if you are looking at a region use the array subset.  Much like in c/c++ 
if (Picture[xA, yA] == 255){isTypeA();}
 
Paul
 
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 3 of 4
(2,711 Views)
Hi Simon and Paul 
 
Thanks for your reply and advice. Saw my mistake for the array subset in my program.
 
Regards,
Lip Seng
 
0 Kudos
Message 4 of 4
(2,691 Views)