필터 지우기
필터 지우기

Can anyone provide me chain code for boundary detection in the matlab with explanation?

조회 수: 1 (최근 30일)
Chain code is used for boundary detection.

답변 (2개)

Walter Roberson
Walter Roberson 2015년 12월 22일
  댓글 수: 2
Ekta Sharma
Ekta Sharma 2015년 12월 23일
Hello Sir Thank you very much for your reply but I am unable to run it as while I am giving input to this program it is giving error and I am unable to understand what is unwrap means in input.Kindly help.
Walter Roberson
Walter Roberson 2015년 12월 23일
unwrap: "if enable phase inversions are eliminated"
As for the errors: you will need to show us the error messages you are encountering.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2015년 12월 23일
It's easy enough to do yourself. You can use bwboundaries() to get a list of boundary coordinates. Then loop over them and figure out which of the 8 directions the next pixel in the list is and assign a number from 1 to 8 to that pixel.
boundaries = bwboundaries()
x = boundaries(:, 2);
y = boundaries(:, 1);
for k = 1 : length(x)-1;
thisX = x(k);
thisY = y(k);
nextX = x(k+1);
nextY = y(k+1);
if nextX == thisX
% and so on.....
end
It's late here, so see if you can complete it yourself. It's easy.
  댓글 수: 1
Ekta Sharma
Ekta Sharma 2016년 2월 29일
I am doing like this way but not getting the desired results.Can you help? clc; clear; close all; I=imread('tool.png'); % imshow(I) I2 = imcrop(I,[180 174 250 450]); figure imshow(I2) im2double(I2); t=graythresh(I2); BW=im2bw(I2,t); figure imshow(BW) J=bwperim(BW); B=im2double(J); imshow(B) [M, N]=size(B); p=7; q=6; h=5; s=4; t=3; u=2; v=1; w=0; for j=2:N-1 for i=2:M-1 if B(i,j)==1 fprintf('Element(%d,%d) = %d.\n',i,j,B(i,j)) x=i; y=j; while (x>=2 && y<=246) if B(x+1,y+1)==1 fprintf('The chain code for (%d,%d)= %d.\n',x,y,p) newx=x+1; newy=y+1; break; elseif B(x+1,y)==1 fprintf('The chain code for (%d,%d)= %d.\n',x,y,q) newx=x+1; newy=y; break; elseif B(x+1,y-1)==1 fprintf('The chain code for (%d,%d)= %d.\n',x,y,h) newx=x+1; newy=y-1; break; elseif B(x,y-1)==1 fprintf('The chain code for (%d,%d)= %d.\n',x,y,s) newx=x; newy=y-1; break; elseif B(x-1,y-1)==1 fprintf('The chain code for (%d,%d)= %d.\n',x,y,t) newx=x-1; newy=y-1; break; elseif B(x-1,y)==1 fprintf('The chain code for (%d,%d)= %d.\n',x,y,u) newx=x-1; newy=y; break; elseif B(x-1,y+1)==1 fprintf('The chain code for (%d,%d)= %d.\n',x,y,v) newx=x-1; newy=y+1; break; elseif B(x,y+1)==1 fprintf('The chain code for (%d,%d)= %d.\n',x,y,w) newx=x; newy=y+1; break; end end end end end

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Feature Detection and Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by