explanation on a bwtraceboundary code
4 views (last 30 days)
I have this code and I can't understand what does the 55 on the 4th row. Can anyone explain me?
BW = imread('blobs.png');
*for row = 2:55:s(1)*
contour = bwtraceboundary(BW, [row, col], 'W', 8, 50,...
hold on; plot(col, row,'rx','LineWidth',2);
Christiaan on 23 Mar 2015
In your code an image is imported, with the size (s1) by (s2) pixels. The first value corresponds to the amount of horizontal pixels. The second value corresponds to the amount of vertical pixels.
In the first for loop, an array is generated, where 8 rows are selected (2, 25, 112 .. etc). In the second loop each column is selected (1, 2, 3, ...) . Therefore by nesting these for loops, a grid is generated, where a calculation can be performed, where the knots of these gridlines can be used for calculation.
In this MATLAB code, the if loop checks if the point on that knot is zero (white). I hope this has helped you.
As a hint: On this Mathworks website, a short tutorial can be found to trace an object in an binary image.
Kind regards, Christiaan