Ask Your Question
0

SimpleBlobDetector for 16 bits depht

asked 2014-09-03 23:17:28 -0500

dinl gravatar image

I'm trying to use the SimpleBlobDetector whit a 16U image, the code is the same as tutorial:

// set up and create the detector using the parameters
cv::Ptr<cv::FeatureDetector> blob_detector = new cv::SimpleBlobDetector(params);
blob_detector->create("SimpleBlob");

// detect!
vector<cv::KeyPoint> keypoints;
blob_detector->detect(img_8, keypoints);

But, when the input is a 16U depth image, it fails with this error:

OpenCV Error: Unsupported format or combination of formats () in cv::threshold, file ........\opencv\modules\imgproc\src\thresh.cpp, line 783

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2014-09-04 08:57:30 -0500

updated 2014-09-04 09:20:11 -0500

Ok take a step back. Simply googling the opencv documentation and looking at the threshold function, you can see the following thing.

src – input array (single-channel, 8-bit or 32-bit floating point)

This means that you cannot supply a 16 bit unsigned image to that function. It is simply not implemented. I agree that the above SimpleBlobDetector should get a check on the input type however not to trigger this. Will look deeper into it and supply a fix.

Okay the problem is actually here. The code assumes that a correct type was supplied, but it doesn't check if the type is 8 bit or 32 bit. We should force to input to be changed to a single channel 8 bit image.

Fix added: https://github.com/Itseez/opencv/pull/3190

edit flag offensive delete link more

Comments

The fix was merged today. From now on people will get a warning if they pass 16 bit images.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-09-23 02:57:07 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-09-03 23:17:28 -0500

Seen: 1,241 times

Last updated: Sep 04 '14