Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Thresholding a binary image

I want to threshold a binary image. My code runs, but if the user wants to set the min value of the threshold to a float the IMAQ Threshold function automatically cast the float to an int, thus taking away the precision i need. Here is the code I am using to do the threshold. Thanks in advance.

object->Cast(image,image,IMAQ_IMAGE_U8,vOptionalParam,vOptionalParam);

C_CWIMAQMultiThresholdData threshData=object->CreateCWIMAQMultiThresholdData();
CCWIMAQMultiThresholdDataItem item=threshData.Add(COleVariant((long)1));

threshData.Item(COleVariant((long)1)).GetThresholdRange().SetMin(GetThreshold()); //Get threshold returns a float
threshData.Item(COleVariant((long)1)).GetThresholdRange().SetMax(255.0);

object->MultiThreshold2
(image,image,threshData);
0 Kudos
Message 1 of 2
(2,959 Views)
You have to take the threshold and then cast the image to binary.
0 Kudos
Message 2 of 2
(2,959 Views)