mirror of
https://github.com/opencv/opencv.git
synced 2025-08-05 14:06:35 +08:00
Merge pull request #13151 from paroj:nocapmodes
This commit is contained in:
commit
940dc1f2b7
@ -178,17 +178,6 @@ enum VideoCaptureProperties {
|
|||||||
#endif
|
#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.
|
/** @brief %VideoWriter generic properties identifier.
|
||||||
@sa VideoWriter::get(), VideoWriter::set()
|
@sa VideoWriter::get(), VideoWriter::set()
|
||||||
*/
|
*/
|
||||||
|
@ -452,16 +452,6 @@ enum
|
|||||||
CV_CAP_INTELPERC_GENERATORS_MASK = CV_CAP_INTELPERC_DEPTH_GENERATOR + CV_CAP_INTELPERC_IMAGE_GENERATOR
|
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
|
enum
|
||||||
{
|
{
|
||||||
// Data given from depth generator.
|
// Data given from depth generator.
|
||||||
|
@ -45,6 +45,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#import <AVFoundation/AVFoundation.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 ************************/
|
/********************** Declaration of class headers ************************/
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -154,7 +159,7 @@ private:
|
|||||||
uint8_t *mOutImagedata;
|
uint8_t *mOutImagedata;
|
||||||
IplImage *mOutImage;
|
IplImage *mOutImage;
|
||||||
size_t currSize;
|
size_t currSize;
|
||||||
int mMode;
|
uint32_t mMode;
|
||||||
int mFormat;
|
int mFormat;
|
||||||
|
|
||||||
bool setupReadingAt(CMTime position);
|
bool setupReadingAt(CMTime position);
|
||||||
@ -1028,7 +1033,7 @@ double CvCaptureFile::getProperty(int property_id) const{
|
|||||||
return round((t.value * mAssetTrack.nominalFrameRate) / double(t.timescale));
|
return round((t.value * mAssetTrack.nominalFrameRate) / double(t.timescale));
|
||||||
case CV_CAP_PROP_FORMAT:
|
case CV_CAP_PROP_FORMAT:
|
||||||
return mFormat;
|
return mFormat;
|
||||||
case CV_CAP_PROP_MODE:
|
case CV_CAP_PROP_FOURCC:
|
||||||
return mMode;
|
return mMode;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -1062,8 +1067,8 @@ bool CvCaptureFile::setProperty(int property_id, double value) {
|
|||||||
setupReadingAt(t);
|
setupReadingAt(t);
|
||||||
retval = true;
|
retval = true;
|
||||||
break;
|
break;
|
||||||
case CV_CAP_PROP_MODE:
|
case CV_CAP_PROP_FOURCC:
|
||||||
int mode;
|
uint32_t mode;
|
||||||
mode = cvRound(value);
|
mode = cvRound(value);
|
||||||
if (mMode == mode) {
|
if (mMode == mode) {
|
||||||
retval = true;
|
retval = true;
|
||||||
|
@ -115,6 +115,11 @@ struct IMFActivate;
|
|||||||
struct IMFMediaSource;
|
struct IMFMediaSource;
|
||||||
struct IMFAttributes;
|
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
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -704,7 +709,7 @@ public:
|
|||||||
virtual int getCaptureDomain() CV_OVERRIDE { return CV_CAP_MSMF; }
|
virtual int getCaptureDomain() CV_OVERRIDE { return CV_CAP_MSMF; }
|
||||||
protected:
|
protected:
|
||||||
double getFramerate(MediaType MT) const;
|
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 setTime(double time, bool rough);
|
||||||
bool configureHW(bool enable);
|
bool configureHW(bool enable);
|
||||||
|
|
||||||
@ -720,7 +725,7 @@ protected:
|
|||||||
DWORD dwStreamIndex;
|
DWORD dwStreamIndex;
|
||||||
MediaType nativeFormat;
|
MediaType nativeFormat;
|
||||||
MediaType captureFormat;
|
MediaType captureFormat;
|
||||||
int outputFormat;
|
cv::uint32_t outputFormat;
|
||||||
UINT32 requestedWidth, requestedHeight;
|
UINT32 requestedWidth, requestedHeight;
|
||||||
bool convertFormat;
|
bool convertFormat;
|
||||||
UINT32 aspectN, aspectD;
|
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); }
|
{ return UDIFF(mType.width, refWidth) + UDIFF(mType.height, refHeight); }
|
||||||
#undef UDIFF
|
#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 &&
|
if (width != 0 && height != 0 &&
|
||||||
width == captureFormat.width && height == captureFormat.height && prefFramerate == getFramerate(nativeFormat) &&
|
width == captureFormat.width && height == captureFormat.height && prefFramerate == getFramerate(nativeFormat) &&
|
||||||
@ -1375,8 +1380,6 @@ double CvCapture_MSMF::getProperty( int property_id ) const
|
|||||||
if (isOpen)
|
if (isOpen)
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case CV_CAP_PROP_FORMAT:
|
|
||||||
return outputFormat;
|
|
||||||
case CV_CAP_PROP_MODE:
|
case CV_CAP_PROP_MODE:
|
||||||
return captureMode;
|
return captureMode;
|
||||||
case CV_CAP_PROP_CONVERT_RGB:
|
case CV_CAP_PROP_CONVERT_RGB:
|
||||||
@ -1687,7 +1690,7 @@ bool CvCapture_MSMF::setProperty( int property_id, double value )
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case CV_CAP_PROP_FORMAT:
|
case CV_CAP_PROP_FOURCC:
|
||||||
return configureOutput(requestedWidth, requestedHeight, getFramerate(nativeFormat), aspectN, aspectD, (int)cvRound(value), convertFormat);
|
return configureOutput(requestedWidth, requestedHeight, getFramerate(nativeFormat), aspectN, aspectD, (int)cvRound(value), convertFormat);
|
||||||
case CV_CAP_PROP_CONVERT_RGB:
|
case CV_CAP_PROP_CONVERT_RGB:
|
||||||
return configureOutput(requestedWidth, requestedHeight, getFramerate(nativeFormat), aspectN, aspectD, outputFormat, value != 0);
|
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)
|
if (value >= 0)
|
||||||
return configureOutput(requestedWidth, requestedHeight, value, aspectN, aspectD, outputFormat, convertFormat);
|
return configureOutput(requestedWidth, requestedHeight, value, aspectN, aspectD, outputFormat, convertFormat);
|
||||||
break;
|
break;
|
||||||
case CV_CAP_PROP_FOURCC:
|
|
||||||
break;
|
|
||||||
case CV_CAP_PROP_FRAME_COUNT:
|
case CV_CAP_PROP_FRAME_COUNT:
|
||||||
break;
|
break;
|
||||||
case CV_CAP_PROP_POS_AVI_RATIO:
|
case CV_CAP_PROP_POS_AVI_RATIO:
|
||||||
|
Loading…
Reference in New Issue
Block a user