image gradient angle computation

孤街浪徒 提交于 2021-01-27 12:40:16

问题


I am actually following the instructions of a paper:

enter image description here

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?

Reference to the paper: Li, Hongyu, and Lei Chen. "Removal of false positive in object detection with contour-based classifiers." ICIP. 2010.


回答1:


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);

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);

You can also display an angle plot in its original format using imagesc(Gdir).



来源:https://stackoverflow.com/questions/22106748/image-gradient-angle-computation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!