可视化matlab中的光流 [英] visualizing Optical flow in matlab

查看:944
本文介绍了可视化matlab中的光流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的图像尺寸为240 * 320,我的光学流量结果是垂直和水平值。我需要通过原始图像上的箭头来显示光流。我知道我必须使用箭袋功能。类似于:

I have an image with size 240*320 and I have the optical flow result with vertical and horizontal values. I need to visualize Optical flow by arrows on original image. I know that I have to use quiver function. Something like:

imshow(image)
hold on
quiver(vx,vy)
hold off

但我得到的是蓝色方块而不是箭头。

But what I get is a blue square instead of quivers.

推荐答案

一个完全蓝色的方块可能是因为太多的箭头靠近在一起绘制的。

An entirely blue square is probably caused by way too many arrows plotted close together.

例如,以下代码将生成一组易于查看(如果不是很有意义)的箭头:

For example, the following code will produce an easy-to-see (if not very meaningful) set of arrow:

figure
data = imread('peppers.png');
imshow(data)
s = size(data);
hold on
[x,y] = meshgrid(1:50:s(2),1:50:s(1));
px = cos(x);
py = sin(y);
quiver(x,y,px,py)

这将产生一个完全蓝色的情节:

And this will produce an entirely blue plot:

figure
data = imread('peppers.png');
imshow(data)
s = size(data);
hold on
[x,y] = meshgrid(1:1:s(2),1:1:s(1)); % arrow spacing is too close! 
px = cos(x);
py = sin(y);
quiver(x,y,px,py) 

这篇关于可视化matlab中的光流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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