In this video we give you a homework assignment to create a dimmable RGB LED. You must set color and brightness using the IR remote. In Tutorial 68 we will take you through the build, and show you the solution. I hope you will really try your best to do it on your own before you check out my solution.
AI on the Jetson Nano Lesson 46: Synchronizing Multiple Cameras with OpenCV
In this lesson we learn how to use Python Classes, Methods and Threading to run two cameras in OpenCV without latency or synchronization problems. Below we include the code developed in the video above.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | from threading import Thread import cv2 import time import numpy as np class vStream: def __init__(self,src,width,height): self.width=width self.height=height self.capture=cv2.VideoCapture(src) self.thread=Thread(target=self.update,args=()) self.thread.daemon=True self.thread.start() def update(self): while True: _,self.frame=self.capture.read() self.frame2=cv2.resize(self.frame,(self.width,self.height)) def getFrame(self): return self.frame2 flip=2 dispW=640 dispH=480 camSet='nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1 ! nvvidconv flip-method='+str(flip)+' ! video/x-raw, width='+str(dispW)+', height='+str(dispH)+', format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink' cam1=vStream(1,dispW,dispH) cam2=vStream(camSet,dispW,dispH) font=cv2.FONT_HERSHEY_SIMPLEX startTime=time.time() dtav=0 while True: try: myFrame1=cam1.getFrame() myFrame2=cam2.getFrame() myFrame3=np.hstack((myFrame1,myFrame2)) dt=time.time()-startTime startTime=time.time() dtav=.9*dtav+.1*dt fps=1/dtav cv2.rectangle(myFrame3,(0,0),(140,40),(0,0,255),-1) cv2.putText(myFrame3,str(round(fps,1))+' fps',(0,25),font,.75,(0,255,255),2) cv2.imshow('ComboCam',myFrame3) cv2.moveWindow('ComboCam',0,0) except: print('frame not available') if cv2.waitKey(1)==ord('q'): cam1.capture.release() cam2.capture.release() cv2.destroyAllWindows() exit(1) break |
Robotics Training LESSON 1: An Introduction to Robotics for Absolute Beginners
It is time for you to begin to put all the things you have learned about the arduino together into a practical application. In this series of lessons we will show how to apply what you learned in our most excellent arduino lessons to use. We will be building and programming the Elegoo Smart Car. If you home gamers want to play along, you can grab your gear HERE.
Robotics Training LESSON 3: Mechanical Build of the Upper Deck of the Elegoo Smart Car
In this lesson we complete the mechanical build of the Elegoo Smart Car Version 3.0. We build the lower deck, and then complete the assembly with the upper deck. We confirm electrical functionality by showing the motors operating. If you want to play along at home, grab your gear HERE.
Robotics Training LESSON 2: Mechanical Build of the Lower Deck of the Elegoo Smart Car
In this video lesson we take you through assembly of the lower deck of the Elegoo Smart Car Version 3.0. We show the complete build of the lower deck. If you want to play along at home, you can grab your gear HERE.