图像处理程序中的微小图像差异 [英] Minor image differences in image manipulation program

查看:258
本文介绍了图像处理程序中的微小图像差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现了一个方法,它接受一个输入图像,并围绕垂直线通过中心,并将其保存到输出图像文件。所以左边的东西变成右边,反之亦然。图像看起来很大,看起来像翻转完美。然而,我们给出了实际翻转的图像文件,它应该看起来像,我使用diff实用程序在终端中比较这两个,它说,确实有差异。使用一个名为Kaliedoscope的程序,我能够找出差异:有一些像素,由于某种原因,与他们应该是不同的颜色。不知道为什么是。我的代码甚至不能操作RGB值。

解决方案

你保存为什么图像格式?如果您使用有损压缩(例如JPEG),则图像颜色将总是略有不同,因为它们已被重新压缩。您应该使用非有损格式,例如PNG。



您也不应该使用diff来查看图片。我不知道万花筒是什么,但ImageMagick的比较实用程序是好的看看两个图像之间的差异。 'diff'几乎总是告诉你,两个图像之间存在差异,即使它们是相同的,并且你使用非有损格式,因为当你重新压缩它时,它可能使用不同的压缩技术。 p>

此外,你说你给了翻转的图像文件(假设这是一个家庭作业)。在这种情况下,生成该文件的人可能犯了错误(例如,使用有损压缩)。我不担心在这种情况下的小像素差异。


I've implemented a method that takes an input image and flips it around a vertical line through the center and saves it to an output image file. So whats on the left becomes on the right and vice versa. The image looks great and looks like it flipped perfectly. However, we are given the actual flipped image file that its supposed to look like, and I used the diff utility in terminal to compare the two, and it states that there are indeed differences. Using a program called Kaliedoscope, I was able to find out the difference:there are a handful of pixels that for some reason are colored differently than they should be. Not sure why it is. My code doesnt even manipulate RGB values.

解决方案

What image format did you save as? If you used a lossy compression, such as JPEG, then the image colours will always be slightly different, as they have been re-compressed. You should use a non-lossy format such as PNG.

You should also not use 'diff' to look at images. I don't know what Kaleidoscope is, but the ImageMagick 'compare' utility is good for looking at the difference between two images. 'diff' will almost always tell you there is a difference between two images, even if they are identical and you used a non-lossy format, due to the fact that when you recompressed it, it might use a different compression technique.

Also, you say you were given the flipped image file (assuming this is a homework thing). In that case, it's possible that the person who generated that file made the mistake (e.g., using a lossy compression). I would not worry about minor pixel differences in that case.

这篇关于图像处理程序中的微小图像差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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