So here I’ve used bitwise and/or operators to start off with the concept of masking live videos
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
import numpy as np
dispW= 640
dispH=480
flip=2
img1= np.zeros((480,640,1), np.uint8)
img1[0:480, 0:320]=[255]
img2=np.zeros((480,640,1), np.uint8)
img2[190:290, 270:370]= [255]
bitAnd= cv2.bitwise_and(img1,img2)
bitOr= cv2.bitwise_or(img1,img2)
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()
cv2.imshow('img1',img1)
cv2.imshow('img2',img2)
cv2.imshow('bitAnd', bitAnd)
cv2.imshow('bitOr', bitOr)
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!!
