coder
coder

Reputation: 1

Perimeter of bounding box of an image

I need to find perimeter of bounding box of an image in OpenCV using C++. When using double perimeter = arcLength(rois[wp],true); the following error is generated:

Assertion failed (count >= 0 && (depth == CV_32F || depth == CV_32S)) in arcLength,
file /home/vidushi/Desktop/OpenCV/modules/imgproc/src/shapedescr.cpp,
line 285 terminate called after throwing an instance of 'cv::Exception'
what():  /home/vidushi/Desktop/OpenCV/modules/imgproc/src/shapedescr.cpp:285: 
error: (-215) count >= 0 && (depth == CV_32F || depth == CV_32S) in function arcLength

Can someone explain what could be the problem?

Upvotes: 0

Views: 298

Answers (1)

cbuchart
cbuchart

Reputation: 11555

Basically that the format of rois[wp] is not accepted by the arcLength function. It must be 2D and have a CV_32S or CV_32F depth. Something like cv::Mat valid_roi(n, 2, CV_32F); (adapt to your problem).

Upvotes: 1

Related Questions