def record_inputs(self, s_inputs): # Frame is just a numpy array frame = self.get_frame() # Serial inputs is a dict with key 'servo', and 'motor' # If its not in manual mode then proceed # print("yeah") # print("helllo {}".format(s_inputs)) if s_inputs: servo = s_inputs['servo'] motor = s_inputs['motor'] # Append to memory # tolist so it actually appends the entire thing dat = serialize_image(frame) # print(len(dat)) if (len(dat) == self.sz): self.frame_results.append(dat) # print(serialize_image(frame)) self.servo_results.append(servo) self.motorspeed_results.append(motor) ret_frame = np.reshape(frame, (self.width, self.height, self.depth)) return ret_frame
def record_inputs(self, s_inputs, frame, dataFormat): # Frame is just a numpy array if (not self.check_lock()): # frame = self.get_frame() self.lock() # Serial inputs is a dict with key 'servo', and 'motor' # If its not in manual mode then proceed # print("yeah") # print("helllo {}".format(s_inputs)) if s_inputs: servo = s_inputs['servo'] motor = s_inputs['motor'] # Append to memory # tolist so it actually appends the entire thing if (dataFormat == "csv"): frame = self.normalize_frame(frame) dat = serialize_image(frame) print(frame.shape, len(dat)) self.frame_results.append(dat) elif (dataFormat == "img"): filename = self.imagefolder + "/" + str( self.imagecount) + ".jpg" print(filename) cv2.imwrite(filename, frame) self.frame_results.append(filename) self.imagecount = self.imagecount + 1 self.servo_results.append(servo) self.motorspeed_results.append(motor) self.append_inputs() self.unlock()
def record_inputs(self, s_inputs, frame): # Frame is just a numpy array if (not self.check_lock()): # frame = self.get_frame() self.lock() # Serial inputs is a dict with key 'servo', and 'motor' # If its not in manual mode then proceed # print("yeah") # print("helllo {}".format(s_inputs)) if s_inputs: servo = s_inputs['servo'] motor = s_inputs['motor'] # Append to memory # tolist so it actually appends the entire thing frame = self.normalize_frame(frame) dat = serialize_image(frame) print(frame.shape, len(dat)) # if (len(dat)==self.sz): self.frame_results.append(dat) # print(serialize_image(frame)) self.servo_results.append(servo) self.motorspeed_results.append(motor) self.append_inputs() self.unlock()
def record_inputs(self, s_inputs): # Frame is just a numpy array frame = self.get_frame() # Serial inputs is a dict with key 'servo', and 'motor' # If its not in manual mode then proceed # print("yeah") # print("helllo {}".format(s_inputs)) if s_inputs: servo = s_inputs['servo'] motor = s_inputs['motor'] # Append to memory # tolist so it actually appends the entire thing self.frame_results.append(serialize_image(frame)) print(serialize_image(frame)) self.servo_results.append(servo) self.motorspeed_results.append(motor)