![]() |
appkit
1.5.1
RoadNarrows Robotics Application Kit
|
OpenCv implementation of the camera class. The video is streamed via OpenCv calls. More...
#include <CameraCv.h>
Public Member Functions | |
| CameraCv (const std::string &strVideoDevName="/dev/video0", const CamRes &resVideo=CamResQVGA, const CamRes &resImage=CamResVGA) | |
| virtual | ~CameraCv () |
| Destructor. | |
| virtual int | startVideo (const CamRes &resVideo=CamResDft) |
| Start the camera streaming video. More... | |
| virtual int | stopVideo () |
| Stop the camera from streaming video. More... | |
| virtual int | grabFrame (cv::Mat &frame) |
| Grab a image frame from the video stream. More... | |
| virtual int | clickImage (cv::Mat &img, const CamRes &resImage=CamResDft) |
| Take a still image. More... | |
| virtual void | autoFocus () |
| Auto-focus camera. | |
| cv::VideoCapture & | getCaptureObj () |
| Get OpenCV captured object. More... | |
Public Member Functions inherited from rnr::Camera | |
| Camera (const std::string &strVideoDevName=VideoDevDft, const CamRes &resVideo=CamResQVGA, const CamRes &resImage=CamResVGA) | |
| virtual | ~Camera () |
| Destructor. More... | |
| bool | isCameraRunning () const |
| Test if the camera is on and running. More... | |
| bool | isTakingAnImage () const |
| Test if a still image is currently being taken. More... | |
| bool | isFatal () const |
| Test if camera object is in a fatal condition. More... | |
| CamRes | getVideoResolution () const |
| Get the current video resolution. More... | |
| CamRes | getImageResolution () const |
| Get the current still image resolution. More... | |
Protected Member Functions | |
| virtual CamRes | setCameraResolution (const CamRes &res) |
| Set the camera resolution in either video or still image mode. More... | |
Protected Attributes | |
| cv::VideoCapture | m_capture |
| video capture object | |
Protected Attributes inherited from rnr::Camera | |
| std::string | m_strVideoDevName |
| video device name | |
| int | m_nVideoIndex |
| video index | |
| CamRes | m_resCurrent |
| current camera resolution | |
| CamRes | m_resVideo |
| current video resolution | |
| CamRes | m_resImage |
| current still image resolution | |
| bool | m_bCameraRunning |
| camera is [not] on and running video | |
| bool | m_bTakingImage |
| taking an image is [not] finished | |
| bool | m_bFatal |
| camera instance is in a fatal state | |
Additional Inherited Members | |
Static Public Member Functions inherited from rnr::Camera | |
| static bool | isEqResolution (const CamRes &res1, const CamRes &res2) |
| Check is two camera resolutions are equal. More... | |
| static int | getVideoIndex (const std::string &strVideoDevName) |
| Get the video index associated with the device. More... | |
OpenCv implementation of the camera class. The video is streamed via OpenCv calls.
Definition at line 83 of file CameraCv.h.
Take a still image.
| [in,out] | img | Snap shot image taken. |
| resImage | Still image resolution. If equal to CamResDft, then the initial/last image resolution setting is used. |
Reimplemented from rnr::Camera.
Definition at line 188 of file CameraCv.cxx.
References rnr::CamResDft, rnr::Camera::grabFrame(), rnr::CamRes::height, rnr::Camera::isCameraRunning(), rnr::Camera::isEqResolution(), rnr::Camera::m_bTakingImage, rnr::Camera::m_resCurrent, rnr::Camera::m_resImage, rnr::Camera::m_resVideo, rnr::Camera::setCameraResolution(), rnr::Camera::startVideo(), rnr::Camera::stopVideo(), and rnr::CamRes::width.
Referenced by rnr::CameraGst::grabFrame().
|
inline |
Get OpenCV captured object.
Definition at line 149 of file CameraCv.h.
References m_capture.
|
virtual |
Grab a image frame from the video stream.
| [in,out] | The | image frame matrix. May be resized. |
Reimplemented from rnr::Camera.
Definition at line 160 of file CameraCv.cxx.
References rnr::Camera::isCameraRunning().
Set the camera resolution in either video or still image mode.
| res | Target camera resolution. |
Reimplemented from rnr::Camera.
Definition at line 265 of file CameraCv.cxx.
References rnr::CamRes::height, rnr::Camera::m_resCurrent, and rnr::CamRes::width.
Referenced by rnr::CameraGst::clickImage(), and rnr::CameraGst::startVideo().
Start the camera streaming video.
| resVideo | Video resolution. If equal to CamResDft, then the initial/last video resolution setting is used. |
Reimplemented from rnr::Camera.
Definition at line 89 of file CameraCv.cxx.
References rnr::CamResDft, rnr::CamResQVGA, rnr::Camera::grabFrame(), rnr::CamRes::height, rnr::Camera::isCameraRunning(), rnr::Camera::isEqResolution(), rnr::Camera::m_bCameraRunning, rnr::Camera::m_bFatal, rnr::Camera::m_nVideoIndex, rnr::Camera::m_resCurrent, rnr::Camera::m_resVideo, rnr::Camera::m_strVideoDevName, rnr::Camera::setCameraResolution(), and rnr::CamRes::width.
Referenced by rnr::CameraGst::clickImage().
|
virtual |
Stop the camera from streaming video.
Reimplemented from rnr::Camera.
Definition at line 144 of file CameraCv.cxx.
References rnr::Camera::isCameraRunning(), and rnr::Camera::m_bCameraRunning.
Referenced by rnr::CameraGst::clickImage(), and rnr::CameraGst::~CameraGst().