mirror of
https://github.com/opencv/opencv.git
synced 2025-01-19 23:19:23 +08:00
Merge pull request #8985 from alalek:update_videoio
This commit is contained in:
commit
b3cd2448cd
@ -115,7 +115,7 @@ enum VideoCaptureAPIs {
|
||||
CAP_FFMPEG = 1900, //!< Open and record video file or stream using the FFMPEG library
|
||||
CAP_IMAGES = 2000, //!< OpenCV Image Sequence (e.g. img_%02d.jpg)
|
||||
CAP_ARAVIS = 2100, //!< Aravis SDK
|
||||
CAP_OCV_MJPEG = 2200, //!< Built-in MotionJPEG codec
|
||||
CAP_OPENCV_MJPEG = 2200, //!< Built-in OpenCV MotionJPEG codec
|
||||
CAP_INTEL_MFX = 2300 //!< Intel MediaSDK
|
||||
};
|
||||
|
||||
|
@ -124,8 +124,7 @@ enum
|
||||
CV_CAP_FFMPEG = 1900, // FFMPEG
|
||||
CV_CAP_IMAGES = 2000, // OpenCV Image Sequence (e.g. img_%02d.jpg)
|
||||
|
||||
CV_CAP_ARAVIS = 2100, // Aravis GigE SDK
|
||||
CV_CAP_OCV_MJPEG = 2200 // Built-in MotionJPEG codec
|
||||
CV_CAP_ARAVIS = 2100 // Aravis GigE SDK
|
||||
};
|
||||
|
||||
/** @brief start capturing frames from camera: index = camera_index + domain_offset (CV_CAP_*)
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"const_ignore_list": [
|
||||
"CV_CAP_OPENNI",
|
||||
"CV_CAP_OPENNI2",
|
||||
"CV_CAP_PROP_OPENNI_",
|
||||
"CV_CAP_INTELPERC",
|
||||
"CV_CAP_PROP_INTELPERC_",
|
||||
@ -20,6 +21,7 @@
|
||||
"CV_CAP_UNICAP",
|
||||
"CV_CAP_DSHOW",
|
||||
"CV_CAP_PVAPI",
|
||||
"CV_CAP_ARAVIS",
|
||||
"CV_CAP_PROP_DC1394_OFF",
|
||||
"CV_CAP_PROP_DC1394_MODE_MANUAL",
|
||||
"CV_CAP_PROP_DC1394_MODE_AUTO",
|
||||
|
@ -60,6 +60,8 @@
|
||||
#pragma warning(disable: 4748)
|
||||
#endif
|
||||
|
||||
using namespace cv;
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
@ -178,11 +180,11 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
|
||||
if (pref) break;
|
||||
|
||||
#ifdef HAVE_MSMF
|
||||
case CV_CAP_MSMF:
|
||||
case CAP_MSMF:
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_MSMF(index))
|
||||
if (pref) break;
|
||||
#endif
|
||||
case CV_CAP_VFW:
|
||||
case CAP_VFW: // or CAP_V4L or CAP_V4L2
|
||||
#ifdef HAVE_VFW
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_VFW(index))
|
||||
#endif
|
||||
@ -190,7 +192,6 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
|
||||
#if defined HAVE_LIBV4L || defined HAVE_CAMV4L || defined HAVE_CAMV4L2 || defined HAVE_VIDEOIO
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_V4L(index))
|
||||
#endif
|
||||
if (pref) break; // CV_CAP_VFW
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
TRY_OPEN(capture, cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2, reinterpret_cast<char *>(index)))
|
||||
@ -198,7 +199,9 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
|
||||
TRY_OPEN(capture, cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L, reinterpret_cast<char *>(index)))
|
||||
#endif
|
||||
|
||||
case CV_CAP_FIREWIRE:
|
||||
if (pref) break; // CAP_VFW or CAP_V4L or CAP_V4L2
|
||||
|
||||
case CAP_FIREWIRE:
|
||||
#ifdef HAVE_DC1394_2
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_DC1394_2(index))
|
||||
#endif
|
||||
@ -216,64 +219,64 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
|
||||
TRY_OPEN(capture, cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_1394, 0))
|
||||
#endif
|
||||
|
||||
if (pref) break; // CV_CAP_FIREWIRE
|
||||
if (pref) break; // CAP_FIREWIRE
|
||||
|
||||
#ifdef HAVE_MIL
|
||||
case CV_CAP_MIL:
|
||||
case CAP_MIL:
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_MIL(index))
|
||||
if (pref) break;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_QUICKTIME) || defined(HAVE_QTKIT)
|
||||
case CV_CAP_QT:
|
||||
case CAP_QT:
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_QT(index))
|
||||
if (pref) break;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNICAP
|
||||
case CV_CAP_UNICAP:
|
||||
case CAP_UNICAP:
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_Unicap(index))
|
||||
if (pref) break;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PVAPI
|
||||
case CV_CAP_PVAPI:
|
||||
case CAP_PVAPI:
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_PvAPI(index))
|
||||
if (pref) break;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENNI
|
||||
case CV_CAP_OPENNI:
|
||||
case CAP_OPENNI:
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_OpenNI(index))
|
||||
if (pref) break;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENNI2
|
||||
case CV_CAP_OPENNI2:
|
||||
case CAP_OPENNI2:
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_OpenNI2(index))
|
||||
if (pref) break;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XIMEA
|
||||
case CV_CAP_XIAPI:
|
||||
case CAP_XIAPI:
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_XIMEA(index))
|
||||
if (pref) break;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
case CV_CAP_AVFOUNDATION:
|
||||
case CAP_AVFOUNDATION:
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_AVFoundation(index))
|
||||
if (pref) break;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GIGE_API
|
||||
case CV_CAP_GIGANETIX:
|
||||
case CAP_GIGANETIX:
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_Giganetix(index))
|
||||
if (pref) break; // CV_CAP_GIGANETIX
|
||||
if (pref) break; // CAP_GIGANETIX
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARAVIS_API
|
||||
case CV_CAP_ARAVIS:
|
||||
case CAP_ARAVIS:
|
||||
TRY_OPEN(capture, cvCreateCameraCapture_Aravis(index))
|
||||
if (pref) break;
|
||||
#endif
|
||||
@ -297,12 +300,12 @@ CV_IMPL CvCapture * cvCreateFileCaptureWithPreference (const char * filename, in
|
||||
if (apiPreference) break;
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
case CV_CAP_FFMPEG:
|
||||
case CAP_FFMPEG:
|
||||
TRY_OPEN(result, cvCreateFileCapture_FFMPEG_proxy (filename))
|
||||
if (apiPreference) break;
|
||||
#endif
|
||||
|
||||
case CV_CAP_VFW:
|
||||
case CAP_VFW:
|
||||
#ifdef HAVE_VFW
|
||||
TRY_OPEN(result, cvCreateFileCapture_VFW (filename))
|
||||
#endif
|
||||
@ -312,7 +315,7 @@ CV_IMPL CvCapture * cvCreateFileCaptureWithPreference (const char * filename, in
|
||||
#endif
|
||||
if (apiPreference) break;
|
||||
|
||||
case CV_CAP_MSMF:
|
||||
case CAP_MSMF:
|
||||
#ifdef HAVE_MSMF
|
||||
TRY_OPEN(result, cvCreateFileCapture_MSMF (filename))
|
||||
#endif
|
||||
@ -323,36 +326,36 @@ CV_IMPL CvCapture * cvCreateFileCaptureWithPreference (const char * filename, in
|
||||
if (apiPreference) break;
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
case CV_CAP_GSTREAMER:
|
||||
case CAP_GSTREAMER:
|
||||
TRY_OPEN(result, cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename))
|
||||
if (apiPreference) break;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_QUICKTIME) || defined(HAVE_QTKIT)
|
||||
case CV_CAP_QT:
|
||||
case CAP_QT:
|
||||
TRY_OPEN(result, cvCreateFileCapture_QT (filename))
|
||||
if (apiPreference) break;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
case CV_CAP_AVFOUNDATION:
|
||||
case CAP_AVFOUNDATION:
|
||||
TRY_OPEN(result, cvCreateFileCapture_AVFoundation (filename))
|
||||
if (apiPreference) break;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENNI
|
||||
case CV_CAP_OPENNI:
|
||||
case CAP_OPENNI:
|
||||
TRY_OPEN(result, cvCreateFileCapture_OpenNI (filename))
|
||||
if (apiPreference) break;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENNI2
|
||||
case CV_CAP_OPENNI2:
|
||||
case CAP_OPENNI2:
|
||||
TRY_OPEN(result, cvCreateFileCapture_OpenNI2 (filename))
|
||||
if (apiPreference) break;
|
||||
#endif
|
||||
|
||||
case CV_CAP_IMAGES:
|
||||
case CAP_IMAGES:
|
||||
TRY_OPEN(result, cvCreateFileCapture_Images (filename))
|
||||
}
|
||||
|
||||
@ -361,7 +364,7 @@ CV_IMPL CvCapture * cvCreateFileCaptureWithPreference (const char * filename, in
|
||||
|
||||
CV_IMPL CvCapture * cvCreateFileCapture (const char * filename)
|
||||
{
|
||||
return cvCreateFileCaptureWithPreference(filename, CV_CAP_ANY);
|
||||
return cvCreateFileCaptureWithPreference(filename, CAP_ANY);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -383,40 +386,40 @@ static CvVideoWriter* cvCreateVideoWriterWithPreference(const char* filename, in
|
||||
{
|
||||
default:
|
||||
//exit if the specified API is unavaliable
|
||||
if (apiPreference != CV_CAP_ANY) break;
|
||||
if (apiPreference != CAP_ANY) break;
|
||||
#ifdef HAVE_FFMPEG
|
||||
case CV_CAP_FFMPEG:
|
||||
case CAP_FFMPEG:
|
||||
TRY_OPEN(result, cvCreateVideoWriter_FFMPEG_proxy (filename, fourcc, fps, frameSize, is_color))
|
||||
if (apiPreference != CV_CAP_ANY) break;
|
||||
if (apiPreference != CAP_ANY) break;
|
||||
#endif
|
||||
#ifdef HAVE_VFW
|
||||
case CV_CAP_VFW:
|
||||
case CAP_VFW:
|
||||
TRY_OPEN(result, cvCreateVideoWriter_VFW(filename, fourcc, fps, frameSize, is_color))
|
||||
if (apiPreference != CV_CAP_ANY) break;
|
||||
if (apiPreference != CAP_ANY) break;
|
||||
#endif
|
||||
#ifdef HAVE_MSMF
|
||||
case CV_CAP_MSMF:
|
||||
case CAP_MSMF:
|
||||
TRY_OPEN(result, cvCreateVideoWriter_MSMF(filename, fourcc, fps, frameSize, is_color))
|
||||
if (apiPreference != CV_CAP_ANY) break;
|
||||
if (apiPreference != CAP_ANY) break;
|
||||
#endif
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
case CV_CAP_AVFOUNDATION:
|
||||
case CAP_AVFOUNDATION:
|
||||
TRY_OPEN(result, cvCreateVideoWriter_AVFoundation(filename, fourcc, fps, frameSize, is_color))
|
||||
if (apiPreference != CV_CAP_ANY) break;
|
||||
if (apiPreference != CAP_ANY) break;
|
||||
#endif
|
||||
#if defined(HAVE_QUICKTIME) || defined(HAVE_QTKIT)
|
||||
case(CV_CAP_QT):
|
||||
case(CAP_QT):
|
||||
TRY_OPEN(result, cvCreateVideoWriter_QT(filename, fourcc, fps, frameSize, is_color))
|
||||
if (apiPreference != CV_CAP_ANY) break;
|
||||
if (apiPreference != CAP_ANY) break;
|
||||
#endif
|
||||
#ifdef HAVE_GSTREAMER
|
||||
case CV_CAP_GSTREAMER:
|
||||
case CAP_GSTREAMER:
|
||||
TRY_OPEN(result, cvCreateVideoWriter_GStreamer (filename, fourcc, fps, frameSize, is_color))
|
||||
if (apiPreference != CV_CAP_ANY) break;
|
||||
if (apiPreference != CAP_ANY) break;
|
||||
#endif
|
||||
case CV_CAP_IMAGES:
|
||||
case CAP_IMAGES:
|
||||
TRY_OPEN(result, cvCreateVideoWriter_Images(filename))
|
||||
if (apiPreference != CV_CAP_ANY) break;
|
||||
if (apiPreference != CAP_ANY) break;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -425,7 +428,7 @@ static CvVideoWriter* cvCreateVideoWriterWithPreference(const char* filename, in
|
||||
CV_IMPL CvVideoWriter* cvCreateVideoWriter( const char* filename, int fourcc,
|
||||
double fps, CvSize frameSize, int is_color )
|
||||
{
|
||||
return cvCreateVideoWriterWithPreference(filename, CV_CAP_ANY, fourcc, fps, frameSize, is_color);
|
||||
return cvCreateVideoWriterWithPreference(filename, CAP_ANY, fourcc, fps, frameSize, is_color);
|
||||
}
|
||||
|
||||
CV_IMPL int cvWriteFrame( CvVideoWriter* writer, const IplImage* image )
|
||||
@ -450,16 +453,16 @@ static Ptr<IVideoCapture> IVideoCapture_create(int index)
|
||||
int domains[] =
|
||||
{
|
||||
#ifdef HAVE_DSHOW
|
||||
CV_CAP_DSHOW,
|
||||
CAP_DSHOW,
|
||||
#endif
|
||||
#ifdef HAVE_INTELPERC
|
||||
CV_CAP_INTELPERC,
|
||||
CAP_INTELPERC,
|
||||
#endif
|
||||
#ifdef WINRT_VIDEO
|
||||
CAP_WINRT,
|
||||
#endif
|
||||
#ifdef HAVE_GPHOTO2
|
||||
CV_CAP_GPHOTO2,
|
||||
CAP_GPHOTO2,
|
||||
#endif
|
||||
-1, -1
|
||||
};
|
||||
@ -486,14 +489,14 @@ static Ptr<IVideoCapture> IVideoCapture_create(int index)
|
||||
switch (domains[i])
|
||||
{
|
||||
#ifdef HAVE_DSHOW
|
||||
case CV_CAP_DSHOW:
|
||||
case CAP_DSHOW:
|
||||
capture = makePtr<VideoCapture_DShow>(index);
|
||||
break; // CV_CAP_DSHOW
|
||||
break; // CAP_DSHOW
|
||||
#endif
|
||||
#ifdef HAVE_INTELPERC
|
||||
case CV_CAP_INTELPERC:
|
||||
case CAP_INTELPERC:
|
||||
capture = makePtr<VideoCapture_IntelPerC>();
|
||||
break; // CV_CAP_INTEL_PERC
|
||||
break; // CAP_INTEL_PERC
|
||||
#endif
|
||||
#ifdef WINRT_VIDEO
|
||||
case CAP_WINRT:
|
||||
@ -503,7 +506,7 @@ static Ptr<IVideoCapture> IVideoCapture_create(int index)
|
||||
break; // CAP_WINRT
|
||||
#endif
|
||||
#ifdef HAVE_GPHOTO2
|
||||
case CV_CAP_GPHOTO2:
|
||||
case CAP_GPHOTO2:
|
||||
capture = createGPhoto2Capture(index);
|
||||
break;
|
||||
#endif
|
||||
@ -522,9 +525,9 @@ static Ptr<IVideoCapture> IVideoCapture_create(const String& filename)
|
||||
{
|
||||
int domains[] =
|
||||
{
|
||||
CV_CAP_ANY,
|
||||
CAP_ANY,
|
||||
#ifdef HAVE_GPHOTO2
|
||||
CV_CAP_GPHOTO2,
|
||||
CAP_GPHOTO2,
|
||||
#endif
|
||||
#ifdef HAVE_MFX
|
||||
CAP_INTEL_MFX,
|
||||
@ -539,11 +542,11 @@ static Ptr<IVideoCapture> IVideoCapture_create(const String& filename)
|
||||
|
||||
switch (domains[i])
|
||||
{
|
||||
case CV_CAP_ANY:
|
||||
case CAP_ANY:
|
||||
capture = createMotionJpegCapture(filename);
|
||||
break;
|
||||
#ifdef HAVE_GPHOTO2
|
||||
case CV_CAP_GPHOTO2:
|
||||
case CAP_GPHOTO2:
|
||||
capture = createGPhoto2Capture(filename);
|
||||
break;
|
||||
#endif
|
||||
@ -575,7 +578,7 @@ static Ptr<IVideoWriter> IVideoWriter_create(const String& filename, int apiPref
|
||||
}
|
||||
#endif
|
||||
|
||||
if( (apiPreference == CAP_OCV_MJPEG || apiPreference == CAP_ANY)
|
||||
if( (apiPreference == CAP_OPENCV_MJPEG || apiPreference == CAP_ANY)
|
||||
&& _fourcc == CV_FOURCC('M', 'J', 'P', 'G') )
|
||||
iwriter = createMotionJpegWriter(filename, fps, frameSize, isColor);
|
||||
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
virtual IplImage* retrieveFrame(int);
|
||||
virtual int getCaptureDomain()
|
||||
{
|
||||
return CV_CAP_ARAVIS;
|
||||
return cv::CAP_ARAVIS;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -90,7 +90,7 @@ struct CvCapture
|
||||
virtual bool setProperty(int, double) { return 0; }
|
||||
virtual bool grabFrame() { return true; }
|
||||
virtual IplImage* retrieveFrame(int) { return 0; }
|
||||
virtual int getCaptureDomain() { return CV_CAP_ANY; } // Return the type of the capture object: CV_CAP_VFW, etc...
|
||||
virtual int getCaptureDomain() { return cv::CAP_ANY; } // Return the type of the capture object: CAP_VFW, etc...
|
||||
};
|
||||
|
||||
/*************************** CvVideoWriter structure ****************************/
|
||||
|
Loading…
Reference in New Issue
Block a user