Is it possible to reconstruct an image from the number of pixel counts and bins information?
1 次查看(过去 30 天)
显示 更早的评论
Happy New Year and I need your help!
I have the following imhist function that yields the number of pixel counts and bin locations.
[counts,binLocations] = imhist(I)
Is it possible to reconstruct a "new" image using the number of "new pixel" counts and "same" bins information? If yes - can you please suggest how?
0 个评论
采纳的回答
Walter Roberson
2022-1-20
I = imread('pout.tif');
imshow(I)
I1 = reshape(sort(I), size(I));
imshow(I1)
[c,b] = imhist(I);
[c1,b1] = imhist(I1);
all(c == c1)
all(b == b1)
Two different images, exactly the same counts and bin values.
It follows that knowing the counts and bin locations is not enough to recreate the image.
0 个评论
更多回答(1 个)
Matt J
2022-1-20
编辑:Matt J
2022-1-20
As Walter has shown, it is not an invertible mapping, however, if you use histcounts() instead, there is enough information for a coarse inversion:
I = double(imread('pout.tif'));
[counts,binLocations,label]=histcounts(I(:),4);
vals=movmean(binLocations,2);
Irecon=reshape(vals(label), size(I)); %reconstructed
montage({I/255,Irecon/255})
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!