Image gradient in the point

北城以北 提交于 2021-01-27 07:38:43

问题


I'm working with the image segmentation. I need to compute image gradient in the point, so I was trying to understand by myself (because I know how to calculate gradient when having an ordinary equation) but I failed. I was googling... and googling but to find wright answer I couldn't.

Can anyone say or give some information how to compute image gradient in the point step by step?


回答1:


The gradient at each pixel of an image I(x, y) is simply the 2D vector (dI/dx,dI/dy)(x, y). Approximate dI/dx and dI/dy with centered finite difference:

dI/dx(x, y) = (I(x + 1, y) - I(x - 1, y)) / 2 = (I(x + 1, y) - I(x, y) + I(x, y) - I(x - 1, y)) / 2
dI/dy(x, y) = (I(x, y + 1) - I(x, y - 1)) / 2 = (I(x, y + 1) - I(x, y) + I(x, y) - I(x, y - 1)) / 2


来源:https://stackoverflow.com/questions/21067303/image-gradient-in-the-point

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