I have three images that should have similar range of histogram is the rescaling a correct procedure?

4 次查看(过去 30 天)
I have three images that should have similar range of histogram is the rescaling a correct procedure or there may be better solution?
I afraid of any lost of information in my images. Is there any better idea?

回答(3 个)

Bhavana Ravirala
Bhavana Ravirala 2022-8-25
Hi ,
For this, you can adjust the contrast of the image with the help of “imcontrast” tool. Or you can adjust the contrast by using different functions.
Refer to the below documentations to know more about the functions and “imcontrast” tool
Hope this helps!!
  3 个评论
2NOR_Kh
2NOR_Kh 2022-8-25
I thought imadjust will change my information in a way that suprpesses the low frequency information and making the high frequency info more highlighed. Either of these two changes, I might avoid them.
Also, I used 'rescale' function, if the imcontrast in not causing information loss I'll prefer imcontrast.
DGM
DGM 2022-8-26
imadjust(), imcontrast(), and rescale() all do similar things. They have no awareness of spatial frequency. It is strictly a linear mapping of intensity values. When both input and output ranges are specified, the transformation is equivalent to:
outpict = (outmax-outmin)*(inpict-inmin)/(inrgmax-inmin) + outmin;
The histogram will simply be translated/stretched, but the general shape of the distribution won't change unless you specify an input range that forces truncation.
Using rescale(), you can either specify the output levels alone, and the input levels are implicitly specified by the image extrema:
y = rescale(x,outmin,outmax);
or you can specify both the output and input levels:
y = rescale(x,outmin,outmax'inputmin',inmin,'inputmax',inmax);
Using imadjust(), you can specify input levels and output levels explicitly:
y = imadjust(x,[inmin inmax],[outmin outmax]);
... though imadjust expects those parameters to be normalized, and it expects the image to be correctly-scaled for its class. Rescale() does not.
Using imcontrast() only allows the adjustment of the input range, not the output range. Imcontrast() does the same thing as imadjust(), it's just less flexible. Its only unique ability is that it's a GUI tool.
If you're after something that's dependent on spatial frequency, or if you're after something that will reshape the distribution shown in the histogram, then that's a different story, and you might want to elaborate.

请先登录,再进行评论。


Image Analyst
Image Analyst 2022-8-26
编辑:Image Analyst 2022-8-26
It really depends on what you want to achieve. Explain why you think you want all images to have a similar histogram. It might or might not be needed, depending on what your goal is. Also explain if you just want it for a visually pleasing and comparable display, or if you want to actually change the original pixel values into something different.
Plus we need to know why they're different in the first place. Should they be the same, but, for example, your camera automatically adjusts its parameters (so they're not the same for every photo), or your lighting flickers?
  4 个评论
2NOR_Kh
2NOR_Kh 2022-8-26
actually my purpose is more analyzing than visualising. The next step is to calculate few parameters based on my image, and I can't do anything on the other two images which I applied my filters on.

请先登录,再进行评论。


Image Analyst
Image Analyst 2022-8-26
If (like @DGM mentioned) you're after something that will reshape the histograms to something custom, see my File Exchange program:
For example in the demo image below, I reshape the original histogram on the left to the silouhette of the woman as show on the right.
You can basically give any histogram you want, of any number of bins and any shape, and the process illustrated in the program will change the image such that the new histogram will have the number of bins and counts (shape) you specified.
  2 个评论
2NOR_Kh
2NOR_Kh 2022-8-26
That is not what I'm looking for but your algorithm is really interesting. Can you explain a little bit more about the functions of this method? what information this method will give us ?
Image Analyst
Image Analyst 2022-8-27
It gives no information. It's just a fun toy with no real world use. Sure you could use it to give a perfectly flat histogram if you wanted but most people know that perfectly flat histograms, which histogram equalization functions attempt to deliver but rarely do because they're too simple and not sophistcated enough, are not useful. Histogram equalized images are not needed for image analysis as far as I've ever seen in my 40+ years of image processing, and they tend to produce harsh, awful, unnatural looking images.
It's like my Maze solving algorithm (also in my File Exchange) - no real use and just for fun.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Processing and Computer Vision 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by