Image Processing: Finding areas of high contrast

20 次查看(过去 30 天)
I would like to find the areas of highest contrast in a grayscale image. For example, when the pixels go from sky to buildings in a landscape image, there will be a big contrast between the pixel value of the sky (which will likely be close to the 255 end of the scale), and the pixel value of the building (which is likely to be nearer 0). The best way I can think of to do this is to scan through all the pixels in the image both horizontally and vertically, compare pixel A with neighbouring pixel B, and record the coordinates if the difference is greater than a pre-determined threshold.
The problem with this is that it is an exhaustive search, meaning it will be time-consuming for large images, and it relies on a good threshold value being chosen. Perhaps the threshold could be removed altogether..?
Does anybody know of a quicker and more efficient way of achieving the same end result; where I end up with a list of the top 50 pixel locations with the highest difference against one of their neighbouring pixels?
Any suggestions would be well appreciated.
Thanks! :)

回答(1 个)

Ashish Uthama
Ashish Uthama 2011-3-17
Your description mirrors 'edge detection', here's some detail on one of the ways to do this: Sobel edge detection. An edge is essentially the boundary line between two differing gray scales.
The image processing toolbox has a function for it, edge.
  1 个评论
Philip
Philip 2011-3-17
Thanks! Yes, I guess the objective is quite close to edge detection, except - for the example given earlier - I hope to end up with 'edges' only for the horizon line of the image (where the buildings meet the sky). I think in hind-sight the above strategy I mentioned would over-detect these "edges" giving me many more edges in other areas of the image...

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by