Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have tried many ways but some programs give me a gray color empty screen and another just exit the code detecting camera can not be accessed but couldn't find a solution even though program are successfully build in opencv.

I am using Microsoft Visual Studio 2010 with Opencv 2.4.3

These are the specification of my camera.

- H.264/MJPEG video compression
-G.722 audio compression
- Frame rate 30fps /NTSC, 25fps/PAL
- Resolution: 720P, D1, Half D1, CIF,
- 1/3” SONY CCD, CMOS
- Alarm I/O support motion detection, date, time, event trigger
- Auto Day/Night
- Two-way audio, broadcast system
- RTSP, VLC(PS/TS) stream media protocol
- Bit rate variable 32Kbps-4000Kbps
- Multi-level user accessing with password protection
- Free management software support 1-100 channels
Posted
Updated 2-Feb-14 20:49pm
v2
Comments
KarstenK 3-Feb-14 3:32am    
camera driver installed, so that other software works?
Use proper inizialisation code with codec-name, format and resolution.

i got no clue => RFTM
Legor 5-Feb-14 4:13am    
Did you check first that the camera is working without openCV? For example try to open the camera stream with VLC or use any browser to open the URL of the MJPEG snapshot of the camera.
DaksithaW 5-Feb-14 8:02am    
Yes it is perfectly working with internet browser. but I am doing a image processing project using the input take using opencv. I want to open it directly using opencv 2.4.3 library.

If the camera is installed correctly you can try this solution which i found here:
http://answers.opencv.org/question/133/how-do-i-access-an-ip-camera/[^]


C++
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <iostream>

int main(int, char**) 
{    
   cv::VideoCapture vcap;    
   cv::Mat image;    // This works on a D-Link CDS-932L    
   const std::string videoStreamAddress = "http://<username:password xmlns:username="#unknown">@<ip_address>/video.cgi?.mjpg";    

//open the video stream and make sure it's opened    
if(!vcap.open(videoStreamAddress)) 
{        
   std::cout << "Error opening video stream or file" << std::endl;        
   return -1;    
}    

   for(;;) 
   {        
      if(!vcap.read(image)) 
      {            
         std::cout << "No frame" << std::endl;            
         cv::waitKey();        
      }        

      cv::imshow("Output Window", image);        
      if(cv::waitKey(1) >= 0) 
         break;    
   }   

}
 
Share this answer
 
v2
CSS
Thank you so much for your reply sir, I am doing a Image processing project of human detection using my ip camera so to do that need to access Ip camera directly using opencv. I have used several C++ code projects to do that but always have a problem with access it using the IP adress, as an example = 1."http://888888:888888@192.168.1.19:8081/cgi/mjpg/mjpg.cgi?.mjpg";
2.rtsp://cam_address:554/live.sdp
3.http://888888:888888@192.168.1.19:3001/video.cgi?resolution=640x360&req_fps=50&.mjpg

I am missing something when im using it with my camera.
 
Share this answer
 
Comments
Legor 5-Feb-14 9:40am    
Please do not add comments as solutions. If you want to comment on an answer use the Button "Have a Question or Comment". Did you try the code i posted in Solution 1? What isn't working exactly? Did you have a look at the read images ? Could the VideoCapture be opened etc?
DaksithaW 6-Feb-14 12:05pm    
Oh I am sorry about that cos I am new to the community. Yes i have tried it but it does not work. when I debug it does not access the camera it gives a null output. could you please explain this IP adress format then i can figure out what should i include in it. thank you.
Legor 7-Feb-14 2:53am    
Did you try this URL you posted with the code above ? "http://888888:888888@192.168.1.19:8081/cgi/mjpg/mjpg.cgi?.mjpg"

You also have to make sure that your openCV version was built with ffmpeg support.
DaksithaW 8-Feb-14 8:44am    
yes i did. do i need to download ffmpeg to do this. I am using VS 2010 with opencv 2.4.3.
Further more:
when i use the internet explore to do the real time streaming it require a username and a password. IP address http://192.168.1.19 they ask for the username and the password which is 888888 for both. then it automatically start to stream(had to installed plugins for that) . this was build for the camera.
real time streaming IP = http://192.168.1.19/en_content/advc.asp
I use iSpy to detect my IP address but still could not find a way. any tip. thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900