简体   繁体   English

Matlab-使用矢量表示法绘制图像渐变

[英]Matlab - plot image gradients using vector representation

I have computed the gradients from every pixel location of a grayscale image, both on X and Y axis and this can result in a vector representation for each pixel location. 我已经在X和Y轴上从灰度图像的每个像素位置计算了梯度,这可以导致每个像素位置的矢量表示。 I want to obtain a plot figure similar to the one illustrated bellow: 我想获得一个类似于以下所示的绘图图:

在此处输入图片说明

My image has 1000 x 1002 dimensions and I have computed the gradients for each pixel on X and Y directions so I have 2 matrices, each one having 1000 x 1002 dimensions. 我的图像尺寸为1000 x 1002 ,我已经计算了XY方向上每个像素的梯度,所以我有2个矩阵,每个矩阵都具有1000 x 1002尺寸。 I am interested in obtaining a plot similar to the one illustrated in the image above, where I show basically the direction of each vector obtained from the computed gradients. 我有兴趣获得与上图所示的图相似的图,该图基本上显示了从计算出的梯度获得的每个矢量的方向。 I do not care about the magnitude of the vector, so basically each arrow can have the same length. 我不在乎矢量的大小,因此基本上每个箭头的长度都可以相同。

Do you know how can I obtain something similar to this? 您知道我如何获得类似的东西吗?

It works in my case: 在我的情况下有效:

[DX,DY] = imgradient(imageIn);    
%show gradient
figure;
[x,y]=meshgrid(1:1:500);
figure
quiver(x,y,DX,DY)
hold off

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM