Is there an algorithm that will perform well on filling holes on the sample image? Grammar does not work properly before the curve actually thickens before I finally manage to eliminate those defects. I want to avoid lines being thick, thanks for any help.
Yes, someone in the image There may also be letters or figures, such as holes.
Another, simple way, that probably OpenCV
this sequential pearl As the / c code uses instead of rotation.
Basically all black pixels for value will translate better into set 10
, and all white pixels in the value 0
, then the following 3x3 kernel Explain the image with:
1 1 1 1 10 1 1 1 1
Now, will give a black pixel 100 (10x10) in the middle of the kernel And any other black pixel 10 (10x1) in the neighborhood. So if we want a central black pixel number with only one single adjacent black pixel, then it will have a value of 110 (100 + 10). So let's all the pixels color, in which the value is 110, with red. This is the reason that this order gives:
convert EsmKh.png -colorspace Gray -Fill Gray (10 \) -opaque black -Fill Gray (0 \) -opaque white -morphology convolve '3x3: 1,1,1,1,1,1,1,1' -short red - gray gray (110 \) out.png
with the resulting image (You may need to zoom at intervals to see red):
If you want a list of red pixels, replace the output file name with which is: Now you can take action on the red digit list, and for each one, find the nearest other red dot and join them with a straight line - or something Doing curve fitting if you are really curious feeling Of course, to do this, something can be sophisticated, and you want to set the maximum length of the filling line to fill the gap. txt: and :
convert EsmKh.png -colorspace Gray -fill RGB (10,10,10 \) -opaque black -Fill RGB (0,0,0 \) -opaque white -morphology Convolve '3x3: 1,1,1,110,1 1,1, 1' txt: | grep "110,110,110"
86,55: (110,110,110) # 6E6E6E grey43 459,55: (110,110,110) # 6E6E6E grey43 83 , 56: (110,110,110) # 6E6E6E gray43 507.59: (110,110,110) # 6E6E6E gray43 45164: (110,110,110) # 6E6E6E gray43 82.65: (110,110,110) # 6E6E6E gray43 134,68: (110,110,110) # 6E6E6E gray43 519 , 75: (110,110,110) # 6E6E6E grey43 245,81: (110,110,110) # 6E6E6E grey43 246,83: (110,110,110) # 6E6E6E grey43 269,84: (110,110,110) # 6E6E6E 80,83 grey43 (110,110,110) # 6E6E6E grey43 288, 85: (110,110,110) # 6E6E6E Gray 435,87: (110,110,110) # 6E6A6E Gray 43 328,87: (110,110,110) # 6E6E6E Gray 43 4322104: (110,110,110) # 6E6A 6 e Gray 43 131 116 (110 110 110) # 6 e 6 e 6 e Gray 43 5,24,116: (110,110,110) # 6E6E6E Gray 431 117 (110 110 110) # 6 e-6 A6 e Gray 43 245 122 (110 110 110) # 6 e 6 E6E Gray 43 76,125: (110,110, 110) # 6 E 6 E 6 E Gray 43 456 128 (110 110 110) # 6 E-6 A6 E Gray 43 447 129 (110 110 110) # 6 E 6 E 6 EG Rey43 245,131: (110,110,110) # 6E6E6E Gray 43 80 146: (110,110,110) # 6E6A6E Gray 43 139, 151: (110,110,110) # 6E6A6E Gray 43 80156: (110,110,110) # 6E6E6E Gray 43354157: (110,110,110) # 6E 6 A6 e Grea 144,160: (110,110,110) # 6E6E6E Gray 43 246 183 (110 110 110) # 6 e-6 A6 e Gray 43 76 191 (110 110 110) # 6 e-6 A6 e Gray 43 82 197 (110 110 110) # 6 e 6 e 6 e Gray 43 126 200 (110 110 110) # 6 e-6 A6 e Gray 43 117,201: (110,110,110) # 6E6E6E Gray 43 245 204 (110 110 110) # 6 e 6 e 6 e Gray 43 24 206 (110 110 110) # 6 E6E 6E Gray 43972209: (110,110,110) # 6E6E6E Gray 43309, 210: (110,110,110) # 6E6E6EG 43
Comments
Post a Comment