mirror of
https://github.com/sipeed/MaixCDK.git
synced 2026-11-09 17:04:38 -06:00
optimize image.compress func and fix lvgl build error
This commit is contained in:
2
components/3rd_party/lvgl/CMakeLists.txt
vendored
2
components/3rd_party/lvgl/CMakeLists.txt
vendored
@@ -1,5 +1,5 @@
|
||||
|
||||
set(version_str "${CONFIG_LVGL_VERSION_MAJOR}.${CONFIG_LVGL_VERSION_MAJOR}.${CONFIG_LVGL_VERSION_MAJOR}")
|
||||
set(version_str "${CONFIG_LVGL_VERSION_MAJOR}.${CONFIG_LVGL_VERSION_MINOR}.${CONFIG_LVGL_VERSION_PATCH}")
|
||||
set(unzip_dir_name "lvgl-${version_str}")
|
||||
|
||||
set(unzip_path "${DL_EXTRACTED_PATH}/lvgl_srcs/${unzip_dir_name}")
|
||||
|
||||
2
components/3rd_party/lvgl/component.py
vendored
2
components/3rd_party/lvgl/component.py
vendored
@@ -15,7 +15,7 @@ def add_file_downloads(confs : dict) -> list:
|
||||
path = f"lvgl_srcs/lvgl-{version}"
|
||||
check_file = 'lvgl'
|
||||
rename = {
|
||||
'lvgl-{version}': 'lvgl'
|
||||
f'lvgl-{version}': 'lvgl'
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
@@ -531,7 +531,7 @@ namespace maix::image
|
||||
image::Image *midpoint_pool(int x_div, int y_div, double bias = 0.5, bool copy = false);
|
||||
|
||||
/**
|
||||
* @brief JPEG compresses the image in place.
|
||||
* @brief JPEG compresses the image in place, the same as to_jpeg functioin, it's recommend to use to_jpeg instead.
|
||||
* @param quality The quality of the compressed image. default is 95.
|
||||
* @return Returns the compressed JPEG image
|
||||
* @maixpy maix.image.Image.compress
|
||||
|
||||
@@ -154,23 +154,7 @@ namespace maix::image {
|
||||
}
|
||||
|
||||
image::Image *Image::compress(int quality) {
|
||||
if (quality < 0) {
|
||||
log::warn("compress invalid quality: %d", quality);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
quality = quality > 100 ? 100 : quality;
|
||||
|
||||
cv::Mat img(_height, _width, CV_8UC((int)image::fmt_size[_format]), _data);
|
||||
std::vector<uchar> compressed;
|
||||
std::vector<int> params;
|
||||
params.push_back(cv::IMWRITE_JPEG_QUALITY);
|
||||
params.push_back(quality);
|
||||
cv::imencode(".jpg", img, compressed, params);
|
||||
|
||||
int dst_data_size = compressed.size();
|
||||
image::Image *dst = new image::Image(_width, _height, Format::FMT_JPEG, compressed.data(), dst_data_size, true);
|
||||
return dst;
|
||||
return to_jpeg(quality);
|
||||
}
|
||||
|
||||
err::Err image_zero(image::Image &src, image::Image &mask, bool invert) {
|
||||
|
||||
@@ -90,6 +90,8 @@ def find_valid_components(components):
|
||||
depends[name] = []
|
||||
for r in match:
|
||||
if r in components:
|
||||
if name == r:
|
||||
continue
|
||||
depends[name].append(r)
|
||||
# find main depends
|
||||
def get_depend_recursive(name):
|
||||
|
||||
Reference in New Issue
Block a user