形状检测 [英] shape detection

查看:132
本文介绍了形状检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了3种算法:

  1. 通过Compare_ssim比较.
  2. 通过PIL进行差异检测(ImageChops.difference).
  3. 图像减法.

第一个算法:

(score, diff) = compare_ssim(img1, img2, full=True)
diff = (diff * 255).astype("uint8")

第二种算法:

from PIL import Image ,ImageChops
img1=Image.open("canny1.jpg")
img2=Image.open("canny2.jpg")
diff=ImageChops.difference(img1,img2)
if diff.getbbox():
    diff.show()

第三种算法:

image3= cv2.subtract(image1,image2)

问题在于这些算法是如此敏感.如果图像具有不同的噪点,则他们认为这两个图像完全不同.有任何解决办法吗?

The problem is these algorithms are so sensitive. If the images have different noise, they consider that the two images are totally different. Any ideas to fix that?

推荐答案

这些图片在很多方面都存在差异(变形,照明,颜色,形状),简单的图像处理无法解决所有这些问题.

These pictures are different in many ways (deformation, lighting, colors, shape) and simple image processing just cannot handle all of this.

我建议使用一种更高级的方法,该方法尝试以简单的几何图形的形式提取那些管的几何形状和颜色.然后比较图形而不是图像.

I would recommend a higher level method that tries to extract the geometry and color of those tubes, in the form of a simple geometric graph. Then compare the graphs rather than the images.

我承认这说起来容易做起来难,并且只适用于这种特殊场景.

I acknowledge that this is easier said than done, and will only work with this particular kind of scene.

这篇关于形状检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆