image registration

1 次查看(过去 30 天)
marlina
marlina 2011-8-8
how to re-insert processed sub-image into original image (image registration). Below is some summary step with a coding:
1. ROI determination from original image.
% Selection of point for ROI region
roipoints(1,:) = round((contour(other(1),:)+contour(minima(1),:))/2);
roipoints(2,:) = round((contour(minima(3),:)+contour(other(2),:))/2);
if handness, % take care of differences between left and right hand aux = roipoints(2,:); roipoints(2,:) = roipoints(1,:); roipoints(1,:) = aux; end
theta = anglepoints(roipoints(1,:), roipoints(2,:)) + 180;
r = [0 1 0; -1 0 0;0 0 1]; % -90º
p = r*[roipoints(1,:)'-roipoints(2,:)'; 1];
roipoints(3,:) = [p(1:2) + roipoints(2,:)']'; r = [0 -1 0; 1 0 0;0 0 1]; % +90º
p = r*[roipoints(2,:)'-roipoints(1,:)'; 1];
roipoints(4,:) = [p(1:2) + roipoints(1,:)']';
figure(11), imshow(Igray) ,title('Region of Interest'); hold on; plot([contour(:,2); contour(1,2)], [contour(:,1); contour(1,1)], 'b', 'LineWidth', 2);
hold on; plot(contour(other(1), 2), contour(other(1), 1), 'o', 'MarkerFaceColor', 'g', 'MarkerSize', 5);
hold on; plot(contour(minima(1), 2), contour(minima(1), 1), 'o', 'MarkerFaceColor', 'g', 'MarkerSize', 5);
hold on; plot(contour(minima(3), 2), contour(minima(3), 1), 'o', 'MarkerFaceColor', 'g', 'MarkerSize', 5);
hold on; plot(contour(other(2), 2), contour(other(2), 1), 'o', 'MarkerFaceColor', 'g', 'MarkerSize', 5);
hold on; plot([roipoints(:, 2); roipoints(1,2)], [roipoints(:, 1);roipoints(1,1)], 'r-', 'LineWidth', 2);
2. ROI auto-crop
% Extract preliminary "loose" ROI area
right = max(roipoints(:,2));
left = min(roipoints(:,2));
bottom = max(roipoints(:,1));
top = min(roipoints(:,1));
roi = Igray(top:bottom, left:right, :);
% Rotate ROI area to standard orientation
roi = imrotate(roi, theta);
% Crop "extra" area left from the loose-rotation
extra = 0; % ignore "disturbances" near the edges, due to rotation and the ROI lines being sometimes very near the contour
offset = round((size(roi, 1) - dist2point(roipoints(1,:), roipoints(2,:)))/2) + extra;
roi = roi(offset:end-offset,offset:end-offset, :); figure(16), imshow(roi)
3. ROI processing stage
- Noise filtering
- Image enhancement
- Threshold
- Binary to RGB
4. Re-insert sub-image into original image
% re-rotate ROI
re_roi = imrotate(RGBBW, -theta);
The question is how to re-insert figure 18 into figure 11. Anyone please help me.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometric Transformation and Image Registration 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by