print('python sensorview [-i <inTopic>] [-p <plotInterval>]' + rdf.manifoldArgs) print('\nDefaults:') print(' -i %s\n -p 1.0\n' % (inTopic)) print(rdf.manifoldArgsDefaults) sys.exit(2) for opt, arg in opts: if opt == '-i': inTopic = arg if opt == '-p': plotInterval = int(arg) # start ManifoldPython running ManifoldPython.start("avview", sys.argv, False) # this delay is necessary to allow Qt startup to complete time.sleep(1.0) # wake up the console print("sensorview starting...") sys.stdout.flush() topicMap[inTopic] = srecs.SensorRecords(inTopic, plotInterval) # start up the plotter sensorPlot = splot.sensorplot() # lastPlotTime is used to control plot updates
print(rdf.manifoldArgsDefaults) sys.exit(2) for opt, arg in opts: if opt == '-i': ttyInTopic = arg if opt == '-o': ttyOutTopic = arg if opt == 'p': ttyPort = arg if opt == 'r': ttyRate = int(arg) # start ManifoldPython running ManifoldPython.start("tty", sys.argv, False) # this delay is necessary to allow Qt startup to complete time.sleep(1.0) # wake up the console print("tty starting...") sys.stdout.flush() # Activate the service endpoint ttyOutPort = ManifoldPython.addE2EService(ttyOutTopic) if (ttyOutPort == -1): print("Failed to activate E2E service endpoint") ManifoldPython.stop() sys.exit()
for opt, arg in opts: if opt == '-h': cameraHeight = int(arg) if opt == '-n': cameraIndex = int(arg) if opt == '-r': cameraRate = int(arg) if opt == '-v': outTopic = arg if opt == '-w': cameraWidth = int(arg) # start ManifoldPython running ManifoldPython.start("uvccam", sys.argv, True) # this delay is necessary to allow Qt startup to complete time.sleep(1.0) # Activate the source stream sourcePort = ManifoldPython.addMulticastSource(outTopic) if (sourcePort == -1): print("Failed to activate stream service") ManifoldPython.stop() sys.exit() # Open the camera device if (not ManifoldPython.vidCapOpen(cameraIndex, cameraWidth, cameraHeight, cameraRate)): print("Failed to open vidcap")
except: print('python modet [-i <inTopic>] [-o <outTopic>]' + rdf.manifoldArgs) print('\nDefaults:') print(' -i %s\n -o modet' % inTopic) print(rdf.manifoldArgsDefaults) sys.exit(2) for opt, arg in opts: if opt == '-i': inTopic = arg if opt == '-o': outTopic = arg # start ManifoldPython running ManifoldPython.start("modet", sys.argv, False) # this delay is necessary to allow Qt startup to complete time.sleep(1.0) # wake up the console print("modet starting...") sys.stdout.flush() # Tuning factors. The default values seem to work well at 1280 x 720 frame size, 30fps. # This is how much to scale down the image before background subtraction. Bigger images need bigger factors scaleFactor = 6 # This controls the length of the history used by the background subtractor - adjust for frame rate bgHistory = 200
print('\nDefaults:') print(' -p audio/audio\n -n 1\n -r 16000') print(rdf.manifoldArgsDefaults) sys.exit(2) for opt, arg in opts: if opt == '-p': audioTopic = arg if opt == '-n': audioChannels = int(arg) if opt == '-r': audioRate = int(arg) # start ManifoldPython running ManifoldPython.start("audio", sys.argv, False) # this delay is necessary to allow Qt startup to complete time.sleep(1.0) # Activate the source stream sourcePort = ManifoldPython.addMulticastSource(audioTopic) if (sourcePort == -1): print("Failed to activate stream service") ManifoldPython.stop() sys.exit() # wake up the console print("audio starting...") sys.stdout.flush()
for opt, arg in opts: if opt == '-h': cameraHeight = int(arg) if opt == '-n': cameraIndex = int(arg) if opt == '-r': cameraRate = int(arg) if opt == '-v': outTopic = arg if opt == '-w': cameraWidth = int(arg) # start ManifoldPython running ManifoldPython.start("picam", sys.argv, False) # this delay is necessary to allow Qt startup to complete time.sleep(1.0) # Activate the source stream sourcePort = ManifoldPython.addMulticastSource(outTopic) if (sourcePort == -1): print("Failed to activate stream service") ManifoldPython.stop() sys.exit() # wake up the console print("picam starting...") sys.stdout.flush()
print (' -c ' + completionTopic) print (' -m ' + testText) print (' -t ' + textTopic) sys.exit(2) for opt, arg in opts: if opt == '-c': completionTopic = arg if opt == '-m': testText = arg elif opt == '-t': textTopic = arg # start ManifoldPython running ManifoldPython.start("ttstest", sys.argv, False) # this delay is necessary to allow Qt startup to complete time.sleep(1.0) # wake up the console print("ttstest starting...") sys.stdout.flush() # Activate the client endpoint clientPort = ManifoldPython.addE2EClient(textTopic) if (clientPort == -1): print("Failed to activate E2E client endpoint") ManifoldPython.stop() sys.exit()
print('python sensehat [-i <sampleInterval>] [-o <outTopic>]' + rdf.manifoldArgs) print('\nDefaults:') print(' -i 0.1\n -o sensor') print(rdf.manifoldArgsDefaults) sys.exit(2) for opt, arg in opts: if opt == '-i': sampleInterval = float(arg) if opt == '-o': outTopic = arg # start ManifoldPython running ManifoldPython.start("sensors", sys.argv, False) # this delay is necessary to allow Qt startup to complete time.sleep(1.0) # Activate the source stream sourcePort = ManifoldPython.addMulticastSource(outTopic) if (sourcePort == -1): print("Failed to activate stream service") ManifoldPython.stop() sys.exit() initSensors() # wake up the console print("sensors starting...")
def forwardThread(): global processingForward, forwardMessage, forwardImage, forwardTS, forwardThreadExit, inPort # start ManifoldPython running ManifoldPython.start("facerec", sys.argv, False) # this delay is necessary to allow Qt startup to complete time.sleep(1.0) # Activate the input stream inPort = ManifoldPython.addMulticastSink(inTopic) if (inPort == -1): print("Failed to activate input stream") ManifoldPython.stop() sys.exit() # Activate the output stream outPort = ManifoldPython.addMulticastSource(outTopic) if (outPort == -1): print("Failed to activate output stream") ManifoldPython.stop() sys.exit() while not forwardThreadExit: time.sleep(0.01) processReceivedMessage() if not processingForward: continue try: image = forwardImage inJpeg = np.frombuffer(image, dtype=np.uint8) cv2Image = cv2.imdecode(inJpeg, cv2.IMREAD_COLOR) except: print ("Forward jpeg error", sys.exc_info()[0],sys.exc_info()[1]) try: dataLock.acquire() for detectedData in globalDetectedData: name = detectedData['name'] namepos = detectedData['namepos'] cv2.putText(cv2Image, name, namepos, cv2.FONT_HERSHEY_SIMPLEX, fontScale=0.75, color=(152, 255, 204), thickness=2) landMarks = detectedData['landmarks'] for landMark in landMarks: cv2.circle(cv2Image, center=landMark, radius=3, color=(102, 204, 255), thickness=-1) except: pass dataLock.release() # generate the output jpeg retVal, outJpeg = cv2.imencode('.jpeg', cv2Image) forwardMessage[rtndefs.TOPIC] = outTopic if ManifoldPython.isServiceActive(outPort) and ManifoldPython.isClearToSend(outPort): ManifoldPython.sendMulticastData(outPort, json.dumps(forwardMessage), outJpeg, forwardTS) processingForward = False ManifoldPython.removeService(inPort) ManifoldPython.removeService(outPort) ManifoldPython.stop()
except: print ('python imageproc [-i <iniFile>] [-o <outTopic>]' + rdf.manifoldArgs) print ('\nDefaults:') print (' -i RTIMULib\n -o imageproc') print (rdf.manifoldArgsDefaults) sys.exit(2) for opt, arg in opts: if opt == '-i': iniFile = arg if opt == '-o': outTopic = arg # start ManifoldPython running ManifoldPython.start("imu", sys.argv, False) # this delay is necessary to allow Qt startup to complete time.sleep(1.0) # wake up the console print("imu starting...") sys.stdout.flush() # Activate the output stream outPort = ManifoldPython.addMulticastSource(outTopic) if (outPort == -1): print("Failed to activate output stream") ManifoldPython.stop() sys.exit()
except: print ('python imageproc [-i <inTopic>] [-o <outTopic>]' + rdf.manifoldArgs) print ('\nDefaults:') print (' -i %s\n -o imageproc' % inTopic) print (rdf.manifoldArgsDefaults) sys.exit(2) for opt, arg in opts: if opt == '-i': inTopic = arg if opt == '-o': outTopic = arg # start ManifoldPython running ManifoldPython.start("imageproc", sys.argv, False) # this delay is necessary to allow Qt startup to complete time.sleep(1.0) # wake up the console print("imageproc starting...") sys.stdout.flush() # Activate the input stream inPort = ManifoldPython.addMulticastSink(inTopic) if (inPort == -1): print("Failed to activate input stream") ManifoldPython.stop() sys.exit()