% define scale bar: firstFrame = read(vidObj,1); imshow(firstFrame,'InitialMagnification',300); title('Define the scale bar region:','FontSize',16); scaleBar = drawrectangle('Color',[1 1 0]); roi_Bar = scaleBar.Position; % cropped and screwed: I = imcrop(firstFrame, roi_Bar); figure; imshow(I); % remove black border: mask = (I(:, :, 1) == 0) & (I(:, :, 2) == 0) & (I(:, :, 3) == 0); I(mask) = []; figure; imshow(I); % this returns a horrific result
All black pixels cannot be removed since the image must remain rectangular. You can remove whole rows or whole columns, but not randomly scattered isolated groups of black pixels. With that colorbar image you have, you could delete everything up to and including the black outline of the colormap. Is that what you want to do?
Deleting everything up to and including the black outline would be great.
Then Wait, the pseudocolored thermal picture you attached is nothing like the small color bar image inserted into the body of your message. So let me get this straight. You want just the color bar itself, without the black outline around it and without any other stuff in the scene - just the color bar alone, right? And do you want the color bar cropped out to be its own output image?
Since the colorbar is burned into the image at a constant location for the thermal images from that camera, you can determine that location, like with impixelinfo(), and then simply crop it out:
colorBarImage = rgbImage(row1:row2, column1:column2, :);
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.