Ask Your Question

Revision history [back]

I've solved this by using the following pseudo code:

Image Img_Scene(Scene_Img_Width, Scene_Img_Height);
Image Img_Template(Templ _Img_Width, Templ _Img_Height);//Contains only the Contour Bounding box 
Image Img_Temp_Template(Scene_Img_Width, Scene _Img_Height);
Scene_contours=find contours in Img_Scene
for each Scene_contour in Scene_Contours
{
    Img_Temp_Template.ROI= Rect(Scene_contour.BoundingBox.X, Scene_contour.BoundingBox.Y, Img_Template.width, Img_Template.Height)
    Img_Temp_Template= Img_Template.Copy();
    Templ_contours=find contours in Img_Temp_Template();
    CompareHausdorffDistance(Templ_contour, Scene_contour);
}

The HausdorffDistance can be found by using this code snippet.

I've solved this by using the following pseudo code:This answer might be more suitable! Ref

Image Img_Scene(Scene_Img_Width, Scene_Img_Height);
Image Img_Template(Templ _Img_Width, Templ _Img_Height);//Contains only the Contour Bounding box 
Image Img_Temp_Template(Scene_Img_Width, Scene _Img_Height);
Scene_contours=find contours in Img_Scene
for each Scene_contour in Scene_Contours
{
    Img_Temp_Template.ROI= Rect(Scene_contour.BoundingBox.X, Scene_contour.BoundingBox.Y, Img_Template.width, Img_Template.Height)
    Img_Temp_Template= Img_Template.Copy();
    Templ_contours=find contours in Img_Temp_Template();
    CompareHausdorffDistance(Templ_contour, Scene_contour);
}

The HausdorffDistance can be found by using this code snippet.