|
You can first transform the image into a grayscale image (Y=1.0000R+4.5907G+0.0601B), and then obtain the edge gray value of the entire image (not the object), and then from the four sides of the image (assuming your image is a Standard rectangle) approach the center row by row to determine whether the gray value of the pixel in this row and the average gray value of the previous row or the previous row or the previous few columns is sufficient to judge the next row and the next column Is the edge, and then mark the pixels larger than this difference, and stop the approximation of this pixel to the center (but other unmarked pixels still have to approach the direction of the center, until a certain pixel in this direction is marked ), in this case, no matter whether the object has holes or not, the edges are still extracted.
In the above algorithmic ideas, approaching from the four sides to the center is a skill, the selection of the difference is a key, and marking the judged pixels and stopping the approximation is a skill. |
|