10 #include "ErrorBase.h"
13 #include "HAL/cpp/priority_mutex.h"
17 typedef enum whiteBalance_enum {
19 kFixedOutdoor1 = 4000,
20 kFixedOutdoor2 = 5000,
21 kFixedFluorescent1 = 5100,
22 kFixedFlourescent2 = 5200
27 static constexpr
char const *ATTR_WB_MODE =
28 "CameraAttributes::WhiteBalance::Mode";
29 static constexpr
char const *ATTR_WB_VALUE =
30 "CameraAttributes::WhiteBalance::Value";
31 static constexpr
char const *ATTR_EX_MODE =
32 "CameraAttributes::Exposure::Mode";
33 static constexpr
char const *ATTR_EX_VALUE =
34 "CameraAttributes::Exposure::Value";
35 static constexpr
char const *ATTR_BR_MODE =
36 "CameraAttributes::Brightness::Mode";
37 static constexpr
char const *ATTR_BR_VALUE =
38 "CameraAttributes::Brightness::Value";
41 static constexpr
char const* AUTO =
"Auto";
42 static constexpr
char const* MANUAL =
"Manual";
45 IMAQdxSession m_id = 0;
48 bool m_active =
false;
53 unsigned int m_width = 320;
54 unsigned int m_height = 240;
56 std::string m_whiteBalance = AUTO;
57 unsigned int m_whiteBalanceValue = 0;
58 bool m_whiteBalanceValuePresent =
false;
59 std::string m_exposure = MANUAL;
60 unsigned int m_exposureValue = 50;
61 bool m_exposureValuePresent =
false;
62 unsigned int m_brightness = 80;
63 bool m_needSettingsUpdate =
true;
65 unsigned int GetJpegSize(
void *buffer,
unsigned int buffSize);
68 static constexpr
char const *kDefaultCameraName =
"cam0";
70 USBCamera(std::string name,
bool useJpeg);
76 void SetFPS(
double fps);
77 void SetSize(
unsigned int width,
unsigned int height);
79 void UpdateSettings();
120 void GetImage(Image *image);
121 unsigned int GetImageData(
void *buffer,
unsigned int bufferSize);
void SetExposureAuto()
Set the exposure to auto exposure.
Definition: USBCamera.cpp:278
void SetExposureHoldCurrent()
Set the exposure to hold current.
Definition: USBCamera.cpp:286
void SetWhiteBalanceHoldCurrent()
Set the white balance to hold current.
Definition: USBCamera.cpp:262
void SetBrightness(unsigned int brightness)
Set the brightness, as a percentage (0-100).
Definition: USBCamera.cpp:241
unsigned int GetJpegSize(void *buffer, unsigned int buffSize)
Helper function to determine the size of a jpeg.
Definition: USBCamera.cpp:36
void SetWhiteBalanceManual(unsigned int wbValue)
Set the white balance to manual, with specified color temperature.
Definition: USBCamera.cpp:270
Definition: priority_mutex.h:22
Base class for most objects.
Definition: ErrorBase.h:66
void SetWhiteBalanceAuto()
Set the white balance to auto.
Definition: USBCamera.cpp:254
unsigned int GetBrightness()
Get the brightness, as a percentage (0-100).
Definition: USBCamera.cpp:249
Definition: USBCamera.h:25
void SetExposureManual(unsigned int expValue)
Set the exposure to manual, with a given percentage (0-100)
Definition: USBCamera.cpp:294