I know that variations of this question get asked a lot on here, but I haven't found a solution that works for my problem very well.
How do I remove the black border from the image above programmatically, but not by using imcrop!? I would prefer to find & remove all of the black pixels in the image, by effectively deleting that data--leaving me with a (yes) cropped image that contains only the color region of this image. My attempt is as follows:
firstFrame = read(vidObj,1);
title('Define the scale bar region:','FontSize',16);
scaleBar = drawrectangle('Color',[1 1 0]);
roi_Bar = scaleBar.Position;
I = imcrop(firstFrame, roi_Bar);
mask = (I(:, :, 1) == 0) & (I(:, :, 2) == 0) & (I(:, :, 3) == 0);
I(mask) = ;
Many thanks in advance!