Code covered by the BSD License  

Highlights from
Freeman Chain Code

5.0

5.0 | 3 ratings Rate this file 78 Downloads (last 30 days) File Size: 2.35 KB File ID: #29518
image thumbnail

Freeman Chain Code

by Alessandro Mannini

 

24 Nov 2010

Gives Freeman chain code 8-connected representation of a boundary

| Watch this File

File Information
Description

usage:
--------------------------------------------------------
    [cc] = chaincode(b,u)

  INPUT:
--------------------------------------------------------
    b - boundary as np-by-2 array
    unwrap - (optional, default=false) unwrap code

  OUTPUT:
 --------------------------------------------------------
    cc is a structure with the following fields:
    cc.code - 8-connected Freeman chain code 1-by-np
    cc.x0,cc.y0 - coordinates of start point
    cc.ucode - unwrapped 8-connected Freeman chain code

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File  
Everyone's Tags
boundary(8), chain code(5), chaincode(2), contour(2), fchcode, freeman(2), image processing, representation
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (13)
30 Aug 2012 Daurat Sinaga

i was running this function and i get output like this :
CC =
x0:0
y0:0
code:[209x1 double], would you explain it for me ?

18 May 2012 rana

would you tell me please the exact steps to run this code ??
than you :)

09 May 2012 Alessandro Mannini

Hi Ann, look to my previous comments (ex. 19/3/2011) the b parameter is an array containing coords of boundary points that should be 8-connected. 8-connected means that if Bn is the n-th element of b and Bn+1 the next their x y coords should satisfy this relations: | Xn - Xn+1 |<=1 AND | Yn - Yn+1 |<=1. Start checking that with a simple example. Regards Alessandro

08 May 2012 Ann

i am trying to use this code on the image but i am getting the error "Curve isn't 8-connected in elements: "

what to do?

17 Apr 2012 Alessandro Mannini

Hi Frb, please note than b contains coords of boundary points order so that they are 8-connected. The find function you use return coords of boundary points but in a different order. From Matlab Help seems it scans matrix column by column. Best regards Alessandro

08 Apr 2012 Frb

hello,
I checked this code, seems very useful but I have problem, I give this piece of code to make it 8-connected:
I=imread('im1.jpg');
BW1=im2bw(I);
BW1=~BW1;
BW2 = bwperim(BW1,8);
image=BW2;
[x y]=find(image==1);
b=[x y];
and then I put the result in b,
when I run the code error applies and says Curve isn''t 8-connected in elements. I appreciate any help.

Kind Regards,
Fariba

23 Mar 2012 Anush

if i have an image what's the procedure to find the chain code for that particular image !

14 Mar 2012 hamza

Thanks for your great work, and I have a question :-
I have image called XYZ.png and I passed that images to this function but I found an error.

Please help me in how to execute this function.

28 Feb 2012 maddy

i had a skeleton with me which i want to give as a input to this chaincode..and when i tried to do that...i am getting that subscript indices are must be either positive or real...please somebody help me in resolving this...

30 May 2011 Amr

i have a silhouette for human image(http://i.imgur.com/fTwkZ.png) and I put the image boundary in an array and then i passed it to the Freeman Chain Code function. this image shows the body boundary is connected to each other but in real it gives me this error
"Curve isn't 8-connected in elements:
idx -> 350
idx -> 700
idx -> 1050
idx -> 1400
....
"

so can any one help me please? :)

19 Mar 2011 Alessandro Mannini

Look at description inside source code:

% b - boundary as np-by-2 array;
% np is the number of pixels and each element is a pair (y,x) of
% pixel coordinates

For example, if you have 4 points p=(y,x) like this p1=(5,1);p2=(5,2);p3=(4,2);p4=(3,1) b is:

b = [ 5 1;5 2;4 2;3 1]

note that points must be 8-connected.

19 Mar 2011 Manhal

hi,
what should be the input for "b"?
is it an image or what ??
need help as soon as possible pls ..
thanx

19 Mar 2011 Santhosh R

A very nice self explanatory code!!
Was very useful for my project.
Great job!!!!!!!!!

Contact us