我应该使用图像的哪些值来生成 haar 小波?

发布于 2024-10-20 04:12:44 字数 238 浏览 5 评论 0原文

我目前有一个 Java 程序,可以获取图像中每个像素的 RGB 值。我还有一种方法来计算二维值矩阵上的哈尔小波。但是我不知道应该为计算哈尔小波的方法赋予哪些值。我应该平均每个像素的 RGB 值并在其上计算 haar 小波吗?或者也许只使用 r、g、b 中的 1 个。 我正在尝试为图像创建独特的指纹。我在其他地方读到这是一个很好的方法,因为我可以采用 2 个小波的点积来查看图像彼此之间的相似程度。

请让我知道我应该计算哈尔小波的值。 谢谢 杰西

I currently have a Java program that will get the rgb values for each of the pixels in an image. I also have a method to calculate a Haar wavelet on a 2d matrix of values. However I don't know which values I should give to my method that calculates the Haar wavelet. Should I average each pixels rgb value and computer a haar wavelet on that? or maybe just use 1 of r, g,b.
I am trying to create a unique fingerprint for an image. I read elsewhere that this was a good method as I can take the dot product of 2 wavelets to see how similar the images are to each other.

Please let me know of what values I should be computing a Haar wavelet on.
Thanks
Jess

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

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

发布评论

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

评论(2

烧了回忆取暖 2024-10-27 04:12:44

您应该将 R/G/B 分量视为不同的图像:为 R、G 和 B 各创建一个矩阵,然后独立地将小波应用于其中的各个部分。

然后,您可以从 3 个小波压缩通道重建 R/G/B 图像,最后将它们组合成 3 通道位图。

You should regard the R/G/B components as different images: Create one matrix for R, G and B each, then apply the wavelet to parts of those independently.

You then reconstruct the R/G/B-images from the 3 wavelet-compressed channels and finally combine those to a 3-channel bitmap.

笑红尘 2024-10-27 04:12:44

由于 eznme 没有回答您的问题(您需要指纹,他解释了压缩和重建),因此您会经常遇到以下方法:

分离颜色和亮度信息(色度和亮度),并以不同的方式衡量它们。有时您甚至会丢弃色度而只使用亮度部分。这会显着减小指纹的大小(约三倍),并考虑到我们感知图像的方式 - 主要通过局部亮度,而不是绝对颜色。作为奖励,您可以获得有关图像颜色处理的一些鲁棒性。

分离可以通过不同的方式完成,例如将 RGB 图像转换为 YUVYIQ 色彩空间。如果您只想保留亮度分量,这两个颜色空间是等效的。然而,它们对色度的编码方式不同。
以下是 RGB 亮度 Y 的线性变换:
Y = 0.299*R + 0.587*G + 0.114*B

当您看一下数学时,您会注意到我们除了创建灰度图像之外什么也没做 - 考虑到我们认为绿色比红色更亮,红色更亮当它们在数值上都相等时,比蓝色更重要。

如果您想保留一点色度信息,为了使指纹尽可能简洁,您可以降低两个 U、V 分量(实际上每个 8 位)的分辨率。因此,您可以通过将它们的信息减少到 4 位并将它们与移位运算符组合在一起,将它们连接成一个 8 位值(不知道这在 java 中是如何工作的)。在最终的指纹距离计算(您提到的点积)中,与亮度相比,色度的权重应该更轻。

Since eznme didn't answer your question (You want fingerprints, he explains compression and reconstruction), here's a method you'll often come across:

You separate color and brightness information (chrominance and luma), and weigh them differently. Sometimes you'll even throw away the chrominance and just use the luma part. This reduces the size of your fingerprint significantly (~factor three) and takes into account how we perceive an image - mainly by local brightness, not by absolute color. As a bonus you gain some robustness concerning color manipulation of the image.

The separation can be done in different ways, e.g. transforming your RGB image to YUV or YIQ color space. If you only want to keep the luma component, these two color spaces are equivalent. However, they encode the chrominance differently.
Here's the linear transformation for the luma Y from RGB:
Y = 0.299*R + 0.587*G + 0.114*B

When you take a look at the mathematics, you notice that we're doing nothing else than creating a grayscale image – taking into account that we perceive green brighter than red and red brighther than blue when they all are numerically equal.

Incase you want to keep a bit of chrominance information, in order to keep your fingerprint as concise as possible, you could reduce the resolution of the two U,V components (each actually 8 bit). So you could join them both into one 8 bit value by reducing their information to 4 bit and combining them with the shift operator (don't know how that works in java). The chrominance should weigh less in comparison to the luma, in the final fingerprint-distance calculation (the dot product you mentioned).

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