Merge pull request #13151 from paroj:nocapmodes

This commit is contained in:
Alexander Alekhin 2018-11-16 17:20:48 +00:00
commit 940dc1f2b7
4 changed files with 18 additions and 33 deletions

View File

@ -178,17 +178,6 @@ enum VideoCaptureProperties {
#endif
};
/** @brief Generic camera output modes identifier.
@note Currently, these are supported through the libv4l backend only.
*/
enum VideoCaptureModes {
CAP_MODE_BGR = 0, //!< BGR24 (default)
CAP_MODE_RGB = 1, //!< RGB24
CAP_MODE_GRAY = 2, //!< Y8
CAP_MODE_YUYV = 3 //!< YUYV
};
/** @brief %VideoWriter generic properties identifier.
@sa VideoWriter::get(), VideoWriter::set()
*/

View File

@ -452,16 +452,6 @@ enum
CV_CAP_INTELPERC_GENERATORS_MASK = CV_CAP_INTELPERC_DEPTH_GENERATOR + CV_CAP_INTELPERC_IMAGE_GENERATOR
};
// Generic camera output modes.
// Currently, these are supported through the libv4l interface only.
enum
{
CV_CAP_MODE_BGR = 0, // BGR24 (default)
CV_CAP_MODE_RGB = 1, // RGB24
CV_CAP_MODE_GRAY = 2, // Y8
CV_CAP_MODE_YUYV = 3 // YUYV
};
enum
{
// Data given from depth generator.

View File

@ -45,6 +45,11 @@
#include <stdio.h>
#import <AVFoundation/AVFoundation.h>
#define CV_CAP_MODE_BGR CV_FOURCC_MACRO('B','G','R','3')
#define CV_CAP_MODE_RGB CV_FOURCC_MACRO('R','G','B','3')
#define CV_CAP_MODE_GRAY CV_FOURCC_MACRO('G','R','E','Y')
#define CV_CAP_MODE_YUYV CV_FOURCC_MACRO('Y', 'U', 'Y', 'V')
/********************** Declaration of class headers ************************/
/*****************************************************************************
@ -154,7 +159,7 @@ private:
uint8_t *mOutImagedata;
IplImage *mOutImage;
size_t currSize;
int mMode;
uint32_t mMode;
int mFormat;
bool setupReadingAt(CMTime position);
@ -1028,7 +1033,7 @@ double CvCaptureFile::getProperty(int property_id) const{
return round((t.value * mAssetTrack.nominalFrameRate) / double(t.timescale));
case CV_CAP_PROP_FORMAT:
return mFormat;
case CV_CAP_PROP_MODE:
case CV_CAP_PROP_FOURCC:
return mMode;
default:
break;
@ -1062,8 +1067,8 @@ bool CvCaptureFile::setProperty(int property_id, double value) {
setupReadingAt(t);
retval = true;
break;
case CV_CAP_PROP_MODE:
int mode;
case CV_CAP_PROP_FOURCC:
uint32_t mode;
mode = cvRound(value);
if (mMode == mode) {
retval = true;

View File

@ -115,6 +115,11 @@ struct IMFActivate;
struct IMFMediaSource;
struct IMFAttributes;
#define CV_CAP_MODE_BGR CV_FOURCC_MACRO('B','G','R','3')
#define CV_CAP_MODE_RGB CV_FOURCC_MACRO('R','G','B','3')
#define CV_CAP_MODE_GRAY CV_FOURCC_MACRO('G','R','E','Y')
#define CV_CAP_MODE_YUYV CV_FOURCC_MACRO('Y', 'U', 'Y', 'V')
namespace
{
@ -704,7 +709,7 @@ public:
virtual int getCaptureDomain() CV_OVERRIDE { return CV_CAP_MSMF; }
protected:
double getFramerate(MediaType MT) const;
bool configureOutput(UINT32 width, UINT32 height, double prefFramerate, UINT32 aspectRatioN, UINT32 aspectRatioD, int outFormat, bool convertToFormat);
bool configureOutput(UINT32 width, UINT32 height, double prefFramerate, UINT32 aspectRatioN, UINT32 aspectRatioD, cv::uint32_t outFormat, bool convertToFormat);
bool setTime(double time, bool rough);
bool configureHW(bool enable);
@ -720,7 +725,7 @@ protected:
DWORD dwStreamIndex;
MediaType nativeFormat;
MediaType captureFormat;
int outputFormat;
cv::uint32_t outputFormat;
UINT32 requestedWidth, requestedHeight;
bool convertFormat;
UINT32 aspectN, aspectD;
@ -836,7 +841,7 @@ static UINT32 resolutionDiff(MediaType& mType, UINT32 refWidth, UINT32 refHeight
{ return UDIFF(mType.width, refWidth) + UDIFF(mType.height, refHeight); }
#undef UDIFF
bool CvCapture_MSMF::configureOutput(UINT32 width, UINT32 height, double prefFramerate, UINT32 aspectRatioN, UINT32 aspectRatioD, int outFormat, bool convertToFormat)
bool CvCapture_MSMF::configureOutput(UINT32 width, UINT32 height, double prefFramerate, UINT32 aspectRatioN, UINT32 aspectRatioD, cv::uint32_t outFormat, bool convertToFormat)
{
if (width != 0 && height != 0 &&
width == captureFormat.width && height == captureFormat.height && prefFramerate == getFramerate(nativeFormat) &&
@ -1375,8 +1380,6 @@ double CvCapture_MSMF::getProperty( int property_id ) const
if (isOpen)
switch (property_id)
{
case CV_CAP_PROP_FORMAT:
return outputFormat;
case CV_CAP_PROP_MODE:
return captureMode;
case CV_CAP_PROP_CONVERT_RGB:
@ -1687,7 +1690,7 @@ bool CvCapture_MSMF::setProperty( int property_id, double value )
default:
return false;
}
case CV_CAP_PROP_FORMAT:
case CV_CAP_PROP_FOURCC:
return configureOutput(requestedWidth, requestedHeight, getFramerate(nativeFormat), aspectN, aspectD, (int)cvRound(value), convertFormat);
case CV_CAP_PROP_CONVERT_RGB:
return configureOutput(requestedWidth, requestedHeight, getFramerate(nativeFormat), aspectN, aspectD, outputFormat, value != 0);
@ -1711,8 +1714,6 @@ bool CvCapture_MSMF::setProperty( int property_id, double value )
if (value >= 0)
return configureOutput(requestedWidth, requestedHeight, value, aspectN, aspectD, outputFormat, convertFormat);
break;
case CV_CAP_PROP_FOURCC:
break;
case CV_CAP_PROP_FRAME_COUNT:
break;
case CV_CAP_PROP_POS_AVI_RATIO: