How to Run minoru 3D webcam on Raspberry PI Board
Hello Friends, the purpouse of this simple post is show how to use a minoru 3d webcam on raspberry pi board. This tutorial assume that you have a opencv installed on your board.( Youtube Demonstration in this Link.
The script below are a example of usage:
import cv2 import numpy as np c = cv2.VideoCapture(0) c.set(3,1280) c.set(4,480) while(1): _,visao = c.read() esquerdo = visao[0:480, 0:640] direito = visao[0:480, 640:1280] cv2.imshow('esquerdo',esquerdo) cv2.imshow('direito',direito) if cv2.waitKey(5)==27: break cv2.destroyAllWindows()
import cv2 import numpy as np
This first two lines are the libraries of functions that was used.
c = cv2.VideoCapture(0) c.set(3,1280) c.set(4,480)
Now we set the device that we going to use for capture image in the first line, note that the number in the argument field represent the device os /dev directory, for consult this run the folow command:
and the response are one thing like this:
The number showed, in this case ‘0’, represent the number of device that can be used in this script. Returning to explanation, the others two lines are setting the widht and height parameters of the image captured, in particulary the minoru webcam only shows the two images with this resolution.
_,visao = c.read()
This command read the image, and attribute the result on “visao” var.
esquerdo = visao[0:480, 0:640] direito = visao[0:480, 640:1280]
Now we split the image, generating two images, left (first line) and right(second line).
Finally the images are shown.
The next post we apply the concept of disparity to study the distance of objects.