1 Acknowledgements
Thank you Zhixing for your code and guidance!
2 The basic process of rectangular frame detection
1. According to the characteristics of the image, perform grayscale according to the channel value. Here we choose the two channels [B, R];
(We do not perform Gaussian blur here, because the noise of the image is relatively small; the main reason is: the edge of the target rectangle is relatively thin)
2. Use the open operation to obtain the gradient map;
2.1 Use the open operation to obtain the gradient map
Through experiments, we can know the degree of "blooming" of the image determined by the kernel_size of the operation,
(The larger the kernel_size, the larger the range of the ink halo effect, and it seems "seems to be more blurred")
This is the effect of setting the kernel_size to 30. You can see that the blooming is already very serious, but the edge information will still be retained;
It can be seen that the areas in the middle are all connected into one piece, so that a lot of fine-grained edge texture information will be lost, so that the fine-grained texture information cannot be highlighted;
Since the edges of the target rectangular box are relatively thin here, we set kernel_size to 2 ;