58 #include "rnr/rnrconfig.h" 64 #include "opencv/cv.h" 65 #include "opencv/highgui.h" 77 CameraCv::CameraCv(
const std::string &strVideoDevName,
80 Camera(strVideoDevName, resVideo, resImage)
108 LOGSYSERROR(
"%s: Could not open video device.",
125 LOGERROR(
"Cannot determine captured image size, using defaults");
148 LOGDIAG3(
"Video capture already stoped.");
157 LOGDIAG3(
"Video capturing stopped.");
164 LOGERROR(
"No video capture object.");
169 else if( !m_capture.grab() )
171 LOGERROR(
"Frame grab() failed.");
176 else if( !m_capture.retrieve(frame) )
178 LOGERROR(
"Frame retrieve() failed.");
231 LOGERROR(
"Cannot grab a snap shot.");
253 if( !bCamWasRunning )
267 m_capture.set(CV_CAP_PROP_FRAME_WIDTH, res.
width);
268 m_capture.set(CV_CAP_PROP_FRAME_HEIGHT, res.
height);
static bool isEqResolution(const CamRes &res1, const CamRes &res2)
Check is two camera resolutions are equal.
virtual void autoFocus()
Auto-focus camera.
CamRes m_resCurrent
current camera resolution
virtual int startVideo(const CamRes &resVideo=CamResDft)
Start the camera streaming video.
Video and still image camera base class.
const CamRes CamResDft
default resolution
virtual CamRes setCameraResolution(const CamRes &res)
Set the camera resolution in either video or still image mode.
bool m_bTakingImage
taking an image is [not] finished
CamRes m_resVideo
current video resolution
bool m_bCameraRunning
camera is [not] on and running video
virtual ~CameraCv()
Destructor.
OpenCv video and still image camera class.
virtual int clickImage(cv::Mat &img, const CamRes &resImage=CamResDft)
Take a still image.
const CamRes CamResQVGA
Quarter VGA 320 x 240 res.
virtual CamRes setCameraResolution(const CamRes &res)
Set the camera resolution in either video or still image mode.
virtual int stopVideo()
Stop the camera from streaming video.
Camera resolution structure.
virtual int stopVideo()
Stop the camera from streaming video.
virtual int grabFrame(cv::Mat &frame)
Grab a image frame from the video stream.
int height
height in pixels
int m_nVideoIndex
video index
CamRes m_resImage
current still image resolution
std::string m_strVideoDevName
video device name
virtual int startVideo(const CamRes &resVideo=CamResDft)
Start the camera streaming video.
virtual int grabFrame(cv::Mat &frame)
Grab a image frame from the video stream.
bool isCameraRunning() const
Test if the camera is on and running.
bool m_bFatal
camera instance is in a fatal state