Hi, I need to draw a rectangle on my face using white pixels.
Best Answer
To draw a rectangle, you can use rectangle(), plot(), line(), rbbox(), or imrect() depending on what you mean by "draw a rectangle".
You might also be interested in bwareafilt() to extract blobs of certain areas (like only the largest blob), and imfill() to fill in black islands in the white blobs.
stats is a structure array. Each element is a structure and has it's own bounding box. So stats(1).BoundingBox is the bounding box (x,y,width,height) of the first blob. And stats(2).BoundingBox is the bounding box (x,y,width,height) of the second blob, and so on. To display them all:
hold on;
for k = 1 : length(stats) % Loop through all blobs.
Best Answer