Ask Your Question
0

Opencv3.0 Shape Module, Compute Distance

asked 2015-04-18 05:14:07 -0600

Mimic gravatar image

updated 2015-04-18 05:28:46 -0600

berak gravatar image

Hi everoyne,

I wanted to use the shape module to compute Hausdorff distance and shape context distance between two shapes, but it give me the error

Assertion failed (set1.channels()==2 && set.1cols>0)

my Code :

InputArray src = imread("samples/5.jpg"); 
InputArray model = imread("samples/6.jpg");
Ptr<HausdorffDistanceExtractor> p = createHausdorffDistanceExtractor();
float dis = p->computeDistance(src, model);

So, why the input must be 2 channels ?

Thanks, Mimic

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2015-04-18 05:28:25 -0600

berak gravatar image

if you read the docs , it says:

"A simple Hausdorff distance measure between shapes defined by contours"

in other words, it expects contours (e.g. from findContours) as input, not plain images.

please also have a look at samples/cpp/shape_example.cpp.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-04-18 05:14:07 -0600

Seen: 809 times

Last updated: Apr 18 '15