mirror of
https://github.com/qurator-spk/sbb_binarization.git
synced 2025-07-02 07:29:54 +02:00
standalone cv2.imwrite: use uint8 / bilevel
This commit is contained in:
parent
7d8f293f2f
commit
0bcb171240
1 changed files with 4 additions and 2 deletions
|
@ -255,9 +255,11 @@ class SbbBinarizer:
|
||||||
img_fin = (res[:, :] == 0) * 255
|
img_fin = (res[:, :] == 0) * 255
|
||||||
img_last = img_last + img_fin
|
img_last = img_last + img_fin
|
||||||
|
|
||||||
kernel = np.ones((5, 5), np.uint8)
|
|
||||||
img_last[:, :][img_last[:, :] > 0] = 255
|
img_last[:, :][img_last[:, :] > 0] = 255
|
||||||
img_last = (img_last[:, :] == 0) * 255
|
img_last = (img_last[:, :] == 0) * 255
|
||||||
if save:
|
if save:
|
||||||
cv2.imwrite(save, img_last)
|
cv2.imwrite(save, img_last.astype(np.uint8), [
|
||||||
|
cv2.IMWRITE_PNG_BILEVEL, 1,
|
||||||
|
cv2.IMWRITE_JPEG_QUALITY, 100
|
||||||
|
])
|
||||||
return img_last
|
return img_last
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue