![]() |
appkit
1.5.1
RoadNarrows Robotics Application Kit
|
GStreamer implementation of the camera class. The video is streamed via a Gstreamer/GTK callback mechanism. More...
#include <CameraGst.h>
Public Member Functions | |
| CameraGst (const std::string &strVideoDevName="/dev/video0", const CamRes &resVideo=CamResQVGA, const CamRes &resImage=CamResVGA) | |
| virtual | ~CameraGst () |
| 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. | |
| void | setXid (gulong uXid) |
| Set X identifier associated with widget receiving streaming video. More... | |
| void | setTextOverlay (const char *sText) |
| Overlay text on video stream. More... | |
| void | clearTextOverlay () |
| Clear text overlay on video stream. | |
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... | |
| void | startPipeline () |
| Start the camera and the pipeline. | |
| void | stopPipeline () |
| Stop the camera and the pipeline. | |
| int | makePipeline () |
| Make gstreamer video pipeline. | |
| int | makeCameraSrcBin () |
| Video source bin. More... | |
| int | makeVideoSinkBin () |
| Video sink bin. More... | |
| int | makeImageSinkBin () |
| Image sink bin. More... | |
| void | makeTmpFile () |
| Make unique temporary file. | |
Static Protected Member Functions | |
| static GstBusSyncReply | gstBusSyncHandler (GstBus *bus, GstMessage *message, gpointer user_data) |
| static void | gstBusMsgCb (GstBus *bus, GstMessage *message, gpointer user_data) |
| Gstream pipeline synchronous bus handler. More... | |
| static void | clickCb (GstElement *element, GstBuffer *buffer, GstPad *pad, void *user_data) |
| Still image capture asynchronouse callback. More... | |
Protected Attributes | |
| GstElement * | m_pPipeline |
| camera pipeline | |
| GstElement * | m_pBinCameraSrc |
| camera source bin | |
| GstElement * | m_pElemCamFilter |
| camera properties element | |
| GstElement * | m_pBinVideoSink |
| video sink bin | |
| GstElement * | m_pElemVidText |
| video text overlay | |
| GstElement * | m_pElemVidSink |
| video sink | |
| GstElement * | m_pBinImageSink |
| still image sink bin | |
| GstElement * | m_pElemImgSink |
| still image sink | |
| int | m_nSignalId |
| camera still image callback signal | |
| gulong | m_uVidWinXid |
| overlay window X-windows id | |
| char | m_bufTmpName [PATH_MAX] |
| temporary file name buffer | |
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... | |
GStreamer implementation of the camera class. The video is streamed via a Gstreamer/GTK callback mechanism.
Definition at line 84 of file CameraGst.h.
|
staticprotected |
Still image capture asynchronouse callback.
This function is called when an image buffer from the camera has been retrieved.
| element | GStreamer element. |
| buffer | Image buffer. |
| pad | GStreamer pad. |
| user_data | User data (this) |
Definition at line 269 of file CameraGst.cxx.
References rnr::CamRes::height, m_bufTmpName, m_nSignalId, m_pElemImgSink, rnr::Camera::m_resImage, and rnr::CamRes::width.
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 172 of file CameraGst.cxx.
References rnr::CamResDft, rnr::Camera::isCameraRunning(), rnr::Camera::isEqResolution(), rnr::Camera::m_bTakingImage, rnr::Camera::m_resCurrent, rnr::Camera::m_resImage, rnr::Camera::m_resVideo, rnr::CameraCv::setCameraResolution(), rnr::CameraCv::startVideo(), and rnr::CameraCv::stopVideo().
|
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 157 of file CameraGst.cxx.
References rnr::CameraCv::clickImage(), rnr::Camera::isCameraRunning(), and rnr::Camera::m_resVideo.
|
staticprotected |
Gstream pipeline synchronous bus handler.
| bus | GStream bus. |
| message | Bus message. |
| user_data | User data. |
Definition at line 886 of file CameraGst.cxx.
References m_uVidWinXid.
|
protected |
Video source bin.
* |---------------------------------| * camera - [] v4l2src - capsfilter - identity [] - * |---------------------------------| *
Definition at line 463 of file CameraGst.cxx.
References rnr::CamRes::height, rnr::Camera::m_bFatal, rnr::Camera::m_resVideo, rnr::Camera::m_strVideoDevName, and rnr::CamRes::width.
|
protected |
Image sink bin.
* |-----------------------| ~~ |----- * - [] colorspace - fakesink | | callback * |-----------------------| ~~ |----- *
Definition at line 768 of file CameraGst.cxx.
References rnr::Camera::m_bFatal.
|
protected |
Video sink bin.
* |------------------------------------------------------------------| * | - queue - scale - capsfilter - colorspace - gconfvideosink | * | / | * - [] tee - | * | \ | * | - queue (to save image) [] * |------------------------------------------------------------------| *
Definition at line 563 of file CameraGst.cxx.
References rnr::Camera::m_bFatal.
Set the camera resolution in either video or still image mode.
| res | Target camera resolution. |
Reimplemented from rnr::Camera.
Definition at line 328 of file CameraGst.cxx.
References rnr::CamRes::height, rnr::Camera::isCameraRunning(), rnr::Camera::m_resCurrent, and rnr::CamRes::width.
|
inline |
Overlay text on video stream.
| sText | Null-terminated string. |
Definition at line 157 of file CameraGst.h.
References m_pElemVidText.
| void CameraGst::setXid | ( | gulong | uXid | ) |
Set X identifier associated with widget receiving streaming video.
| uXid | X identifier. |
Definition at line 357 of file CameraGst.cxx.
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 103 of file CameraGst.cxx.
References rnr::CamResDft, rnr::CamRes::height, rnr::Camera::isCameraRunning(), rnr::Camera::isEqResolution(), rnr::Camera::m_resCurrent, rnr::Camera::m_resVideo, rnr::CameraCv::setCameraResolution(), and rnr::CamRes::width.
|
virtual |
Stop the camera from streaming video.
Reimplemented from rnr::Camera.
Definition at line 141 of file CameraGst.cxx.
References rnr::Camera::isCameraRunning().