I was able to open ids camera the code in visual studio 2012 with opencv 2.4.13,but now it can't open in visual studio 2015 opencv 3.2.0,c++.pls help me with a solution

asked 2017-03-15 11:45:37 -0500

Ashiq KS gravatar image

updated 2017-03-15 11:53:03 -0500

LBerger gravatar image
#include<opencv2/opencv.hpp>
#include<iostream>


using namespace cv;

using namespace std;

int main()
    {
    Mat CameraFrame;
    Mat Grey;

    VideoCapture cap;
    char keypressed;

    //Opens the first imaging device.
    cap.open(0);

    //Check whether user selected camera is opened successfully.
    if( !cap.isOpened() )
    {
    cout << "***Could not initialize capturing...***\n";
   return -1;
   }

   //Create a windows to display camera preview.
   namedWindow("Camera Preview", CV_WINDOW_AUTOSIZE);

   //Loop infinitely to fetch frame from camera and display it.
   for(;;)
   {
   //Fetch frame from camera.
   cap >> CameraFrame;

   //Check whether received frame has valid pointer.
   if( CameraFrame.empty() )
   break;

   //Display the received frame
   imshow("Camera Preview", CameraFrame);

   //Wait for Escape keyevent to exit from loop
   keypressed = (char)waitKey(10);
   if( keypressed == 27 )
   break;
   }

   //Release the camera interface.
   cap.release();
edit retag flag offensive close merge delete

Comments

please use icon 101010 to insert your code

LBerger gravatar imageLBerger ( 2017-03-15 11:53:39 -0500 )edit

Hello I have the same issue Almost same code above

I can run code with opencv 2.4

in opencv 3.2 only first frame displayed. remain frames not streamed

Regards

Wael gravatar imageWael ( 2017-03-17 15:13:26 -0500 )edit

please don't post comment as answer

LBerger gravatar imageLBerger ( 2017-03-17 15:19:05 -0500 )edit