Does bwboundaries work properly ?

hi all , I am wondering if bwboundaries function of the IPT works properly , i use it for fourier descriptors but it generates very very poor results ,
i used this code for getting fourier descriptors for tow identical but different in size ovals
im1 = imread('sc1.gif');
im2 = imread('sc2.gif');
im1 = im2bw(im1);
im2 = im2bw(im2);
b1 = bwboundaires(im1);
b2 = bwboundaries(im2);
f1 = frdescp(b1{1});
f2 = frdescp(b2{1});
f1 = f1(2:10);
f1 = abs(f1);
f1 = f1/f1(1);
f2 = f2(2:10);
f2 = f2/f2(1);
f2 = abs(f2);
and the result was f2 = 1.00 0.7534 0.6284 1.4481 and others f1 = 1.00 1.8451 1.1260 1.9316 and others !!
so what i need is to know if this function returns an ordered set of points in a boundary or not , or i need to know how to generate fourier descriptors for an object !!

Risposte (1)

Walter Roberson
Walter Roberson il 18 Apr 2012

0 voti

The documentation for bwboundaries does not promise that the pixels returned will be in any particular order, just that they will be boundary pixels.
If you need an ordered trace, check bwtraceboundary() . Watch out, though, for the tracing of corners, as it might not come out exactly as you expect.

2 Commenti

Adham
Adham il 18 Apr 2012
so , how can i provide an ordered set , by ordered i mean if we start by a pixel a1 then the next pixel a2 will be a neighbor of it so that this set can by used in fourier descriptors !
bwtraceboundary() -- but experiment with some corner shapes to be sure you understand the trace order at corners.

Accedi per commentare.

Richiesto:

il 18 Apr 2012

Community Treasure Hunt

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

Start Hunting!

Translated by