A list,

The basic idea of region growth algorithm is to merge the pixels with similar quality. For each region, a seed point should be designated as the starting point of growth, and then the pixels of the field around the seed point are compared with the seed point, and the points with similar qualities are combined and continue to grow outward until no pixel that meets the conditions is included. The growth of such a region is complete. There are several key questions in this process: a> given seed points (how are seed points selected?) The selection of seed points is often achieved by manual interaction, but also by other means, such as looking for objects and extracting internal points of objects as seed points. B > Determine the difference of the criterion gray image that can include adjacent pixels in the growth process; Color image color and so on. It’s all about the relationship between pixels. C > stop conditions for growth

2 Algorithm steps:

A > Create a blank image (all black);

B > Store the seed points in the vector, which stores the seed points to be grown;

C > pop up seed points in turn and judge the relationship between seed points such as 8 neighboring areas (growth rule), and similar points are used as seed points for next growth;

D > The vector stops growing when no seed points are present.

Ii. Source code

clear all, close all, clc
 
f = imread('defective_weld.tif');
imshow(f), title('Raw image')
 
figure, [counts,x] = imhist(f); bar(x,counts), title('Histogram of the original image')
 
S = 255;
T = 65;
[g, NR, SI, TI] = regiongrow(f, S, T);
figure, imshow(SI), title('Seed point image')
figure, imshow(TI), title('Image after threshold test')
figure, imshow(g), title('8 Images after connectivity analysis')
bw = edge(g, 'canny');
figure, imshow(bw), title('Edge image')
ff = f;
ff(bw) = 0;
figure, imshow(ff), title('Superimposed image')
Copy the code

3. Operation results





Fourth, note

Complete code or write to add QQ 1564658423