How do I Calculate the area of polygons in the checkerboard image in MATLAB?
Please guide me to write the program in MATLAB.
I have a checkerboard image. Each square of the chess board has given a number (index number).
On this image, a series of parallel lines are d开发者_JAVA百科rawn.How do I calculate the area of each square of the chess board that is located within the parallel lines?
Well.. What do you mean polygons? They are all squares. Anyhow, the code is :
function CalculateAreas()
I = logical(checkerboard(20));
B = bwlabel(I,4);
props = regionprops(B,'Area');
disp([props.Area]);
end
精彩评论