Skip to content

Commit

Permalink
* fix image and camera bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed Aug 8, 2024
1 parent 3fd0701 commit 826eee2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions components/vision/include/maix_image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,11 +629,11 @@ namespace maix::image
* @param mask Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
* Only pixels set in the mask are modified. default is None.
* @param to_bitmap If true, the image will be converted to a bitmap image before thresholding. default is false. TODO: support in the feature
* @param copy Select whether to return a new image or modify the original image. default is true.
* @param copy Select whether to return a new image or modify the original image. default is false.
* @return Returns the image after the operation is completed.
* @maixpy maix.image.Image.binary
*/
image::Image *binary(std::vector<std::vector<int>> thresholds = std::vector<std::vector<int>>(), bool invert = false, bool zero = false, image::Image *mask = nullptr, bool to_bitmap = false, bool copy = true);
image::Image *binary(std::vector<std::vector<int>> thresholds = std::vector<std::vector<int>>(), bool invert = false, bool zero = false, image::Image *mask = nullptr, bool to_bitmap = false, bool copy = false);

/**
* @brief Inverts the image in place.
Expand Down
28 changes: 13 additions & 15 deletions components/vision/port/maixcam/maix_camera_mmf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,22 +229,20 @@ namespace maix::camera
_config_sensor_env(_fps);

// mmf init
if (!mmf_is_init()) {
mmf_sys_cfg_t sys_cfg = {0};
if (_width <= 1280 && _height <= 720 && _fps > 30) {
sys_cfg.vb_pool[0].size = 1280 * 720 * 3 / 2;
sys_cfg.vb_pool[0].count = 3;
sys_cfg.vb_pool[0].map = 2;
sys_cfg.max_pool_cnt = 1;
} else {
sys_cfg.vb_pool[0].size = 2560 * 1440 * 3 / 2;
sys_cfg.vb_pool[0].count = 2;
sys_cfg.vb_pool[0].map = 3;
sys_cfg.max_pool_cnt = 1;
}
mmf_pre_config_sys(&sys_cfg);
err::check_bool_raise(!mmf_init(), "mmf init failed");
mmf_sys_cfg_t sys_cfg = {0};
if (_width <= 1280 && _height <= 720 && _fps > 30) {
sys_cfg.vb_pool[0].size = 1280 * 720 * 3 / 2;
sys_cfg.vb_pool[0].count = 3;
sys_cfg.vb_pool[0].map = 2;
sys_cfg.max_pool_cnt = 1;
} else {
sys_cfg.vb_pool[0].size = 2560 * 1440 * 3 / 2;
sys_cfg.vb_pool[0].count = 2;
sys_cfg.vb_pool[0].map = 3;
sys_cfg.max_pool_cnt = 1;
}
mmf_pre_config_sys(&sys_cfg);
err::check_bool_raise(!mmf_init(), "mmf init failed");

mmf_vi_cfg_t cfg = {0};
cfg.w = _width;
Expand Down

0 comments on commit 826eee2

Please sign in to comment.