Skip to content

Commit

Permalink
* add set_awb to config white balance
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed Jul 24, 2024
1 parent 794a0a0 commit b4d0f0c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
15 changes: 13 additions & 2 deletions components/vision/include/maix_camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,17 +338,28 @@ namespace maix::camera
int saturation(int value = -1);

/**
* Set/Get white balance mode
* Set/Get white balance mode (deprecated interface)
* @attention This method will affect the isp and thus the image, so please be careful with it.
* This interface may be deprecated in the future, and there may be incompatibilities in the definition of the parameters of the new interface
* @param value value = 0, means set white balance to auto mode, value = 1, means set white balance to manual mode, default is auto mode.
* @return returns awb mode
* @maixpy maix.camera.Camera.awb_mode
*/
int awb_mode(int value = -1);

/**
* Set/Get exposure mode
* Set/Get white balance mode
* @attention This method will affect the isp and thus the image, so please be careful with it.
* @param value value = 0, means set white balance to manual mode, value = 1, means set white balance to auto mode, default is auto mode.
* @return returns awb mode
* @maixpy maix.camera.Camera.set_awb
*/
int set_awb(int mode = -1);

/**
* Set/Get exposure mode (deprecated interface)
* @attention This method will affect the isp and thus the image, so please be careful with it.
* This interface may be deprecated in the future, and there may be incompatibilities in the definition of the parameters of the new interface
* @param value value = 0, means set exposure to auto mode, value = 1, means set exposure to manual mode, default is auto mode.
* @return returns exposure mode
* @maixpy maix.camera.Camera.exp_mode
Expand Down
5 changes: 5 additions & 0 deletions components/vision/port/linux/maix_camera_v4l2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,11 @@ namespace maix::camera
return -1;
}

int set_awb(int value)
{
return -1;
}

int exp_mode(int value)
{
return -1;
Expand Down
17 changes: 17 additions & 0 deletions components/vision/src/maix_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,23 @@ namespace maix::camera
return _impl->awb_mode(value);
}

int Camera::set_awb(int value) {
if (_impl == NULL)
return err::ERR_NOT_INIT;

if (!this->is_opened()) {
return err::ERR_NOT_OPEN;
}

if (value == 0) {
value = 1;
} else if (value > 0) {
value = 0;
}

return _impl->awb_mode(value) == 0 ? 1 : 0;
}

int Camera::exp_mode(int value) {
if (_impl == NULL)
return err::ERR_NOT_INIT;
Expand Down

0 comments on commit b4d0f0c

Please sign in to comment.