Info

This question is closed. Reopen it to edit or answer.

I need region based segmentation code urgently

1 view (last 30 days)
komal kella
komal kella on 12 Jul 2017
Closed: Walter Roberson on 12 Jul 2017
% Demo of "Region Based Active Contours" % % Example: % seg_demo % % Coded by: Shawn Lankton (www.shawnlankton.com)
I = imread('ex.jpg'); %-- load the image m = zeros(size(I,1),size(I,2)); %-- create initial mask m(111:222,123:234) = 1; % m(333:444,345:234) = 1;
I = imresize(I,.5); %-- make image smaller m = imresize(m,.5); % for fast computation
subplot(2,2,1); imshow(I); title('Input Image'); subplot(2,2,2); imshow(m); title('Initialization'); subplot(2,2,3); title('Segmentation');
seg = region_seg(I, m, 150); %-- Run segmentation
subplot(2,2,4); imshow(seg); title('Global Region-Based Segmentation');
n=size(m);
M=n(1);
N=n(2);
MSE = sum(sum((m-seg).^2))/(M*N);
PSNR = 10*log10(256*256/MSE);
fprintf('\nMSE: %7.2f ', MSE);
fprintf('\nPSNR: %9.7f dB', PSNR);

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!