EGH444: Digital Signals and Image Processing QUT
Active Contours (Snake)
In this section we will experiment with the Active Contours (a.k.a. snake) segmentation method. Load an image such as rhino2.jpg into the imageSegmenter tool. Then the first step is to define an initial mask that the method will need to iterate from. This mask will define the initial guess on the location and shape of the contour of the segment you are trying to extract from the image.
In ‘ADD TO MASK’ click on the right arrow for more options and select ‘Create ROI’. Create an ROI using the freehand tool: draw a rough shape inside the body of the rhino (make it quick and rough). Then run the Active Contours algorithm by clicking on Evolve. Consider adding more iterations if needed and see the impact.
Note you can include Texture features (using the Gabor canonical filters) See if that makes a difference.
Now do a ’New Segmentation’. This time create an ROI with boundaries outside of the rhino. Run Active Contours again. What do you observe?
Load the image heart.pgm in the ImageSegmenter. Draw a small ROI inside the heart cavity, and run Active Contours. Observe. Now draw a small ROI outside the cavity and run. What happens?Why? How could that be addressed?
Close the ImageSegmenter tool and use the function activecontour directly in Matlab code. Note you will need to create a mask for the initial image you want to segment. Look at adjusting the parameter ‘ContractionBias’ and see the impact, depending on your mask.
4 K-Means Clustering
Use the code in kmeans.m to segment images using the k-means clustering algorithm. An example is given in kmeans demo.m.
Test different parameter options for the kmeans.m function. Note that the number of clusters must be chosen in advance for each image. Try different numbers of clusters for each image. How do you decide what is the ‘best’ number of clusters (k) to use?