problem with output of imrotate function.
Mostrar comentarios más antiguos
Hi, after using imrotate function, why center of object is changing. this problem is appear by obtain center of object before and after rotation. please guide me how to rotate image without changing coordination of center's object. original image:

output after rotation:

clc;clear;
img = imread('ms0.jpg');
degree = 45;
img1 = imrotate(img,-degree,'crop');
prob1 = regionprops(img,'centroid');
prob2 = regionprops(img1,'centroid');
img_center = prob1.Centroid;
img1_center = prob2.Centroid;
img_center = round(img_center);
img1_center = round(img1_center);
fprintf('center before rotation is : ( %d , %d ) \n.',img_center(1),img_center(2));
fprintf('center after rotation is : ( %d , %d ) \n.',img1_center(1),img1_center(2));
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Geometric Transformation and Image Registration en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!