Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 获取中心像素';s梯度方向_Matlab_Image Processing - Fatal编程技术网

Matlab 获取中心像素';s梯度方向

Matlab 获取中心像素';s梯度方向,matlab,image-processing,Matlab,Image Processing,如何利用matlab获得中心像素梯度方向下的局部像素值 我已经找到了函数imgradient(),这很好,但是如何在这个角度下将角度转换为直线呢?所以你想知道如何定义一条直线,给定一个点(x0,y0)和一个角度θ?也许是这样的: % T determines the length of the line. I am using a step size % of 0.5 since it should get each pixel. You could always go finer % and

如何利用matlab获得中心像素梯度方向下的局部像素值


我已经找到了函数imgradient(),这很好,但是如何在这个角度下将角度转换为直线呢?

所以你想知道如何定义一条直线,给定一个点
(x0,y0)
和一个角度
θ
?也许是这样的:

% T determines the length of the line. I am using a step size
% of 0.5 since it should get each pixel. You could always go finer
% and let the call to unique get rid of the duplicates.
t = 0:0.5:T;
p = unique( round( [x0+t(:)*cos(theta), y0+t(:)*sin(theta) ] ), 'rows' );
上面的
p
将是一个像素坐标的Nx2数组,该像素坐标位于从
(x0,y0)
开始并延伸出角度
θ的直线下方(技术上在1/2 a像素范围内)