LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Difficulty with IMAQ ROIToMask and IMAQ Mask

I created a mask with ROIToMask and then I am trying to use IMAQ Mask to select only that portion of the image. After I mask the image the Image Dst Out appears to be the mask still? The image and the mask are both 8 bit images. I also attaching the labview code I am trying to use. I was opening a .png file to begin the code with. I am new to Labview, but I am more comfortable with Matlab and I know this would be an easy operation there so I would think it would be here too? Thank you in advance for any help anyone.

Kevin
0 Kudos
Message 1 of 4
(3,206 Views)
Kevin,
I think I see what's going on. In your whole LabVIEW program, you are only creating 1 buffer to save images in. You use the "IMAQ Create" to create a space in memory to operate on images. You then do several operations on this one buffer and pass the reference to that buffer all the way to the end of the program. By the time you get towards the end of your program and you go to use that image space again for masking, it has been turned into a binary image. It's not the same image you started with.
To remedy this, you must create more buffers in your program. I have modified your code to a point where I think it will work.

Nicholas C
National Instruments
Applications Engineering
Message 2 of 4
(3,199 Views)
Thanks Nick. I tried the code with more image buffers and the program works. I am doing more image analysis than before, and I am still having difficulty deciding when create another buffer. How do you know when to create another buffer? How can you tell when which buffer you are using (i.e. the image reference number?) Thank you in advance.
0 Kudos
Message 3 of 4
(3,186 Views)
If you just follow the wire, you should be able to tell what buffer you are using. Just remember that when a wire goes into a subVI, it is doing an operation on the buffer and the buffer is then changed. If you want to go back to the image before that subVI did its operation, then you need to create another buffer BEFORE the operation and copy the image to that second buffer.
If you are having a hard time knowing what state the images in your buffers are in, use a probe and highlight execution mode to debug your program. If you right click on any of the purple image wires and tell it to "create probe", as the data flows through that wire, you will be able to tell what state the image is in.
Creating more buffers is not bad for your system. It just allocates memory for images on RAM. I run 512MB of RAM and I can get about 80-90 32bit RGB image buffers before I get an error.

Nicholas C
National Instruments
Applications Engineering
Message 4 of 4
(3,182 Views)