Note that there are some explanatory texts on larger screens.

plurals
  1. POc, opencv - accessing camera JPG image over ip
    primarykey
    data
    text
    <p>I have read many, many threads about streaming images over IP in <strong>OpenCV 2.3.1</strong>, but I still cannot get my program to work.</p> <p>I downloaded <strong>IP Webcam for Android</strong> from <a href="https://market.android.com/details?id=com.pas.webcam&amp;hl=en" rel="noreferrer">https://market.android.com/details?id=com.pas.webcam&amp;hl=en</a>, and recently learned OpenCV to retrieve images from my Android phone camera.</p> <p>Its built-in manual said that the image from the phone camera can be located at <a href="http://the.phone.ip.address:8080/shot.jpg" rel="noreferrer">http://the.phone.ip.address:8080/shot.jpg</a>. I have opened it from browser several times and it always looks fine. I also built OpenCV manually, with <strong>FFmpeg</strong> support.</p> <p>So far I've tried</p> <pre><code>CvCapture* webcam = cvCaptureFromFile("http://192.168.1.220:8080/shot.jpg"); </code></pre> <p>but it returns NULL and outputs</p> <pre><code>[image2 @ 0xd701e0]Could not find codec parameters (Video: mjpeg, yuv420p) </code></pre> <p>I also tried replacing http with rtsp, but it still doesn't work. I also tried to replace the url with some other image url (one direct link to random image from Google Images, and one from localhost) and it always kills with a segfault.</p> <p>Here's my full source</p> <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;math.h&gt; #include &lt;cv.h&gt; #include &lt;highgui.h&gt; int main(int argc, char* argv[]) { CvCapture* webcam = cvCaptureFromFile("http://192.168.1.220:8080/shot.jpg"); if(!webcam) { fprintf(stderr, "cannot open webcam\n"); return 1; } IplImage* img = cvQueryFrame(webcam); if(!img) { fprintf(stderr, "cannot get image\n"); return 1; } cvNamedWindow("test", CV_WINDOW_AUTOSIZE); cvShowImage("test", img); cvWaitKey(0); cvReleaseImage(&amp;img); /**/ cvReleaseCapture(&amp;webcam); /**/ cvDestroyWindow("test"); return 0; } </code></pre> <p>Can OpenCV really read images over IP, or am I missing something?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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