Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

ROIToMask and Extracting a 16-bit region

Solved!
Go to solution

Hello -

 

The ROIToMask function is still incompatible with 16-bit images as of Vision 2013.  First, I wonder if this has finally been corrected in Vision 2014? Second, I have to do math on the actual extracted image portion that is defined by my ROI.  So I need the 16-bit area extracted.   I have tried a number of approaches including casting images back and forth between 8-bit and 16-bit so that the IMAQ Mask function will not return a Error -1074396077 occurred at IMAQ Mask, Incompatible Image Type, but nothing has worked.  I can get this to extract an 8-bit ROI by casting my original image to 8-bit, and leaving it as 8-bit, but it does not give me the U16 region I need to perform additional math on (it gives me an 8-bit ROI).

 

Can someone provide an example in which, for a U16 image, I can draw an ROI (box, ellipse, polygon) on the image, and extract that specific image portion inside of the ROI (that has the U16 pixel values)?

 

Thanks a bunch for any help.  I tried to post a U16 TIF as example but it won't post as likely not allowed image type for the forum.  But I can email someone such an image if requested.

 

Don

0 Kudos
Message 1 of 4
(5,693 Views)

ps. I would like to add that this may be a show-stopper for my project which is why I was hoping that NI would have all of these functions updated for 16-bit operation by now.

Message 2 of 4
(5,684 Views)
Solution
Accepted by topic author DonRothGE

Unless I misunderstand you, it looks to work for me (in LV 2012, so I presume later also).  The Mask image needs to be U8 (which shouldn't usually be a problem), but the Image Model input on ROIToMask is the U16 image that you are extracting from, and the Mask function returns a U16 image as required.

 

ROI to Mask.png

 

Message 3 of 4
(5,677 Views)

This works and I validated for my U16 image reads.  I had reversed the connections to the Image and Image Model inputs for the IMAQ ROIToMask VI.  The U16 Image source should be connected to the 'Image Model' input and the Mask buffer should be connected to the 'Image' input (like you have done).  Considering the 'Image' input and its location at upper left for the IMAQ ROIToMask VI, and consistency with the Image Src input for other IMAQ Vision VIs, this is where I got crossed up.

 

Thanks so much for looking at this!

Message 4 of 4
(5,660 Views)