I have an ip camera. It allows me to have two different encoding type, h264 and mjpeg and its best resolution is 1920x1080.
I use iSpy software to find URL address of my camera. It works and take photo, but its resulotion is 640*360.
Here is my code:
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/opencv.hpp"
int main()
{
cv::VideoCapture vcap;
const std::string videoStreamAddress = "rtsp://admin:[email protected]/snl/live/1/2/stream1.cgi";
if (!vcap.open(videoStreamAddress))
{
printf("camera is null\n");
return -1;
}
else
{
vcap.set(CV_CAP_PROP_FRAME_WIDTH, 1920);
vcap.set(CV_CAP_PROP_FRAME_HEIGHT, 1080);
cv::Mat image;
vcap.read(image);
cv::imshow("image",image);
cv::imwrite("image.jpg", image);
}
cv::waitKey(1000);
return 0;
}
How can I take image with higher quality. I don't know the problem is from my camera, or my url, or my code.
I work with opencv 2.4 on windows 7.
Any help would be appreciated