I use octave and the getframe function getframe not available, so I wrote this trivial function
%% Draw red rectangle IN the image using the BoundingBox from regionprops function rgbI = drawRectangleOnImg (box,rgbI) x = box(2); y = box(1); w = box(4); h = box(3); rgbI(x:x+w,y,1) = 255; rgbI(x:x+w,y+h,1) = 255; rgbI(x,y:y+h,1) = 255; rgbI(x+w,y:y+h,1) = 255; rgbI(x:x+w,y,2) = 0; rgbI(x:x+w,y+h,2) = 0; rgbI(x,y:y+h,2) = 0; rgbI(x+w,y:y+h,2) = 0; rgbI(x:x+w,y,3) = 0; rgbI(x:x+w,y+h,3) = 0; rgbI(x,y:y+h,3) = 0; rgbI(x+w,y:y+h,3) = 0; end
source share