21 #include <opencv2/core/core.hpp>
25 #define CAMERA_GROUP ("camera")
26 #define CAMERA_NUM_CHANNELS_KEY ("num_channels")
27 #define CAMERA_CHANNEL_GROUP_PREFIX ("channel_")
28 #define CAMERA_CHANNEL_TYPE_KEY ("type")
30 #define CAMERA_CHANNEL_TYPE_HSV_KEY ("hsv")
31 #define CAMERA_CHANNEL_TYPE_QR_KEY ("qr")
57 const char *
data()
const;
80 virtual void update(
const cv::Mat &image) = 0;
91 static void setImage(
const cv::Mat &image);
96 static std::map<std::string, ChannelImpl *> m_channelImpls;
106 const ObjectVector *
objects()
const;
117 mutable ObjectVector m_objects;
119 mutable bool m_valid;
130 static std::string
path(
const std::string &name = std::string());
136 static std::string s_path;
153 unsigned width()
const;
160 const ChannelPtrVector &
channels()
const;
167 const unsigned char *
bgr()
const;
171 bool initCapDevice(
const unsigned width,
const unsigned height);
173 cv::Mat decodeJpeg(
void *p,
int size);
174 int xioctl(
int fh,
int request,
void *arg);
180 struct buffer *buffers;
181 unsigned int nBuffers;
185 ChannelPtrVector m_channels;
187 unsigned char *m_bmpBuffer;
189 mutable unsigned char *m_bgr;
190 mutable unsigned m_bgrSize;
193 static const char *device_name;
194 cv::VideoCapture *m_cap;
Camera::Device * cDevice()
void setHeight(const unsigned height)
void setConfig(const Config &config)
virtual ObjectVector findObjects(const Config &config)=0
Definition: camera.hpp:139
ObjectVector objects(const Config &config)
const char * data() const
static void setDefaultConfigPath(const std::string &name)
static std::string extension()
const size_t dataLength() const
Definition: camera.hpp:33
const ChannelPtrVector & channels() const
std::vector< Object > ObjectVector
Definition: camera.hpp:68
static ChannelImpl * channelImpl(const std::string &name)
void setWidth(const unsigned width)
void setImage(const cv::Mat &image)
Definition: config.hpp:16
const cv::Mat & rawImage() const
Definition: camera.hpp:38
static void setBasePath(const std::string &path)
Definition: camera.hpp:124
virtual void update(const cv::Mat &image)=0
static std::string path(const std::string &name=std::string())
std::vector< Channel * > ChannelPtrVector
Definition: camera.hpp:122
void setConfig(const Config &config)
Model
Definition: camera.h:39
Resolution
Definition: camera.h:31
Definition: camera.hpp:99
static std::string defaultPath()
const Config & config() const
const ObjectVector * objects() const
static void setImage(const cv::Mat &image)
static std::string defaultConfigPath()
const double confidence() const
static unsigned int resolutionToHeight(Resolution res)
Definition: camera.hpp:70
Definition: camera.hpp:88
Definition: camera.hpp:42
const unsigned char * bgr() const
const Point2< unsigned > & centroid() const
static unsigned int resolutionToWidth(Resolution res)
const Rect< unsigned > & boundingBox() const
Object(const Point2< unsigned > ¢roid, const Rect< unsigned > &boundingBox, const double confidence, const char *data=0, const size_t &dataLength=0)
bool open(const int number=0, Resolution resolution=LOW_RES, Model model=WHITE_2016)
Channel(Device *device, const Config &config)