Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You may interest in this link:</p> <p><a href="http://opencv.willowgarage.com/wiki/faq#How_to_use_2_cameras_.28multiple_cameras.29_with_cvCam_library" rel="nofollow">http://opencv.willowgarage.com/wiki/faq#How_to_use_2_cameras_.28multiple_cameras.29_with_cvCam_library</a></p> <p>Which contains:</p> <p>First, init the cvcam library and get the number of cams by:</p> <pre><code>int ncams = cvcamGetCamerasCount( ); //returns the number of available cameras in the system </code></pre> <p>Show dialog to choose which cameras in use</p> <pre><code>int* out; int nselected = cvcamSelectCamera(&amp;out); </code></pre> <p>Get the selected cams and enable them.</p> <pre><code>int cam1 = out[0]; int cam2 = out[1]; cvcamSetProperty(cam1, CVCAM_PROP_ENABLE, CVCAMTRUE); cvcamSetProperty(cam1, CVCAM_PROP_RENDER, CVCAMTRUE); //We'll render stream from this source cvNamedWindow("Cam1", 1); cvcamWindow MyWin1 = (cvcamWindow)cvGetWindowHandle("Cam1"); cvcamSetProperty(cam1, CVCAM_PROP_WINDOW, &amp;MyWin1); // Selects a window for video rendering //Same code for camera 2 cvcamSetProperty(cam2, CVCAM_PROP_ENABLE, CVCAMTRUE); cvcamSetProperty(cam2, CVCAM_PROP_RENDER, CVCAMTRUE); cvNamedWindow("Cam2", 1); cvcamWindow MyWin2 = (cvcamWindow)cvGetWindowHandle("Cam2"); cvcamSetProperty(cam2, CVCAM_PROP_WINDOW, &amp;MyWin1); //If you want to open the property dialog for setting the video format parameters, uncomment this line //cvcamGetProperty(cam1, CVCAM_VIDEOFORMAT, NULL); //cvcamGetProperty(cam2, CVCAM_VIDEOFORMAT, NULL); </code></pre> <p>Enable the stereo mode (2 cameras working at the same time)</p> <pre><code>cvcamSetProperty(cam1, CVCAM_STEREO_CALLBACK , stereocallback); //stereocallback is the function running to process every frames cvcamInit(); cvcamStart(); //Your app is working while (1) { int key = cvWaitKey(5); if (key == 27) break; } cvcamStop( ); cvcamExit( ); </code></pre> <p>Define the stereocallback function outside of the function above.</p> <pre><code>void stereocallback(IplImage* image1, IplImage* image2) { //Process 2 images here } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload