Morphological closure improvement

I try to make the image evenly bright using the morphological closure operation, as a prelude to the adaptive threshold. My method is to divide each pixel in the image by the value of that pixel after the close operation, and then normalize:

Imgproc.GaussianBlur(sudokuImage, sudokuImage, new Size(5,5), 0); Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(11,11)); Imgproc.morphologyEx(image, closedImage, Imgproc.MORPH_CLOSE, kernel); Core.divide(image, closedImage, image); Core.normalize(image, image, 0, 255, Core.NORM_MINMAX); 

Here is the result:

  • Top Left - Original Image
  • Upper Right - After Gaussian Blur
  • Bottom left is the result of the close operation
  • Bottom right - the end result

enter image description here

I want the last image to be less blurry, more like the image below (which was obtained using the same method in this post ). How can i do this?

enter image description here

+4
source share
1 answer

Perhaps the problem lies in the division step, which you seem to execute in ints, while the message that you link to execute on floats.

+3
source

Source: https://habr.com/ru/post/1446839/


All Articles