# How can I automatically find the boundary of a high intensity region inside an image?

I have an image I(x,y):

Red indicates high values and blue low values. Everything in black is drawn onto the image afterwards. The black dot (xp,yp) represents a point clicked by an user and the black curve a boundary around the high value region around the user clicked point.

How can I automatically find this boundary?

As can be seen from the picture; I do not want the boundary to propagate through narrow gaps.

• Pretty good example of why you shouldn't use the jet colormap. :) Commented Oct 9, 2012 at 17:12
• Interesting! Are you saying that the visible boundary between green/yellow and red is somewhat arbitrary and that a greyscale image would give a more correct indication of where the intensity changes sharply?
– Andy
Commented Oct 9, 2012 at 17:32
• You say that red indicates high values, but yellow and green are perceptually much brighter, so they look like the high value spots at first glance, but they're actually not important at all. They just happen to appear bright because all the colors in the colormap are fully saturated. Yes, grayscale is better, or other colormaps designed for monotonically increasing luminance. Commented Oct 9, 2012 at 18:23

One method that I have had lots of success with, and others have too, is Circular Shortest Path (CSP). Here is one paper, but there are quite a few more and possibly some code floating around the web. Another technique that are perhaps more popular, and for which code might be more common, are snakes (active contours).

These techniques work by finding a connected path that minimises a certain function. In your case, it would be to find the path that goes through many edge pixels while still remaining somewhat round. The roundness constraint is what keeps the path from going off down the narrow gaps. Snakes are different from CSP in that the boundary is 'grown' out from a seed area; CSP performs a polar transformation about the centre point.

Another possibility is some kind of morphological operator. These can be used to find regions of a particular size. One would convert the image to binary, the apply a morphological opening using a structuring element of a big enough size to fit inside the area of interest, but not anywhere else.

• Thanks geometrikal! Can CSP and Snakes be generalized to a 3 dimensional image, I(x,y,z) and (xp, yp, zp), such as an MRI stack?
– Andy
Commented Oct 9, 2012 at 16:53
• Also do you know of a good C/C++ (Fortran) library that implements CSP and/or Snakes? I found a function called SnakeImage in OpenCV. Do you have any experience with this?
– Andy
Commented Oct 9, 2012 at 17:17
• @Andy, CSP has not been extended to 3D signals as far as I know. I think the way it is implemented makes it hard. Snakes shouldn't be a problem. So far my experience has been just CSP in my own MATLAB code. Are you trying to segment a particular shape? I have seen some recent papers that deform a particular generic shape type to 'fit' inside a region in a 3D signal. e.g. knee joint. I think morphology would give a rough segmentation of the region quite quickly in 3D. Commented Oct 9, 2012 at 23:17
• In my humble opinion, Intensity is not the issue for coherent light sources. One has to convert RGB color space to HSV color space, where Saturation is more important and distinguishable to Intensity. Commented Feb 14, 2016 at 14:48