Matlab:如何在同一图像中显示多个输出? [英] Matlab: How can I display several outputs in the same image?

查看:730
本文介绍了Matlab:如何在同一图像中显示多个输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我的图像是 img = zeros(100,100,3),我的输出是几个椭圆,我使用创建的函数 [ret ] = draw_ellipse(x,y,a,b,angle,color,img),我可以使用 imshow(ret)显示一个椭圆。目前,我正试图在图像中显示ser椭圆。但我不知道如何编码。将'for loop'工作还是我需要持有它们?

Let's say my image is img=zeros(100,100,3), my outputs are several ellipse which i get using a created function [ret]=draw_ellipse(x,y,a,b,angle,color,img), I can display one ellipse using imshow(ret).For the moment, I'm trying to show serval ellipse in the image. But i don't know how to code it. will ‘for loop’ work or I need to hold them?

推荐答案

如果这与你在< a href =https://stackoverflow.com/questions/7721255/axis-coordinates-to-pixel-coordinates-matlab/7763771#7763771>上一个问题,那么你需要做的就是通过一次迭代的结果作为下一个的输入。

If this is related to what you were doing in your previous question, then what you need to do is to pass the result of one iteration as input to the next.

假设函数 [ret] = draw_ellipse(x,y,a,b,角度,颜色,img)你提到的是一个图像 img 并返回相同的图像,上面画有一个椭圆,你可以这样做:

So assuming that the function [ret]=draw_ellipse(x,y,a,b,angle,color,img) you mentioned takes as input an image img and returns the same image with an ellipse drawn on it, you could do this:

%# ellipses parameters
%#x = {..}; y = {..};
%#a = {..}; b = {..};
%#angle = {..}; color = {..};

img = zeros(200,100,'uint8');     %# image to start with
for i=1:10
    img = draw_ellipse(x{i},y{i}, a{i},b{i}, angle{i}, color{i}, img);
end
imshow(img)

这篇关于Matlab:如何在同一图像中显示多个输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆