4 #include "calibmodel.h"
6 #define USE_MULTITHREADCAPTURE
8 #include "multithreadcapture.h"
15 //MultiGrab(const char *modelfile="model.bmp") : model(modelfile) {}
19 int init( char *avi_bg_path
,
20 int capture_width
, int capture_height
, int v4l_device
, int detect_width
, int detect_height
,
21 int desired_capture_fps
);
22 /// load or train the cache using the given modelfile. if wants_training is true, train;
23 /// otherwise try to load and if load files, train
24 bool loadOrTrainCache( bool wants_training
, const char* modelfile
, bool running_on_binoculars
= false );
26 void allocLightCollector();
32 int detect_width
, detect_height
;
33 //PlanarObjectDetector detector;
34 planar_object_recognizer detector
;
36 MultiThreadCapture
*mtc
;
38 /// stop capturing but leave frame buffers in place
39 void shutdownMultiThreadCapture();
41 const FTime
& getLastProcessedFrameTimestamp() { return detected_frame_timestamp
; }
42 unsigned int getFrameIndexForTime( const FTime
& timestamp
) { return mtc
->getFrameIndexForTime( timestamp
); }
43 IplImage
* getLastProcessedFrame() { return frame
; }
44 /// fetch the last raw frame + timestamp and put into *frame + timestamp. if *frame is NULL, create.
45 bool getLastDrawFrame( IplImage
** raw_frame
, FTime
* timestamp
=NULL
)
46 { return mtc
->getLastDrawFrame( raw_frame
, timestamp
, true /*block*/ ); }
48 void setCam(CvCapture
*c
, int capture_width
, int capture_height
, int detect_width
, int detect_height
, int desired_capture_fps
);
49 bool detect( bool& frame_retrieved
, bool &detect_succeeded
);
51 Cam(CvCapture
*c
=0, int _width
=0, int _height
=0, int _detect_width
=320, int _detect_height
=240, int desired_capture_fps
=20 )
56 detect_width
=_detect_width
;
57 detect_height
=_detect_height
;
61 if (c
) setCam(c
, _width
, _height
, _detect_width
, _detect_height
, desired_capture_fps
);
65 Cam( const Cam
& other
) { assert( false && "copy constructor called, arrgh" ); }
69 IplImage
*frame
, *frame_detectsize
, *gray
;
70 FTime detected_frame_timestamp
;
74 std::vector
<Cam
*> cams
;
78 bool add_detected_homography(int n
, planar_object_recognizer
&detector
, CamCalibration
&calib
);
79 bool add_detected_homography(int n
, planar_object_recognizer
&detector
, CamAugmentation
&a
);
80 IplImage
*myQueryFrame(CvCapture
*capture
);
81 IplImage
*myRetrieveFrame(CvCapture
*capture
);