英文:
How to obtain this result from a 256 bits monochrome picture?
问题
我刚在我正在研究的《数字图像处理》(作者:Rafael C. Gonzalez 和 Richard E. Woods)一书中找到了这张图片:
这本书没有解释如何得到这个结果,我想知道如何在其他图片上获得相同的结果。
我在书中找到这张图片的上下文是“使用DFT、WHT和DCT的块变换编码”。
图片附近的文字说:
(a) 一张256位单色图像。
(b)–(h) 图像(a)的四个最重要的二进制和格雷编码的比特平面。
你知道可能有什么方法可以得到这个奇怪的结果吗?
英文:
I just found this image in the book I am studying for Computer Vision (Digital Image Processing by Rafael C. Gonzalez and Richard E. Woods):
The book does not explain how to reach this result, and I was wondering how I could reach the same results on other images.
The context in which I found the picture on the book is "block transform coding with the DFT, WHT, and DCT".
The text near the image says:
> (a) A 256-bit monochrome image.
> (b)–(h) The four most significant binary and Gray-coded bit planes of the image in (a).
Do you know any possible way to reach this weird result?
答案1
得分: 2
以下是二进制“位平面”。
如果你对格雷码有疑问,请先了解一下。然后我们可以讨论。其思想与二进制代码并没有太大的不同。
你有一张书页的照片...显示了某个源图像的平面。源图像中的噪音在较低的平面中逐渐变得更加明显。
噪音通过各种复制和打印步骤,就像一个低通滤波器,变成了灰度。这就是为什么只有最高的平面显示相对清晰的边缘和纯黑/白。
请注意,每个平面都被拉伸成全黑或全白。如果我不这样做,你只会得到越来越暗的图片,随着位数的减少。
plane = (im & (1 << k)) # and no scaling by 255
英文:
Here are binary "bit planes".
If you have questions on Gray code, please first read up on it. Then we can discuss that. The ideas aren't much different from binary code.
That photo of a book page you have there... shows the planes of some source image. Noise in the source image becomes successively more apparent in the lower planes.
Noise, through various copying and printing steps that act like a lowpass, turns into grayscale. That's why only the highest planes show fairly clean edges and flat black/white.
Note that each plane is stretched to be fully black or white. If I didn't do that, you'd just get ever darker pictures, the further down the bits you go.
im = cv.imread(cv.samples.findFile("lena.jpg"), cv.IMREAD_GRAYSCALE)
for k in range(8):
title = f"bit position {k}, value {2**k}"
plane = ((im >> k) & 1)
cv.imshow(title, plane * 255)
cv.waitKey()
cv.destroyWindow(title)
plane = (im & (1 << k)) # and no scaling by 255
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论