matlab如何画两个图像,在MATLAB中绘制两个图像之间的匹配点

更新时间:2023-06-18 22:09:03 阅读: 评论:0

matlab如何画两个图像,在MATLAB中绘制两个图像之间的匹
配点
您可以使⽤MATLAB内置的showMatchedFeatures函数.如果您使⽤了任何内置特征检测算法,或者两个⼤⼩为N x 2的矩阵,该函数可以采⽤⼀对特征结构.其中两个是必需的,因为每个都描述了两个特征之间的坐标对.两个图像彼此对应.该功能还需要您检测到关键点的两个图像.
您可以使⽤⼀些透明度来呈现它们,或者最流⾏的⽅法是将它们彼此并排放置,并在每对相应点之间绘制⼀条线(我相信这就是您所追求的).
查看MATLAB⽂档以获取更多详细信息:
如果您想查看⼀些⽰例代码和输出,请在此处查看:
另外⼀个选项
注意:您需要计算机视觉⼯具箱才能运⾏showMatchedFeatures功能.我不确定你有哪些⼯具箱.如果您没有计算机视觉⼯具箱,那么您可以并排堆叠两个图像,然后在每对点中运⾏⼀个循环并在它们之间画⼀条线.这假设两个图像都是相同类型(uint8,uint16等)并且都是灰度图像.
假设您有图像处理⼯具箱,您可以这样做:
% Assuming im1 and im2 are already loaded into your environment
% im1 and im2 are the two images you are comparing to
农村改厕
樊梨花怎么死的% points1 and points2 are M x 2 matrices of corresponding points
% between im1 and im2
% The co-ordinates in the ith row of points1 correspond to the
% ith row of points2
% Important Note: Each row assumes co-ordinates in (x,y) format
% x - horizontal, y - vertical
% y is assumed to be y-down (i.e. downwards is positive)
figure;
stackedImage = cat(2, im1, im2); % Places the two images side by side
imshow(stackedImage);
width = size(im1, 2);蜻蜓是益虫还是害虫
hold on;
numPoints = size(points1, 1); % points2 must have same # of points
% Note, we must offt by the width of the image
for i = 1 : numPoints
plot(points1(i, 1), points1(i, 2), 'y+', points2(i, 1) + width, ...
points2(i, 2), 'y+');
line([points1(i, 1) points2(i, 1) + width], [points1(i, 2) points2(i, 2)], ...
'Color', 'yellow');
end
这应该⼤致实现showMatchedFeatures的功能.
花未眠如果两个图像的尺⼨不同,会怎么样?
如果您想要⽐较的两个图像都没有相同的尺⼨(即两个图像不共享相同数量的⾏和/或列),您只需创建⼀个⾸先为空⽩的输出图像,输出的总⾏数是两者之间的⾏的最⼤值,列总数是它们的总和.因此,您只需这样做.这假设两个图像都是相同的类型,并且像之前⼀样是灰度:
figure;
[rows1,cols1] = size(im1);
[rows2,cols2] = size(im2);
%// Create blank image
stackedImage = zeros(max([rows1,rows2]), cols1+cols2);
机械摆钟stackedImage = cast(stackedImage, class(im1)); %// Make sure we cast output
集体朗诵
%// Place two images side by side
性爱瑜伽
stackedImage(1:rows1,1:cols1) = im1;
stackedImage(1:rows2,cols1+1:cols1+cols2) = im2;
%// Code from before
imshow(stackedImage);
width = size(im1, 2);
hold on;
numPoints = size(points1, 1); % points2 must have same # of points
% Note, we must offt by the width of the image
for i = 1 : numPoints
plot(points1(i, 1), points1(i, 2), 'y+', points2(i, 1) + width, ...
points2(i, 2), 'y+');
line([points1(i, 1) points2(i, 1) + width], [points1(i, 2) points2(i, 2)], ...
'Color', 'yellow');
end
>结辩

本文发布于:2023-06-18 22:09:03,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/986285.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:图像   特征   功能   检测   需要
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图