def __init__(self, folder_out=None): self.folder_out = folder_out if folder_out is not None: self.folder_cache = self.folder_out + 'cache/' else: self.folder_cache = None self.name = "Ellipse processor" self.Ske = tools_Skeletone.Skelenonizer(folder_out) return
def __init__(self, folder_out): self.name = "detector_Zebra" self.folder_out = folder_out self.th = 200 self.W_min = 3 self.W_max = 27 self.L = 10 self.pad = 2 self.zebra_rotations = 3 self.gray_prev = None self.Skelenonizer = tools_Skeletone.Skelenonizer() return
#https://github.com/WolfgangFahl/play-chess-with-a-webcam/blob/master/examples/opencv/warp.py import cv2 import numpy import tools_Hough import tools_Skeletone import tools_render_CV # --------------------------------------------------------------------------------------------------------------------- folder_out = './images/output/' Ske = tools_Skeletone.Skelenonizer(folder_out) Hough = tools_Hough.Hough() # --------------------------------------------------------------------------------------------------------------------- def example_01(): image = cv2.imread('./images/ex_lines/chessboard10.jpg') #p_src = numpy.array([(432, 103), (1380, 94), (1659, 1029), (138, 1052)], dtype=numpy.float32) p_src = numpy.array([(1659, 1029), (432, 103), (1380, 94), (138, 1052)], dtype=numpy.float32) image_wrapped = tools_render_CV.four_point_transform(image, p_src) cv2.imwrite(folder_out + 'wrapped.png', image_wrapped) return # --------------------------------------------------------------------------------------------------------------------- def example_02(): image = cv2.imread('./images/ex_lines/frame000000.jpg') image_wrapped = tools_render_CV.inverce_perspective_mapping( image, (628, 88), (0, 275, 1280, 275)) cv2.imwrite(folder_out + 'wrapped.png', image_wrapped) return
import cv2 import math import numpy from scipy.special import ellipeinc from scipy import optimize # ---------------------------------------------------------------------------------------------------------------------- import tools_IO import tools_image import tools_Fornaciari import tools_Skeletone import tools_render_CV # ---------------------------------------------------------------------------------------------------------------- folder_out = './images/output/' filename_in = './images/ex_ellipses/original.png' # ---------------------------------------------------------------------------------------------------------------- Ske = tools_Skeletone.Skelenonizer() F = tools_Fornaciari.Fornaciari(folder_out) # ---------------------------------------------------------------------------------------------------------------- def match_segment_ellipse_slow(points, ellipse, tol=10): for point in points: dst = tools_render_CV.distance_point_ellipse(point, ellipse) if numpy.isnan(dst) or dst > tol: return False return True # ---------------------------------------------------------------------------------------------------------------- def generate_ellipse_points(