matlab:将几何对象添加到图像的正确方法

发布于 2024-08-05 05:31:03 字数 261 浏览 9 评论 0原文

请帮助解决 Matlab 初学者挑战 我需要创建一个带有少量几何对象(圆圈, 椭圆),然后应用一些投影变换 我的问题是我无法理解如何在图像上实际“绘制”

图像,AFAIU 通常定义为 [X;Y;3] 矩阵, SCIRCLE1 的功能可以计算/返回点的集合 代表圆,但问题是点不是离散的, 坐标是实数而不是像素

我如何重新计算圆输出以使其在图像中有效 坐标系?即我怎样才能“像素化”它?

感谢您的关注,我真的缺少一些基本概念 会感谢你的帮助

约翰

please help with Matlab beginner challenge
i need to create an image with few geometrical objects (circles,
ellipses) and then to apply some projective transforms
my problem is that i cant understand how to actually "draw" on image

image is AFAIU generally defined as [X;Y;3] matrix,
functions as SCIRCLE1 can compute/return collection of points
representing circle, but the problem is that points are not discrete ,
coordinates are real numbers and not pixels

how can i recompute the scircle output to be valid in image
coordinates system ? i.e. how can i "pixelize" it?

thanks for your attention, i really missing some basic concept and
will appreciate your help

John

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

圈圈圆圆圈圈 2024-08-12 05:31:03

好吧,下面是我在 Matlab 新闻组上收到的答案
底线-Matlab中没有内置方法

==========================================
“getframe”可用于合并轴,尽管它更常用于创建电影帧。

MATLAB在这方面确实很弱。有一些原始的
用于绘制到覆盖层的函数(例如矩形(),如果您
想要画一个圆,如果想画一条线就用line())但是没有
我所知道的直接绘制到底层图像的真正方法。所以
你必须使用诸如 getframe 之类的“技巧”,然后应用逻辑
运营。你必须小心这一点,因为我认为什么时候
它为您提供了覆盖层的光栅化版本,它可能是
屏幕上图像的大小,而不是真实的原始矩阵大小
底层图像(我必须重新检查这一点)。

完整线程在这里: http://www.mathworks.com.au/matlabcentral/新闻阅读器/view_thread/261232

well, below is an answer i received on Matlab newsgroups
BOTTOM LINE-no built-in way in Matlab

======================================
'getframe' can be used to merge axes even though it is more commonly used to create movie frames.

MATLAB is really weak in this area. There are some primitive
functions for drawing into the overlay (such as rectangle() if you
want to draw a circle, and line() if you want to draw a line) but no
real way that I know of to draw right into the underlying image. So
you have to use "tricks" such as getframe and then apply logical
operations. And you have to be careful with that since I think when
it gives you the rasterized version of the overlay it might be the
size of the image on the screen, not the true original matrix size of
the underlying image (I'd have to recheck this).

full thread here : http://www.mathworks.com.au/matlabcentral/newsreader/view_thread/261232

只想待在家 2024-08-12 05:31:03

我发现这个例子为您提供了一种将简单的几何对象放到图片上的简单方法。

读取输入图像。

I = imread('cameraman.tif');

将矩形尺寸定义为[xy 宽度高度]

rectangle = int32([10 10 30 30]);

绘制矩形并显示结果。

J = step(shapeInserter, I, rectangle);
imshow(J); 

请参阅此链接

顺便 ..
我没有明白你关于点不是离散的和图像是矩阵的观点。我是这样看的。都差不多。你可以尝试更深入地解释一下吗?

I found this example which give you a easy way to put simple geometrical object onto pictures.

Read the input image.

I = imread('cameraman.tif');

Define the rectangle dimensions as [x y width height].

rectangle = int32([10 10 30 30]);

Draw the rectangle and display the result.

J = step(shapeInserter, I, rectangle);
imshow(J); 

see this link

by the way..
I didn't get you point about points not being discrete and images being a matrix. The way I see it. It much the same. you could try to explain it more in depth ?

当梦初醒 2024-08-12 05:31:03

Computer Vision System Toolbox 中的 insertShape 函数正是您所需要的。它允许您在图像中绘制矩形、圆形和多边形。

还有 insertTextinsertMarkerinsertObjectAnnotation

The insertShape function in the Computer Vision System Toolbox is what you need. It lets you draw rectangles, circles, and polygons into the image.

There is also insertText, insertMarker, and insertObjectAnnotation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文