" DIFF"使用ImageMagick强调的图像 [英] "Diff" an image using ImageMagick with emphasis

查看:175
本文介绍了" DIFF"使用ImageMagick强调的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

跟进



更像这样的东西





好像我只是在堆栈中遗漏了一些可以制作的东西这项工作。




convert'('file1.png -flatten -grayscale Rec709Luminance')'\
'('file2 .png -flatten -grayscale Rec709Luminance')'\
...在这里? ...
'(' - clone 0-1 -compose darken -composite')'\
......还是在这里? ...
-channel RGB -combine diff.png



我也可以将它作为单独的命令运行不需要很快,大部分都将脱机运行。



我也试过在这里研究这种技术(特别是缩略图缩放如何在像素扩展时为你提供我想要的效果)但是这段代码使用的是库而不是ImageMagick命令行工具。第248行=>使红色尽可能可见







并且比较泵出这个(红色变化,你几乎看不到)





感谢您的帮助

解决方案

你可以在Imagemagick中使用-morphology dilate来增加大小o f红色区域。例如,使用两种形式:

 转换JW0wZ.png 1nHWT.png -compose difference -composite -morphology dilate disk:10 + level-colors black,red result.gif 



或者更好

 转换JW0wZ.png 1nHWT.png -compose difference -composite -morphology dilate disk:10 -alpha copy -backg圆形红色-alpha形状result2.png 



更新2:以下是如何将50%黄色标记覆盖到两张原件上。根据需要更改值。我创造了一个差异图像并扩大了白色。然后我创建了一个50%的黄色图像。然后我使用差异图像作为掩模将每个原件与黄色合成。请参见





要查看这个,如果在Unix上并且有X1 1安装,你可以做

  animate -delay 20 -resize 50%1.png 2.png 


Follow up on "Diff" an image using ImageMagick

When you are working with forms (as opposed to images), the changes are very hard to see with this technique. I wanted to show some type of yellow highlight maybe 10-20 pixels "bigger" (padding) around the actual pixels that changed.

So instead of just this

Something more like this

It seems like I am just missing something here in the stack that can make this work.

convert '(' file1.png -flatten -grayscale Rec709Luminance ')' \ '(' file2.png -flatten -grayscale Rec709Luminance ')' \ ... here ? ... '(' -clone 0-1 -compose darken -composite ')' \ ... or here ? ... -channel RGB -combine diff.png

I can also run this as separate commands and does not need to be fast, most of this is going to be run offline.

I also tried studying the technique here (specifically how the thumbnail scaling gives you the effect I want as the pixels get expanded) but this code is using the library instead of the ImageMagick command line tools. Line 248 => "make the red as visible as possible"

https://github.com/vslavik/diff-pdf/blob/master/diff-pdf.cpp#L218

An example form is the standard W-9. I made 2 subtle changes

  • PART II .. moved the 2. left about 2 pixels
  • PART II .. on 4., moved word is to the right 2 pixels

and the compare pumps out this (changes in red that you can barely see)

Thank you for any help

解决方案

You can use -morphology dilate in Imagemagick to increase the size of the red areas. For example, using your two forms:

convert JW0wZ.png 1nHWT.png -compose difference -composite -morphology dilate disk:10 +level-colors black,red result.gif

UPDATE:

If you want the background transparent, then try

convert JW0wZ.png 1nHWT.png -compose difference -composite -morphology dilate disk:10 +level-colors "black,red" -fuzz 20% -transparent black result.png

Or better

convert JW0wZ.png 1nHWT.png -compose difference -composite -morphology dilate disk:10 -alpha copy -background red -alpha shape result2.png

Update 2: Here is how to overlay a 50% yellow marking onto you two originals. Change the value as desired. I create a difference image and dilate the white. Then I create a 50% yellow image. Then I composite each of the originals with the yellow using the difference image as a mask. See https://www.imagemagick.org/Usage/compose/#compose

convert JW0wZ.png 1nHWT.png \
\( -clone 0,1 -compose difference -composite -morphology dilate disk:10 \) \
\( -clone 0 -fill yellow -colorize 100 -channel a -evaluate set 50% +channel \) \
\( -clone 0,3,2 -compose over -composite +write 1.png \) \
\( -clone 1,3,2 -compose over -composite +write 2.png \) \
null:

To view this, if on Unix and have X11 installed, you can do

animate -delay 20 -resize 50% 1.png 2.png

这篇关于" DIFF"使用ImageMagick强调的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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