I've cropped an ROI with imfreehand() and plotted the center of it using mean (position of cropped region). Then I've plotted the center of completely black image. For the resulting image to have the cropped image at center of black background, is it OK to map the marked centers of both images, or get positions for moving the region manually? I want to do this for multiple images, so is it possible to apply any formula or function? Also I've attached example images and sample output. Kindly help me in this.
I've tried also tried using circular shift, circshift(), for moving the cropped portion to the center of black background, but it is not working. Applying a circular shift made the ROI to move like half portion up an remaining down the center of black image. Why did it appear so?
Original Image:
ROI with centroid marked:
Center of black image:
Desired output image:
Thank you and have a Good Day.
Best Answer