I've written a Matlab code to crop an image with respect to a mask.
function Crop_Img = Crop_Xray(Img,Mask)% Find borders
vertical_profile = sum(Mask,2);horizontal_profile = sum(Mask);indexes = find(vertical_profile >0);upper = indexes(1);lower = indexes(end);indexes = find(horizontal_profile > 0);left = indexes(1);right = indexes(end);% Crop Img
Crop_Img = Img(upper:lower, left:right);end
I would like to save the individual image file names (*.png) and their respective bounding box coordinates (upper:lower, left:right) to a .csv, .txt, and .mat file. How should I do that?
Best Answer