问题描述
我实际上是按照论文的说明进行
I am actually following the instructions of a paper:
输入应该是二进制的边缘"图像.输出应为新图像,并按本文中的说明进行修改.我对指令的理解是,要获取边缘图像的渐变图像并对其进行修改,并使用修改后的渐变来创建新图像.因此,在MATLAB/OpenCV中是否可以用新的渐变创建相同的图像?
The input is supposed to be a binary "edge" image. The output should be a new image, modified by the instructions in the paper. My understanding of the instructions is, that one takes the gradient image of the edge image and modifies it and creates a new image with the modified gradient. Therefore is there a possibility in MATLAB/OpenCV of creating the same image with a new gradient?
参考论文:李鸿宇和陈磊.使用基于轮廓的分类器消除了目标检测中的误报."ICIP.2010.
Reference to the paper:Li, Hongyu, and Lei Chen. "Removal of false positive in object detection with contour-based classifiers." ICIP. 2010.
推荐答案
我想显示的公式将弧度的梯度方向转换为像素强度,范围从0到255(许多图像格式的标准).在matlab中,如果您具有图像处理工具箱",则可以按以下方式获取图像渐变方向:
The formula displayed, I suppose, converts the gradient orientation form radians to pixel intensity ranging from 0 to 255 (standard for many images format). In matlab, if you have the Image Processing Toolbox, you can get the image gradient direction as follows:
[Gmag, Gdir]=imgradient(YourImage);
现在,如手册中所述, Gdir
包含角度(以度为单位)在[-180 180]范围内.如果您希望它们在[0 255]范围内以遵循本文的内容,请按照公式中的说明进行操作:
Now, as said in the manual, Gdir
contains angles in degrees within the range [-180 180]. If you wish to have them in the [0 255] range to follow what is in this paper, do as the formula says:
GdirI=(Gdir+180)*(255/360);
您还可以使用 imagesc(Gdir)
以原始格式显示角度图.
You can also display an angle plot in its original format using imagesc(Gdir)
.
这篇关于图像梯度角计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!