MATLAB: How to move a picture from the center to the corner.

Image Processing Toolboxmove

Hello! I 'm having an issue with a part of my project and I can't really find out a way to solve it. I have this picture
and I need to move it to the left top corner so it pretty much looks like this
I 've thought about cropping it but I am not supposed to do it that way apparently. Any help will be much appreciated!

Best Answer

  • temp = YourImage ~= Background_Black_value;
    vert_profile = any(temp, 1);
    horz_profile = any(temp, 2);
    now you can find() the first location for vert_profile and horz_profile. Subtract 1 to get the number of rows or columns of background. Now you can circshift() by those counts (just watch out for whether positive values mean left or right, up or down)