是否可以在所有平台上确定性地从jpeg文件中读取像素? [英] Is it possible read pixels from a jpeg file determenistically across all platforms?

查看:97
本文介绍了是否可以在所有平台上确定性地从jpeg文件中读取像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个问题,我发现JPEG图像中的像素可能会略有不同,具体取决于我用来读取它们的计算机.我主要是Python程序员,我更喜欢使用opencv读取图像,但是我不反对使用PIL或在C语言中读取图像.

I've encountered an issue where I've found that the pixels in a JPEG image might vary slightly depending on the computer I'm using to read them. I'm mainly a Python programmer, and I'd prefer using opencv to read my images, but I'm not opposed to doing something using PIL or reading the image in C.

根据此帖子 JPEG图像在多个设备上具有不同的像素值

允许不同的解码器略微改变其输出,因此我感到我的问题的答案是否定的.但是我认为无论如何我都会明确地询问它,以防万一我误解了一些东西,或者这是我必须确保针对特定jpeg库的相同版本构建opencv的问题.

different decoders are allowed to vary their output slightly, so I have a feeling that the answer to my question is no. But I'd figured I'd explicitly ask it anyway just in case I'm misunderstanding something, or it is an issue where I have to ensure that opencv is built against the same version of the a specific jpeg library.

有没有一种方法可以读取jpeg文件(最好使用opencv),以便在我运行代码的任何平台上都能获得相同的像素值?

Is there a way I can read a jpeg file (preferably using opencv) in a way that I get the same pixel values on any platform I run my code on?

推荐答案

在实践中,没有.同一库的不同版本之间,甚至平台之间同一库的相同版本之间,像素可能有所不同.

In practice, no. Pixels may differ between different versions of the same library, or even the same version of the same library between platforms.

理论上,如果在需要支持的所有平台上使用 exact 相同的算法/软件,则将获得相同的像素值.但是我认为这意味着您要么必须自己编写解码器,要么至少要阅读大量源代码并自己配置和编译已知的库.

In theory, you will get the same pixels values if you use the exact same algorithm/software on all platforms you need to support. But I think this means you'll either have to write the decoder yourself, or at least read a lot of source code and configure and compile a known library yourself.

这篇关于是否可以在所有平台上确定性地从jpeg文件中读取像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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