appkit  1.5.1
RoadNarrows Robotics Application Kit
CameraEcon50.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: RoadNarrows Robotics Application Tool Kit
4 //
5 // Link: https://github.com/roadnarrows-robotics/rnr-sdk
6 //
7 // Library: librnr_cam
8 //
9 // File: CameraEcon50.h
10 //
11 /*! \file
12  *
13  * $LastChangedDate: 2013-07-15 11:45:50 -0600 (Mon, 15 Jul 2013) $
14  * $Rev: 3131 $
15  *
16  * \brief Econ 5.0 megapixel video and still image camera class.
17  *
18  * \author Robin Knight (robin.knight@roadnarrows.com)
19  * \author Daniel Packard (daniel@roadnarrows.com)
20  *
21  * \par Copyright
22  * \h_copy 2012-2017. RoadNarrows LLC.\n
23  * http://www.roadnarrows.com\n
24  * All Rights Reserved
25  */
26 /*
27  * @EulaBegin@
28  *
29  * Permission is hereby granted, without written agreement and without
30  * license or royalty fees, to use, copy, modify, and distribute this
31  * software and its documentation for any purpose, provided that
32  * (1) The above copyright notice and the following two paragraphs
33  * appear in all copies of the source code and (2) redistributions
34  * including binaries reproduces these notices in the supporting
35  * documentation. Substantial modifications to this software may be
36  * copyrighted by their authors and need not follow the licensing terms
37  * described here, provided that the new terms are clearly indicated in
38  * all files where they apply.
39  *
40  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
41  * OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
42  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
43  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
44  * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
45  * THE POSSIBILITY OF SUCH DAMAGE.
46  *
47  * THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
48  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
49  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
50  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
51  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
52  *
53  * @EulaEnd@
54  */
55 ////////////////////////////////////////////////////////////////////////////////
56 
57 #ifndef _RNR_CAMERA_ECON_50_H
58 #define _RNR_CAMERA_ECON_50_H
59 
60 #if defined(ARCH_overo)
61 
62 #include <limits.h>
63 #include <math.h>
64 
65 #include <string>
66 
67 #include "rnr/rnrconfig.h"
68 #include "rnr/log.h"
69 
70 #include "rnr/appkit/Camera.h"
71 #include "rnr/appkit/CameraCv.h"
72 
73 #include "econ/econ50.h"
74 
75 #include "opencv/cv.h"
76 
77 /*!
78  * \brief RoadNarrows Robotics
79  */
80 namespace rnr
81 {
82  /*!
83  * \brief Special Econ supported camera resolutions.
84  */
85  const CamRes CamResEcon5_0MP = CamRes2592x1944; ///< max camera resolution
86 
87 
88  //---------------------------------------------------------------------------
89  // Econ 5.0MP Camera Derived Class (work in progress)
90  //---------------------------------------------------------------------------
91 
92  /*!
93  * \brief Econ 5.0MP implementation of the camera class.
94  *
95  * The video is streamed via OpenCv calls. The still images are taken via
96  * econ methods to gain higher resolution (theoretically).
97  *
98  * \todo The CameraEcon50 class is not fully implemented.
99  */
100  class CameraEcon50 : public CameraCv
101  {
102  public:
103  /*
104  * \brief Default initialization constructor.
105  *
106  * \param strVideoDevName Video camera device name.
107  * \param resVideo Video resolution.
108  * \param resImage Image resolution.
109  */
110  CameraEcon50(const std::string &strVideoDevName="/dev/video0",
111  const CamRes &resVideo=CamResQVGA,
112  const CamRes &resImage=CamResVGA);
113 
114  /*!
115  * \brief Destructor.
116  */
117  virtual ~CameraEcon50();
118 
119  /*!
120  * \brief Take a still image.
121  *
122  * \note Any OpenCV video capture must be stopped before executing econ
123  * image capture.
124  *
125  * \param [in,out] img Snap shot image taken.
126  * \param resImage Still image resolution. If equal to CamResDft, then
127  * the initial/last image resolution setting is used.
128  *
129  * \copydoc doc_return_std
130  */
131  virtual int clickImage(cv::Mat &img, const CamRes &resImage=CamResDft);
132 
133  /*!
134  * \brief Auto-focus camera.
135  */
136  virtual void autoFocus();
137 
138  protected:
139  ecam50 *m_eCam; ///< econ 5.0 MP camera
140  char m_bufTmpName[PATH_MAX]; ///< temporary file name buffer
141 
142  /*!
143  * \brief Set the camera resolution in either video or still image mode.
144  *
145  * \param res Target camera resolution.
146  *
147  * \return Actual resolution set.
148  */
149  virtual CamRes setCameraResolution(const CamRes &res);
150 
151  /*!
152  * \brief Make unique temporary file.
153  */
154  void makeTmpFile();
155  };
156 
157 } // namespace rnr
158 
159 #endif // defined(ARCH_overo)
160 
161 #endif // _RNR_CAMERA_ECON_50_H
const CamRes CamRes2592x1944
2592 x 1944 resolution
Definition: Camera.h:96
Video and still image camera base class.
const CamRes CamResDft
default resolution
Definition: Camera.h:89
OpenCv video and still image camera class.
const CamRes CamResQVGA
Quarter VGA 320 x 240 res.
Definition: Camera.h:90
RoadNarrows Robotics.
Definition: Camera.h:74
const CamRes CamResVGA
VGA 640 x 480 resolution.
Definition: Camera.h:91