Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Opencv3.0 Shape Module, Compute Distance

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

click to hide/show revision 2
No.2 Revision

updated 2015-04-18 05:21:24 -0600

berak gravatar image

Opencv3.0 Shape Module, Compute Distance

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 error

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

my Code :

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

model);

So, why the input must be 2 channels ?

Thanks, Mimic

click to hide/show revision 3
No.3 Revision

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

berak gravatar image

Opencv3.0 Shape Module, Compute Distance

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"); <br>
 InputArray model = imread("samples/6.jpg");<br>
imread("samples/6.jpg");
Ptr<HausdorffDistanceExtractor> p = createHausdorffDistanceExtractor();<br>
createHausdorffDistanceExtractor();
float dis = p->computeDistance(src, model);

So, why the input must be 2 channels ?

Thanks, Mimic