Image Segmentation 1 Image Segmentation s Image segmentation

  • Slides: 1
Download presentation
Image Segmentation 1. Image Segmentation s Image segmentation is a technique used to extract

Image Segmentation 1. Image Segmentation s Image segmentation is a technique used to extract only desired images from photographs with different information. Using the contrast or color difference, the code divides each pixel so that it has values of - 1 or 1 and finds the desired image. Partial differential equation for image segmentation shows the results depending on the variables lambda and epsilon. The larger the epsilon, the softer the results for image segmentation, and the smaller the lambda, the closer the result is to the original image. Therefore, it is possible to change the values of epsilon and lambda to find the values closest to the desired image. 2017160033 이동훈 3. The Results and A Method for Colored Image Sample Image h=1, lambda=1 2. Image Segmentation Code clear all; clf; hold on f=imread('5¹ø. gif'); %read saved image from file f=double(f); %change format of number to enable saving decimal f 0=(f-min(f)))/(max(f))-min(f))); f 0=2*f 0 -1 % converts numbers from 0 to 255 to the same ratio of the number from - 1 to 1 Nx=size(f, 1); Ny=size(f, 2); %stores the number of pixels in the image f 0=-f 0; %send the desired image to + 1 or - 1 h=2. 5, lambda=1 Color Image Segmentation We can respond RGB to three-dimensional spatial coordinates. When the coordinate values are converted linearly, they can correspond to one straight line and we can use it in the code on the left. h=1. 7; eps 2=h^2 %make the inverval x=linspace(-0. 5*h, h*(Nx+0. 5), Nx+2); y=linspace(-0. 5*h, h*(Ny+0. 5), Ny+2); %point a dot for image and ghost cell u(1: Nx+2, 1: Ny+2)=-1; %take -1 for ghost cell u(2: Nx+1, 2: Ny+1)=f 0; %mark the corresponding points to the image dt=0. 1; %take learning rate 0. 1 v=u; %set new variable v=u lambda=2; %take lambda=2 for k=1: 50 %repeat 50 times c 1 = sum(f 0. *(1. 0+u(2: Nx+1, 2: Ny+1)))). . . /sum(1. 0+u(2: Nx+1, 2: Ny+1))); c 2 = sum(f 0. *(1. 0 -u(2: Nx+1, 2: Ny+1)))). . . /sum(1. 0 -u(2: Nx+1, 2: Ny+1))); for i=2: Nx+1 for j=2: Ny+1 v(i, j)=u(i, j)+dt/h^2*(u(i-1, j)+u(i+1, j). . . +u(i, j-1)+u(i, j+1)-4*u(i, j)). . . %heat equation, make graph +dt*u(i, j)*(1+u(i, j))*(1 -u(i, j))/eps 2. . . smooth -dt*lambda*((1. 0+u(i, j))*(f 0(i-1, j-1)-c 1)^2. . -(1. 0 -u(i, j))*(f 0(i-1, j-1)-c 2)^2); %modified allen-chan, maximize deviation end u=v; %set u=v u(1, : )=u(2, : ); u(Nx+2, : )=u(Nx+1, : ); u(: , 1)=u(: , 2); u(: , Ny+2)=u(: , Ny+1); %set ghost cell to Ambient Value clf; mesh(x, y, u') %draw graph axis([x(1) x(end) y(1) y(end) -1 1]) %set axis view(-37, 14) %the position of view pause(0. 1) %shows images at 0. 1 second intervals end h=1, lambda=2. 5 When color photographs are made to a value of black and white, they are easiest to obtain as the average, and can be multiplied by weights considering the degree to which a person is sensitive to the eye. The above pictures are the original, black-and-white picture by the average , and by multiplying the weight. 4. Reference -http: //blog. ggaman. com/965#recent. Entries -[Color image segmentation: advances and prospects], H. D. Cheng, 2001