How to detect an image border programmatically?

前端 未结 5 1436
春和景丽
春和景丽 2021-02-11 07:47

I\'m searching for a program which detects the border of a image, for example I have a square and the program detects the X/Y-Coords

Example:

alt text http://img

5条回答
  •  迷失自我
    2021-02-11 08:15

    It depends what you want to do with the border, if you are looking at getting just the values of the edges of the region, use an algorithm called the Connected Components Region. You must know the value of the region prior to using the algorithm. This will navigate around the border and collect the outside region. If you are trying to detect just the outside lines get the gradient of the image and it will reveal where the lines are. To do this convolve the image with an edge detection filter such as Prewitt, Sobel, etc.

提交回复
热议问题