设置首页收藏本站
开启左侧

OPENCV CONTOUR BASED MATCHING

[复制链接]
Halcon_ 发表于 2018-10-4 15:45:02 | 显示全部楼层 |阅读模式
I want to create a module with OPENCV like on below. But function of opencv which is cv.matchShapes(...), support only a contour for searching. How can I create a reference model which has multiple contours with OPENCV?

Information: (contour1 is not supported for multiple contours)
  1. Python: cv2.matchShapes(<b>contour1</b>, contour2, method, parameter)
复制代码


Halcon Codes:
  1. read_image (Test, 'test.jpg')

  2. gen_rectangle1 (ROI_0, -3.64286, -31.5379, 152.201, 114.278)
  3. reduce_domain(Test, ROI_0, ImageReduced)

  4. create_shape_model (ImageReduced, 4, rad(0), rad(360), rad(1.6523), ['none','no_pregeneration'], 'use_polarity', [12,17,5], 4, ModelID)
  5. get_shape_model_contours(ModelContours, ModelID, 1)

  6. find_shape_model(Test, ModelID, -0.39, 0.79, 0.5, 1, 0.5, 'least_squares', 0, 0.9, Row, Column, Angle, Score)
复制代码


test.jpg
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
Belial2010 发表于 2018-10-5 14:56:06 | 显示全部楼层
你可以自己扩展,加个循环,遍历比较多个轮廓。
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
 楼主| Halcon_ 发表于 2018-10-6 15:05:07 | 显示全部楼层
for example, reference model has 5 contours and test image have 1000 contours. How can I match reference model with contours which is on image of test correctly?
According to me, It can be a mistake when contours are tried to matching one-to-one. Because, Test image can consist of more contours or less contours according to reference model.
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表