qusetion about image histogram modification
10 次查看(过去 30 天)
显示 更早的评论
Hi,
I want to ask about image histogram modification
I have write a code that redestribute the graylevels combonents of image histogram, so I create tranformation function to map histogram components to the new one, but I don't know how to apply the transformation function on the original image.
please help
0 个评论
采纳的回答
Image Analyst
2011-11-19
I have a File Exchange submission called "Custom-shaped" histogram that does exactly that. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
I start out by getting the custom shape by segmenting an image and I provide demo images of a car, woman in a bikini, and cityscape so that the histogram will have the shape of a car, woman, and cityscape. But you can skip the part that generates the shape from an image and just start with some array that defines the shape you want.
I suggest you look at my code because it's not a few trivial lines of code that someone can put into a reply here. Not if you want it done correctly and accurately. There are some nuances that you might not think of at first, like how to distribute bins spatially. For example if the bin at gray level 145 is supposed to get distributed to bins 100-130 in the new image, which pixels in the old image get set to 100, which get set to 101, which get set to 102, and so on. It's a lot trickier than you might think at first.
The code can also do PERFECT histogram equalization to give a perfectly flat histogram with uniform spatial redistribution. You won't find that code in any MATLAB function or any Answers or Newsgroup posting. They all give shapes, or, at best, a sort of flat histogram but with slight randomness to it. I've not seen any that give a perfectly flat histogram like I do, probably because it's somewhat advanced and lengthy.
Don't say "Oh it looks too complicated for me" like a lot of people say with my code. Challenge yourself. You can handle it if you just take it one step at a time. It's very well commented.
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!