def __init__(self, quiet=None, settings=None, started=1): # get file to pass self.argumentGeneration(quiet, settings) #detect the arduino's port arduino = detect.Detect() self.port = arduino.getPort() self.started = 0 # start grbl settings self.startUp() # stream code self.main()
dll.CameraSetResolution(0, 0, 0, 0) buflen = c_int() width = c_int() height = c_int() awb = c_bool(True) dll.CameraGetImageSize(0, byref(width), byref(height)) dll.CameraGetImageBufferSize(0, byref(buflen), 0x4) inbuf = create_string_buffer(buflen.value) # dll.CameraSetAWB(0,awb) # param left_x=0 right_x=260 up_y=144 bottom_y=333 detection = dc.Detect() while True: # get image into buffer # dll.CameraSetAWB(0, c_bool(True)) dll.CameraQueryImage(0, inbuf, byref(buflen), 0x104) arr = np.frombuffer(inbuf, np.uint8) print("array shape = ",arr.shape) img = np.reshape(arr, (height.value, width.value, 3)) reshapeWidth = int(width.value / 4) reshapeHeight = int(height.value / 4) # using opencv to display the buffer image resize_img = cv2.resize(img, (reshapeWidth, reshapeHeight), interpolation=cv2.INTER_AREA) # resize_img[:, :, ] = resize_img[:, :, [2,1,0]]
import detect detect.Detect().getNumber()