def __init__(self,year,log_saved_name,threadnum,batchsize,lastbatch=0): self.year=str(year) self.log_saved_name=log_saved_name self.threadnum=threadnum self.pool = ThreadPoolExecutor(self.threadnum) self.batchsize=batchsize self.finished=0 self.lastbatch=lastbatch makelog(self.log_saved_name)
#!/usr/bin/python import cv2 import numpy as np import time import sys from coloranalysis import find_dominant_color from structure import lbp_histogram from stone import Stone from log import makelog log = makelog(__name__) blank = cv2.imread('blank.png') def analyze_contour_cuts(contour, step=7): """ Parameters ---------- contour: array_like The contour to be analyzed Returns ------- None if the contour is invalid (i.e. too little points to analyze) """ c_len = len(contour) concave_points = []
#!/usr/bin/python import pickle as serialization # import serpent as serialization from random import uniform, random import cv2 import numpy as np import time import shutil from utils import distance from art import art_step from log import makelog log = makelog(__name__) class Stone(object): def __init__(self, center, size, angle, color, structure, flag=False): self.center = center if size[1] > size[0]: angle += 90 self.size = size[1], size[0] else: self.size = size self.angle = angle % 180 self.color = color self.structure = structure self.bogus = False self.flag = flag
import time import math import subprocess import threading import Pyro4 import cv2 from art import art_step from extract import process_image from utils import random_on_circle from stone import StoneMap, Stone from log import makelog log = makelog('brain') # CONTROL_HOSTNAME = 'localhost' CONTROL_HOSTNAME = '192.168.0.29' class Machine(object): """ High-level operations on CNC """ def __init__(self, hostname): self.uri = 'PYRO:control@{}:5001'.format(hostname) self.control = Pyro4.Proxy(self.uri) self.cam = Camera(self) self.x, self.y, self.z, self.e = 0.0, 0.0, 0.0, 0.0 self.last_pickup_height = None try: self.control.reset()
import time import math import subprocess import threading import Pyro4 import cv2 from art import art_step from extract import process_image from utils import random_on_circle from stone import StoneMap, Stone from log import makelog log = makelog('brain') # CONTROL_HOSTNAME = 'localhost' CONTROL_HOSTNAME = '192.168.0.29' class Machine(object): """ High-level operations on CNC """ def __init__(self, hostname): self.uri = 'PYRO:control@{}:5001'.format(hostname) self.control = Pyro4.Proxy(self.uri) self.cam = Camera(self) self.x, self.y, self.z, self.e = 0.0, 0.0, 0.0, 0.0 self.last_pickup_height = None try: