Histogram to image
Show older comments
Hi, I'm a Matlab newbie and I desperately need your help. I need to enhance image by performing operations on its histogram. But how can I apply that changes to the image? It's easy to extract histogram form the image but how to transform histogram back into image after performing e.g. histogram smoothing?
Answers (2)
Image Analyst
on 24 Dec 2011
0 votes
I suppose you could maybe use the intlut() function. But why don't you tell us what you want to do and we can tell you the best way to achieve it? You can upload your image to tinypic.com.
M W
on 24 Dec 2011
0 votes
6 Comments
Image Analyst
on 24 Dec 2011
Who said anything about removing noise from the image? I don't think you need to. Just follow their algorithm. After smoothing you just continue on and you'll get the expected image.
M W
on 25 Dec 2011
Image Analyst
on 25 Dec 2011
It seems like they want to perform a histogram equalization on grayscale regions between those specific ranges rather than the full 0-255. The way to do this is to do it just like you'd do it for the full 0-255 range but just in that range. The "dumb" but standard way is to compute the cumulative distribution function of the histogram, but just within that small range, and then use intlut to redistribute the gray levels, but again JUST WITHIN THAT RANGE, not over the whole 0-255. (If you did it piecewise over the whole 0-255 I'm sure it would look bizarre with many false edges popping up.) To me it seems like this piecewise method would produce a subtle effect but maybe that's what they're after since they seem to say that the standard way of doing it produces images that are too harsh (which is true and is why global histogram equalization is almost never used in practice and is usually just to illustrate concepts for beginners in image processing).
If you want a more sophisticated and better way that produces a flatter, more evenly distributed output distribution, at the expense of a more complicated algorithm, then check out my histogram shaping File Exchange submission at http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 You could use this in the small ranges instead of the standard CDF way.
M W
on 25 Dec 2011
Image Analyst
on 25 Dec 2011
It may take you a while, as it would for me, but I think is something that you could handle.
M W
on 25 Dec 2011
Categories
Find more on Image Filtering and Enhancement in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!