So in this project I’ve learnt to grab a portion iof the camera display screen and display it separately.So you can pick out a portion of the camera display screen and play around with it! Here I’ve displayed that portion of the frame separately and also converted that part to Gray Scale.
Demo:
Things Required:
- Jetson Nano
- Keyboard
- Mouse
- HDMI Screen
- Raspberry Pi Camera
- External Power Supply
Reference Material:
- You can check out this video for the project: (LINK)
Code:
Note that code below is in python
View on/Download from Github: (LINK)
import cv2
dispW=640
dispH=480
flip=2
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'
cam=cv2.VideoCapture(camSet)
while True:
ret, frame= cam.read()
#roi referencing from frame
#roi=frame[50:250,200:400]
roi=frame[50:250, 200:400].copy()
roi_gray= cv2.cvtColor(roi,cv2.COLOR_BGR2GRAY)
cv2.imshow('ROI',roi)
cv2.imshow('ROIGray', roi_gray)
cv2.imshow('nanoCam', frame)
cv2.moveWindow('nanoCam',0,0)
if cv2.waitKey(1) == ord('q'):
break
cam.release()
cv2.destroyAllWindows()
Stay Tuned for upcoming posts on Jetson Nano and AI Projects! Want to be the first to know when a new and amazing post comes up?? Then feel free to subscribe!
Happy Learning!!
