Distance to region
I have a binary image as input. The binary image contains several disjoint regions in the foreground.
For each pixel not in a region, I want to know the distance to the boundary of the closest region. Is this a standard image processing algorithm? If so, what is it called? It looks to be a different problem than the distance transform algorithm.
A bruteforce solution I came up with would be to use Sobel to edge detect the region boundaries. Then for each pixel not in a region, compute the distance to all the boundary pixels and take the smallest one.
I'll be implementing this in CUDA, so I'm thinking putting the boundary pixels in a constant buffer for faster memory reads when doing the distance calculation pass.
Any suggestions for a better approach?
I think you are just missing the setup in order to apply the distance transform. I only just learned what the distance transform is recently, so I apologize for my probable ignorance. BUT:
Create an image (same dimensions) where your classified blobs are included as 0 (filled) and everything else is 1. Perform a distance transform algorithm on that image. Then, for each unclassified pixel in your original image, look up its corresponding value on the distance transformed image based on coordinates. That value (as i understand it) will be the distance to the nearest classified object.
链接地址: http://www.djcxy.com/p/25400.html上一篇: 许多GPU上设置交叉点
下一篇: 距离地区