Freeman chain code
Show older comments
Hello ,
It is very urgent .I need to generate a freeman chain code of a character contour. Please read the comment lines .I get an error . If anyone [particularly the author Alessandro Mannini <mailto:mannini@esod.it mannini@esod.it> ] could resolve it , please avail me the answers . It will be helpful for my research .
my matlab file is as follows
clc;
close all;
clear all;
%READ THE IMAGE , NOTE :THE BACKGROUND IS WHITE AND FOREGROUND IS BLACK
im1 =imread('D:\SAIGEETHA\ME\V SEMESTER\MINI PROJECT\000t01.tif');
% FIND THE COORDIANTES OF THE FIRST OCCURENCE OF THE BALCK PIXEL OF THE
% GIVEN IMAGE
[r,c]=find(im1==0,1,'first');
%TRACE THE CONTOUR OF THE CHARACTER USING contour_trace.m
%contour_trace.m is downloaded from file Exchange
% Syntax :
% [pixel,I]=contour_trace(BW,r,c)
%
% Input :
% r,c - row, column value of a single pixel on the contour.
% BW - Black & White Image (Binary Image).
%
% Output :
% I - Binary Image containing just the desired contour.
% pixel - N x 2 matrix which stores the pixel value of the contour,
% column1 gives the rows & column2 the corresponding column.
[pixel,I]=contour_trace(im1,r,c);
%SWAPPED THE COLUMNS B'COZ THE b INPUT OF THE chaincode(b,unwrap) FUNCTION
%SHOULD BE (y,x) .
% INPUT:
% --------------------------------------------------------
% b - boundary as np-by-2 array;
% np is the number of pixels and each element is a pair (y,x) of
% pixel coordinates
% unwrap - (optional, default=false) unwrap code;
% if enable phase inversions are eliminated
%
b=cat(2,pixel(:,2),pixel(:,1));
% GENERATE THE CHAIN CODE
c=chaincode(b,true);
*THE ERROR IS AS FOLLOWS *
??? Error using ==> chaincode at 77
Curve isn't 8-connected in elements:
With regards
Saigeetha
2 Comments
Walter Roberson
on 2 Dec 2011
This question follows on the (unanswered) question http://www.mathworks.com/matlabcentral/answers/22219-freeman-chain-code
Accepted Answer
More Answers (0)
Categories
Find more on Text Detection and Recognition in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!