How to access android camera using opencv 2.4.10 c++?

asked 2018-06-17 06:44:08 -0500

zheung gravatar image
int main{
VideoCapture capture(0);
namedWindows("Video");
string filename;

while(1){

    Mat frame;

    capture>>frame;
    imshow("video", frame);

    if(waitKey(30)=='c') break;

    //image capture
    if(waitKey(30)=='q'){
        imshow("preview", frame);
        cout<<"Please enter file name => ";
        cin>>filename;
        imwrite(filename, frame);
        cout<<"SUCCESSFULLY STORED"<<endl;
    }
}
return 0;
}

This is a code that access the PC webcam, but I don't know how to access the camera of my android phone which is plugged into my laptop. How to implement this in opencv 2.4.10 c++?

edit retag flag offensive close merge delete

Comments

samples are here https://github.com/opencv/opencv/tree.... Please update to opencv 3.4.1 (read https://github.com/opencv/opencv/wiki...)

LBerger gravatar imageLBerger ( 2018-06-17 06:52:25 -0500 )edit

no,you cannot access your phone's camera that easy from your laptop. you're far to naive here.

  • you'd have to install some app on your phone, that installs an http / rtsp ipcam server
  • you'd have to install some "naked driver" on your pc, that allows you to "tether" your phone (send/recieve network packets via usb)
  • then you could use VideoCapture with an ip cam url on your pc.
berak gravatar imageberak ( 2018-06-17 20:11:31 -0500 )edit