使用相机拍摄的新图像与从相机胶卷加载的相同图像不同?

发布于 2024-08-13 19:55:10 字数 231 浏览 2 评论 0原文

当我获得用户用相机拍摄的新图像并保存其校验和时,当用户稍后从相机胶卷中重新加载同一图像时,校验和会有所不同。难道是因为相机胶卷中保存的图片是JPG格式,是有损的,所以像素不一样?我试图使用校验和来检测它是否是同一张图像:知道如何克服这种情况吗?我是否需要自己将其保存为 JPG,然后将其读入内存,以便我可以获得与稍后从相机胶卷中获得的相同字节?如果这样做,我还需要确保保存与相机胶卷相同的 JPG 格式......

谢谢! 帕特里克

When I get a new image taken by the user with the camera and save its checksum, when the user later reloads that same image from the camera roll, the checksum is different. Could this be because the image saved in camera roll is in JPG format, which is lossy, and therefore its pixels are different? I am trying to use the checksum to detect that it is the same image: any idea how to overcome this situation? Do I need to save it as a JPG myself, then read it into memory so that I can get the same bytes that I will get from the camera roll later? If I do, I would also need to be sure that I save the same JPG format as the camera roll ...

Thanks!
Patrick

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不必你懂 2024-08-20 19:55:10

我不是 iPhone 专家,但我知道保存 JPEG 时,有很多“质量”参数,如果将图像编码为 JPEG 格式且参数略有不同,则像素值会有所不同。

因此,除非您能找到一种使用与相机胶卷完全相同的过程可靠地将图像转换为 JPEG 的方法,否则您自己将图像转换为 JPEG 不会有太大用处。

如果可以读取相机胶卷中图像的创建时间或一些类似的元数据,这可能是一个更好的方法。

I'm not an iPhone expert but I know that when saving a JPEG, there are many "quality" parameters, and if an image is encoded to JPEG format with slightly different parameters, the pixel values will be different.

So unless you can find a way to reliably convert an image to JPEG using exactly the same process as camera roll, converting the image to JPEG yourself isn't going to be of much use.

If it's possible to read the creation time of images in the camera roll, or some similar metadata, this would probably be a better method.

丿*梦醉红颜 2024-08-20 19:55:10

返回图像的 API 返回来自相机的原始数据,或从库转换为原始数据的图像。

正如您所猜测的,JPG 处理是有损的,因此即使图像大小相同,原始数据也会有所不同。

您可能最好在几个固定位置取一个区域的平均值并将其用作校验和,尽管这当然很容易产生误报,因此您需要小心操作方式。

The API to return you an image returns you the raw data from the camera, or an image converted to raw data from the library.

As you surmised, the JPG process is lossy, so even if the images are the same size the raw data will differ.

You would probably be better off taking an average of an area at a few fixed locations and using that as a checksum, though of course that can easily generate false positives so you need to be careful how you do it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文