Skip to content
Snippets Groups Projects
Commit 863ec720 authored by Quentin Bolsee's avatar Quentin Bolsee
Browse files

code

parent a7f5b1bc
No related branches found
No related tags found
No related merge requests found
import cv2 import cv2
import numpy as np import numpy as np
import matplotlib.pyplot as plt
import trace_skeleton import trace_skeleton
import skimage.morphology
import random import random
...@@ -21,26 +21,13 @@ def bf(img): ...@@ -21,26 +21,13 @@ def bf(img):
return edges return edges
# def stroke(img):
# img_float = img.astype(np.float32) / 255.0
# img_binary = img_float < 0.5
# out_thin = morphology.thin(img_binary)
# out_skeletonize = morphology.skeletonize(img_binary)
# plt.figure()
# plt.imshow(out_skeletonize)
# plt.show()
#
# contours = measure.find_contours(out_thin, 0.7)
# return contours
def stroke(img): def stroke(img):
img_copy = np.ones_like(img)*255 img_copy = np.ones_like(img)*255
img2 = bf(img) img2 = bf(img)
img_float = img2.astype(np.float32) / 255.0 img_float = img2.astype(np.float32) / 255.0
img_binary = img_float > 0.5 img_binary = img_float > 0.5
im = trace_skeleton.thinning(img_binary) im = skimage.morphology.skeletonize(img_binary).astype(np.uint8)
rects = [] rects = []
polys = trace_skeleton.traceSkeleton(im, 0, 0, im.shape[1], im.shape[0], 10, 999, rects) polys = trace_skeleton.traceSkeleton(im, 0, 0, im.shape[1], im.shape[0], 10, 999, rects)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment