【问题标题】:Partial image comparison using RMagick!使用 RMagick 进行部分图像比较!
【发布时间】:2011-07-28 05:10:08
【问题描述】:

我需要使用 RMagick(ImageMagick 的 Ruby 绑定)比较两个图像的部分/部分。有没有人与它有任何关系。

我正在使用compare_channel 方法生成图像!我已经阅读了 RMagick 文档和文档中的 RMagick 示例,我觉得我可以使用 mask 不知何故,但不确定如何?

有什么想法吗?

【问题讨论】:

    标签: ruby imagemagick rmagick


    【解决方案1】:

    比较Image#export_pixels_to_string 的结果应该可以解决问题:

    area1_str = image1.export_pixels_to_string(xpos, ypos, width, height)
    area2_str = image2.export_pixels_to_string(xpos, ypos, width, height)
    if area1_str == area2_str
      puts "Equal"
    else
      puts "Different"
    end
    

    【讨论】:

      【解决方案2】:

      我正在获取 RGB 单个值并比较每个 pixel,使用绝对值并使用比较器值(即 10)进行限定。

      【讨论】:

        【解决方案3】:

        也许find_similar_region 会有所帮助?或者您可以复制每张图像,裁剪出感兴趣的部分,然后比较裁剪后的副本?

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-03-29
          • 2015-11-25
          • 1970-01-01
          • 2011-09-07
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多