Merged the trunk r8542:8544

This commit is contained in:
Andrey Kamaev 2012-06-01 10:59:27 +00:00
parent 8159ea3386
commit 059b79f7c2
6 changed files with 24 additions and 11 deletions

View File

@ -508,12 +508,14 @@ public:
* gridRows Grid rows count. * gridRows Grid rows count.
* gridCols Grid column count. * gridCols Grid column count.
*/ */
CV_WRAP GridAdaptedFeatureDetector( const Ptr<FeatureDetector>& detector, CV_WRAP GridAdaptedFeatureDetector( const Ptr<FeatureDetector>& detector=0,
int maxTotalKeypoints=1000, int maxTotalKeypoints=1000,
int gridRows=4, int gridCols=4 ); int gridRows=4, int gridCols=4 );
// TODO implement read/write // TODO implement read/write
virtual bool empty() const; virtual bool empty() const;
AlgorithmInfo* info() const;
protected: protected:
virtual void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const; virtual void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;

View File

@ -133,15 +133,22 @@ CV_INIT_ALGORITHM(DenseFeatureDetector, "Feature2D.Dense",
obj.info()->addParam(obj, "varyXyStepWithScale", obj.varyXyStepWithScale); obj.info()->addParam(obj, "varyXyStepWithScale", obj.varyXyStepWithScale);
obj.info()->addParam(obj, "varyImgBoundWithScale", obj.varyImgBoundWithScale)); obj.info()->addParam(obj, "varyImgBoundWithScale", obj.varyImgBoundWithScale));
CV_INIT_ALGORITHM(GridAdaptedFeatureDetector, "Feature2D.Grid",
obj.info()->addParam(obj, "detector", (Ptr<Algorithm>&)obj.detector);
obj.info()->addParam(obj, "maxTotalKeypoints", obj.maxTotalKeypoints);
obj.info()->addParam(obj, "gridRows", obj.gridRows);
obj.info()->addParam(obj, "gridCols", obj.gridCols));
bool initModule_features2d(void) bool initModule_features2d(void)
{ {
Ptr<Algorithm> brief = createBriefDescriptorExtractor(), orb = createORB(), Ptr<Algorithm> brief = createBriefDescriptorExtractor(), orb = createORB(),
star = createStarDetector(), fastd = createFastFeatureDetector(), mser = createMSER(), star = createStarDetector(), fastd = createFastFeatureDetector(), mser = createMSER(),
dense = createDenseFeatureDetector(), gftt = createGFTTDetector(), harris = createHarrisDetector(); dense = createDenseFeatureDetector(), gftt = createGFTTDetector(),
harris = createHarrisDetector(), grid = createGridAdaptedFeatureDetector();
return brief->info() != 0 && orb->info() != 0 && star->info() != 0 && return brief->info() != 0 && orb->info() != 0 && star->info() != 0 &&
fastd->info() != 0 && mser->info() != 0 && dense->info() != 0 && fastd->info() != 0 && mser->info() != 0 && dense->info() != 0 &&
gftt->info() != 0 && harris->info() != 0; gftt->info() != 0 && harris->info() != 0 && grid->info() != 0;
} }
} }

View File

@ -494,19 +494,16 @@ bool VideoCapture::retrieve(Mat& image, int channel)
bool VideoCapture::read(Mat& image) bool VideoCapture::read(Mat& image)
{ {
if(!grab()) if(grab())
image.release();
else
retrieve(image); retrieve(image);
else
image.release();
return !image.empty(); return !image.empty();
} }
VideoCapture& VideoCapture::operator >> (Mat& image) VideoCapture& VideoCapture::operator >> (Mat& image)
{ {
if(!grab()) read(image);
image.release();
else
retrieve(image);
return *this; return *this;
} }

View File

@ -438,6 +438,10 @@ bool CvCapture_FFMPEG::grabFrame()
const int max_number_of_attempts = 1 << 16; const int max_number_of_attempts = 1 << 16;
if( !ic || !video_st ) return false; if( !ic || !video_st ) return false;
if( ic->streams[video_stream]->nb_frames > 0 &&
frame_number > ic->streams[video_stream]->nb_frames )
return false;
av_free_packet (&packet); av_free_packet (&packet);

View File

@ -316,7 +316,9 @@ int CvCaptureCAM::startCaptureDevice(int cameraNum) {
capture = [[CaptureDelegate alloc] init]; capture = [[CaptureDelegate alloc] init];
QTCaptureDevice *device; QTCaptureDevice *device;
NSArray* devices = [QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo]; NSArray* devices = [[[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo]
arrayByAddingObjectsFromArray:[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeMuxed]] retain];
if ([devices count] == 0) { if ([devices count] == 0) {
cout << "QTKit didn't find any attached Video Input Devices!" << endl; cout << "QTKit didn't find any attached Video Input Devices!" << endl;
[localpool drain]; [localpool drain];

View File

@ -57,6 +57,7 @@ CV_INIT_ALGORITHM(BackgroundSubtractorMOG, "BackgroundSubtractor.MOG",
CV_INIT_ALGORITHM(BackgroundSubtractorMOG2, "BackgroundSubtractor.MOG2", CV_INIT_ALGORITHM(BackgroundSubtractorMOG2, "BackgroundSubtractor.MOG2",
obj.info()->addParam(obj, "history", obj.history); obj.info()->addParam(obj, "history", obj.history);
obj.info()->addParam(obj, "nmixtures", obj.nmixtures);
obj.info()->addParam(obj, "varThreshold", obj.varThreshold); obj.info()->addParam(obj, "varThreshold", obj.varThreshold);
obj.info()->addParam(obj, "detectShadows", obj.bShadowDetection)); obj.info()->addParam(obj, "detectShadows", obj.bShadowDetection));