Google+ How to Run minoru 3D webcam on Raspberry PI Board

Popular Post

Posted by : JeA Eletrônica quarta-feira, julho 31, 2013



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.
.




Minoru Web CAM

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()

Explanation:


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:


ls /dev/video*

and the response are one thing like this:


/dev/video0

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).


cv2.imshow('esquerdo',esquerdo)
cv2.imshow('direito',direito)

Finally the images are shown.

Captura_de_tela-MOV086.mp4-3

The next post we apply the concept of disparity to study the distance of objects.

Thanks,


[EOT]

2 Responses so far.

Leave a Reply

Subscribe to Posts | Subscribe to Comments

- Copyright © J&A Eletrônica - Date A Live - Powered by Blogger - Designed by Johanes Djogan -