Giter Site home page Giter Site logo

paddlepaddle / flycv Goto Github PK

View Code? Open in Web Editor NEW
566.0 566.0 57.0 28.77 MB

FlyCV is a high-performance library for processing computer visual tasks.

License: Apache License 2.0

CMake 1.36% C++ 85.88% C 11.90% Python 0.49% Shell 0.26% JavaScript 0.11%
arm assembly avx compute-vision computer-vision cv flycv high-performance image-processing lightweight neon opencv paddlepaddle sse

flycv's People

Contributors

fakeflyman avatar hcms1994 avatar henry-liuyinghan avatar kkwork00 avatar litonghui avatar oodream avatar raindrops2sea avatar sdcb avatar skycreatexian avatar tomasran avatar triple-mu avatar voidsalts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flycv's Issues

There are 2 problems with the "extract_channel" interface

  1. first
    opencv设计该函数的时候没有用引用: void cv::extractChannel(InputArray _src, OutputArray _dst, int coi)
    flyCV的定义是 FCV_API int extract_channel(Mat& src,Mat& dst, int index);
    问题,下面写法会报错:error: undefined reference to 'fcv::extract_channel(fcv::Mat&, fcv::Mat, int)'
    g_fcv_ns::extract_channel(preimg, g_fcv_ns::Mat(cols, rows,g_fcv_ns::FCVImageType::GRAY_F32,data +i * rows * cols), i);

  2. Second
    目前只支持u8类型,导致只支持int8模型,flyCV的巨大威力被卡脖子了。

windows编译必须先编译静态库才能编译动态库

如果先编译动态库:

mkdir build
cd build
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./Release -DBUILD_SHARED_LIBS=ON -DBUILD_TEST=OFF -DWITH_LIB_PNG=ON -DWITH_LIB_JPEG_TURBO=ON -DBUILD_C=ON
ninja all

则会报如下错:

C:\_\code\FlyCV\build>ninja all
ninja: error: 'third_party/libjpeg-turbo/output/lib/turbojpeg-static.lib', needed by 'modules/flycv_shared.dll', missing and no known rule to make it

必须先编译静态库:

C:\_\code\FlyCV\build>cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./Release -DBUILD_SHARED_LIBS=OFF -DBUILD_TEST=OFF -DWITH_LIB_PNG=ON -DWITH_LIB_JPEG_TURBO=ON -DBUILD_C=ON
ninja all

静态库编译成功之后,才能正常编译动态库。

flycv与opencv同时读图,opencv读图失败,数据为空

测试环境:台式ubuntu20.04,opencv3.4.14,flycv1.0.0
效果:fcv和opencv各自注释掉对方,独立的运行没问题,但是一起执行,opencv读图失败,图像数据为空

测试参考代码:
#include
#include <opencv2/opencv.hpp>
#include <dirent.h>
#include "flycv.h"
#include "pthread.h"
void calc_param(float& ratio, float& dww, float& dhh, int org_width, int org_height, int new_width, int new_hieght,
bool is_auto, bool scale_fill, bool scale_up, int stride) {
float r = std::min(new_width * 1.0 / org_width, new_hieght * 1.0 / org_height);
if (!scale_up)
r = std::min(r, float(1.0));

// ratio_w_ = r;
// ratio_h_ = r;
ratio = r;
int new_unpad_w_ = int(org_width * r);
int new_unpad_h_ = int(org_height * r);
int dw = new_width - new_unpad_w_;
int dh = new_hieght - new_unpad_h_;
if (is_auto) {
dw = dw % stride;
dh = dh % stride;
} else if (scale_fill) {
dw = 0, dh = 0;
new_unpad_w_ = new_width;
new_unpad_h_ = new_hieght;
float ratio_w_ = new_width * 1.0 / org_width;
float ratio_h_ = new_hieght * 1.0 / org_height;
}
// dw_ = dw / 2.0;
// dh_ = dh / 2.0;
dww = dw / 2.0;
dhh = dh / 2.0;
}
int main(int argc, char** argv) {

// // fcv的处理
fcv::Mat src_fcv = fcv::imread("../100.jpg");
std::cout << src_fcv.width() << " " << src_fcv.height() << std::endl;
float ratio_fcv, dww_fcv, dhh_fcv;
calc_param(ratio_fcv, dww_fcv, dhh_fcv, src_fcv.width(), src_fcv.height(), 640, 640, false, false, true, 2);
fcv::Mat resize_im_fcv;
double r_fcv = ratio_fcv;
fcv::resize(src_fcv, resize_im_fcv, fcv::Size(), r_fcv, r_fcv);
fcv::Mat padding_img_fcv;
int top_fcv = int(round(dhh_fcv - 0.1));
int bottom_fcv = int(round(dhh_fcv + 0.1));
int left_fcv = int(round(dww_fcv - 0.1));
int right_fcv = int(round(dww_fcv + 0.1));
fcv::Scalar color_fcv(114, 114, 114);
fcv::copy_make_border(resize_im_fcv, padding_img_fcv, top_fcv, bottom_fcv, left_fcv, right_fcv, fcv::BorderType::BORDER_CONSTANT, color_fcv);
fcv::imwrite("padding_img_fcv.jpg", padding_img_fcv);

// //opencv的处理
cv::Mat src_cv = cv::imread("../200.jpg");
std::cout << src_cv.cols << "  " << src_cv.rows << std::endl;
float ratio, dww, dhh;
calc_param(ratio, dww, dhh, src_cv.cols, src_cv.rows, 640, 640, false, false, true, 2);
cv::Mat resize_im_cv;
cv::resize(src_cv, resize_im_cv, cv::Size(), ratio, ratio);
cv::Mat padding_img_cv;
int top = int(round(dhh - 0.1));
int bottom = int(round(dhh + 0.1));
int left = int(round(dww - 0.1));
int right = int(round(dww + 0.1));
cv::Scalar color_cv(114, 114, 114);
cv::copyMakeBorder(resize_im_cv, padding_img_cv, top, bottom, left, right, cv::BORDER_CONSTANT, color_cv);
cv::imwrite("padding_img_cv.jpg", padding_img_cv);
return 0;

}

-DWITH_LIB_PNG在Windows下无法编译

环境:VS2022
命令行:

cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./Release -DBUILD_SHARED_LIBS=ON -DBUILD_TEST=OFF -DWITH_LIB_PNG=ON -DWITH_LIB_JPEG_TURBO=ON
ninja all

报错信息:

C:\_\3rd\FlyCV\build>ninja all
[1/88] Performing install step for 'zlib'
[0/1] Install the project...
-- Install configuration: "Release"
-- Installing: C:/_/3rd/FlyCV/build/third_party/zlib/output/lib/zlib.lib
-- Installing: C:/_/3rd/FlyCV/build/third_party/zlib/output/bin/zlib.dll
-- Installing: C:/_/3rd/FlyCV/build/third_party/zlib/output/lib/zlibstatic.lib
-- Installing: C:/_/3rd/FlyCV/build/third_party/zlib/output/include/zconf.h
-- Installing: C:/_/3rd/FlyCV/build/third_party/zlib/output/include/zlib.h
-- Installing: C:/_/3rd/FlyCV/build/third_party/zlib/output/share/man/man3/zlib.3
-- Installing: C:/_/3rd/FlyCV/build/third_party/zlib/output/share/pkgconfig/zlib.pc
[2/88] Performing install step for 'libjpeg-turbo'
[0/1] Install the project...
-- Install configuration: "Release"
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/lib/turbojpeg-static.lib
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/bin/tjbench.exe
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/include/turbojpeg.h
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/lib/jpeg-static.lib
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/bin/cjpeg.exe
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/bin/djpeg.exe
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/bin/jpegtran.exe
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/bin/rdjpgcom.exe
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/bin/wrjpgcom.exe
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/share/doc/libjpeg-turbo/README.ijg
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/share/doc/libjpeg-turbo/README.md
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/share/doc/libjpeg-turbo/example.txt
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/share/doc/libjpeg-turbo/tjexample.c
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/share/doc/libjpeg-turbo/libjpeg.txt
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/share/doc/libjpeg-turbo/structure.txt
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/share/doc/libjpeg-turbo/usage.txt
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/share/doc/libjpeg-turbo/wizard.txt
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/share/doc/libjpeg-turbo/LICENSE.md
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/lib/pkgconfig/libjpeg.pc
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/lib/pkgconfig/libturbojpeg.pc
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/lib/cmake/libjpeg-turbo/libjpeg-turboConfig.cmake
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/lib/cmake/libjpeg-turbo/libjpeg-turboConfigVersion.cmake
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/lib/cmake/libjpeg-turbo/libjpeg-turboTargets.cmake
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/lib/cmake/libjpeg-turbo/libjpeg-turboTargets-release.cmake
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/include/jconfig.h
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/include/jerror.h
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/include/jmorecfg.h
-- Installing: C:/_/3rd/FlyCV/build/third_party/libjpeg-turbo/output/include/jpeglib.h
[4/88] Performing build step for 'libpng'
FAILED: third_party/libpng/stamp/libpng-build C:/_/3rd/FlyCV/build/third_party/libpng/stamp/libpng-build
cmd.exe /C "cd /D C:\_\3rd\FlyCV\build\third_party\libpng && "C:\Program Files\CMake\bin\cmake.exe" --build . && "C:\Program Files\CMake\bin\cmake.exe" -E touch C:/_/3rd/FlyCV/build/third_party/libpng/stamp/libpng-build"
[1/24] Generating pnglibconf.out
FAILED: pnglibconf.out C:/_/3rd/FlyCV/build/third_party/libpng/pnglibconf.out
cmd.exe /C "cd /D C:\_\3rd\FlyCV\build\third_party\libpng && "C:\Program Files\CMake\bin\cmake.exe" -DINPUT=C:/_/3rd/FlyCV/build/third_party/libpng/pnglibconf.c -DOUTPUT=C:/_/3rd/FlyCV/build/third_party/libpng/pnglibconf.out -P C:/_/3rd/FlyCV/build/third_party/libpng/scripts/genout.cmake"
鐢ㄤ簬 x64 鐨?Microsoft (R) C/C++ 浼樺寲缂栬瘧鍣?19.34.31935 鐗?
鐗堟潈鎵€鏈?C) Microsoft Corporation銆備繚鐣欐墍鏈夋潈鍒┿€?

pnglibconf.c
C:/_/3rd/FlyCV/build/third_party/libpng/pnglibconf.c(34): fatal error C1083: 鏃犳硶鎵撳紑鍖呮嫭鏂囦欢: 鈥渮lib.h鈥? No such file or directory
CMake Error at scripts/genout.cmake:78 (message):
  Failed to generate
  C:/_/3rd/FlyCV/build/third_party/libpng/pnglibconf.out.tf1


ninja: build stopped: subcommand failed.
[5/88] Completed 'libjpeg-turbo'
ninja: build stopped: subcommand failed.

单独拎出来报错信息:

C:\_\3rd\FlyCV\build>cmd.exe /C "cd /D C:\_\3rd\FlyCV\build\third_party\libpng && "C:\Program Files\CMake\bin\cmake.exe" -DINPUT=C:/_/3rd/FlyCV/build/third_party/libpng/pnglibconf.c -DOUTPUT=C:/_/3rd/FlyCV/build/third_party/libpng/pnglibconf.out -P C:/_/3rd/FlyCV/build/third_party/libpng/scripts/genout.cmake"
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.34.31935 版
版权所有(C) Microsoft Corporation。保留所有权利。

pnglibconf.c
C:/_/3rd/FlyCV/build/third_party/libpng/pnglibconf.c(34): fatal error C1083: 无法打开包括文件: “zlib.h”: No such file or directory
CMake Error at scripts/genout.cmake:78 (message):
  Failed to generate
  C:/_/3rd/FlyCV/build/third_party/libpng/pnglibconf.out.tf1



C:\_\3rd\FlyCV\build>

armlinux编译报错

ARM LINUX 交叉编译报错,shuffle应改为:_shuffle,修改后正常

FlyCV-develop/modules/img_transform/color_convert/src/color_convert_arm.cpp:3515:26: error: ‘shuffle’ was not declare
d in this scope
:"r"(shuffle)

FlyCV-develop/modules/img_transform/color_convert/src/color_convert_arm.cpp:3515:26: note: suggested alternative: ‘_s
huffle’
:"r"(shuffle)
~~~~~~
_shuffle

画图函数失效

flycv版本:flycv-v1.0.0-android.tar
平台:展锐T610 CPU armv7
复现步骤:读取本地图片,然后调用画图函数,最后保存画图后的数据,保存的图片上没有画图结果

参考代码:
std::string raw_img_path = "/sdcard/Android/data/com.baidu.paddle.lite.demo.ssd_detection/cache/raw.jpg";
fcv::Mat raw_img = fcv::imread(raw_img_path);
fcv::circle(raw_img,fcv::Point(500,500),100,fcv::Scalar(0,0,100),2);

std::string res_img_path = "/sdcard/Android/data/com.baidu.paddle.lite.demo.ssd_detection/cache/raw_res.jpg";
fcv::imwrite(res_img_path, raw_img);

绘图方法

请问一下,flycv有没有类似于putText方法,在图像上绘制文字,并且支持中文的

什么时候python能用

什么时候python能用

直接 pip install FlyCV

这样就可以替换opencv

另外可以增加读取摄像头 读取视频文件的
图像处理 增加 裁剪

建议提供只有C API导出的构建选项

目前如果使用-DBUILD_C=ON,可以构建C API的导出,但是同时也存在所有的C++ API的导出,这在利用C API的使用场景中(如C#或go语言封装、C API做其它功能等)是完全没有必要的,还会偏离FlyCV“小巧精致”、“高订制化”的初心。

我建议提供只有C API导出的构建选项(或者将-DBUILD_C=ON改为仅编译C API),在这个选项中,完全不需要C++的函数导出。

image

多线程稳定崩溃

开发者您好:

我在使用flycv代码替换opencv实现数据预处理函数时发现,若同时开多个推理线程(包括预处理、推理和后处理),替换flycv后的代码在flycv线程池部分稳定发生崩溃,只有在预处理函数前后加入线程锁才能稳定运行。但opencv不论开几个线程都不会发生这样的现象。烦请排查。
还想请教一下目前imdecode是否无法读取大于4000像素的图片,提示不支持的格式。

armlinux交叉编译报错

/install/flycv/lib/libflycv_shared.so: undefined reference to `std::thread::_State::~_State()@GLIBCXX_3.4.22'
/install/flycv/lib/libflycv_shared.so: undefined reference to `typeinfo for std::thread::_State@GLIBCXX_3.4.22'
/install/flycv/lib/libflycv_shared.so: undefined reference to `std::thread::_M_start_thread(std::unique_ptr\<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())@GLIBCXX_3.4.22'

X86平台下编译报错

编译分支:v1.2.0
编译环境: X86 Linux
编译器:gcc (GCC) 7.4.0

使用指令:
cmake
-DBUILD_TEST=OFF
-DBUILD_BENCHMARK=OFF
-DCMAKE_INSTALL_PREFIX=${build_dir}/install
-DWITH_LIB_PNG=ON
-DWITH_LIB_JPEG_TURBO=ON
-DCMAKE_BUILD_TYPE=Release
-DENABLE_AVX=ON
..
make -j32
编译报错:
/world/FlyCV/modules/core/base/include/common_avx.h: In member function ‘void fcv::Vld3_F32x8_Avx::load(const float*, __m256i*, __m256i*, __m256i*)’:
/home/chenjunpin/world/FlyCV/modules/core/base/include/common_avx.h:366:25: error: ‘_mm256_loadu2_m128i’ was not declared in this scope
__m256i bgr_0 = _mm256_loadu2_m128i((__m128i const*)(src_f32 + 12), (__m128i const*)(src_f32 + 0));
^~~~~~~~~~~~~~~~~~~
/world/FlyCV/modules/core/base/include/common_avx.h:366:25: note: suggested alternative: ‘_mm256_loadu_si256’
__m256i bgr_0 = _mm256_loadu2_m128i((__m128i const*)(src_f32 + 12), (__m128i const*)(src_f32 + 0));

1、使用 gcc -march=native -E -v - </dev/null 2>&1 | grep avx 查看GCC支持,确认编译器支持-mavx -mavx2
2、请问是否是因为GCC版本不一致的原因导致报错?

ThreadPool线程个数

请教下为什么线程池仅设置线程个数为1或者2?难道不应该是cpu核数吗?
ThreadPool::ThreadPool() : _active_wait(10000) { _thread_num = get_cpu_num() > 1 ? 2 : 1; }

请问编译armhf需要什么依赖库呢

[ 19%] Completed 'zlib'
[ 19%] Built target zlib
[ 20%] Linking CXX static library libbenchmark.a
[ 20%] Built target benchmark
[ 21%] Linking CXX static library ../../../lib/libgtest.a
[ 21%] Built target gtest
make: *** [all] Error 2
[ 0%] Performing build step for 'libjpeg-turbo'
make[3]: *** No targets specified and no makefile found. Stop.
make[2]: *** [third_party/libjpeg-turbo/stamp/libjpeg-turbo-build] Error 2
make[1]: *** [CMakeFiles/libjpeg-turbo.dir/all] Error 2
make: *** [all] Error 2
出现了上面问题是要单独手动安装吗

fcv::crop函数

  • lycv版本:flycv-v1.0.0-android.tar
  • 平台:展锐T610 CPU armv7
  • 复现步骤:读取本地图片,然后在A函数中调用fcv::crop函数,最后在B函数中调用A函数,编译可以过,但是链接出错

#include "flycv.h"

void A(fcv::Mat& src_img,fcv::Mat& dst_img){
fcv::crop(src_img, dst_img, fcv::RectI(0,0,100,100));
}
int main(){
std::string raw_img_path = "/sdcard/Android/data/com.baidu.paddle.lite.demo.ssd_detection/cache/raw.jpg";
fcv::Mat raw_img = fcv::imread(raw_img_path);

fsv::dst_img;
A(raw_img,dst_img);

}

  • 现象:注释掉A函数中的fcv::crop,能够成功编译运行或者在main函数中不调用也能成功编译运行
  • 输出错误信息:
    error: undefined reference to 'fcv::crop(fcv::Mat&, fcv::Mat&, fcv::Rect_)'

当前如何实现对灰度图的normalize

normalize_to_submean_to_reorder只能对三通道图使用,看了下加减乘除或者convertTo暂时没有实现,请问目前有没有办法实现对灰度图的normalize呢?

CVT_PA_BGR2PA_RGB不生效

测试代码段
fcv::Mat dst;
fcv::Mat src = fcv::imread("user.jpg");
for (int i = 0; i < 20; ++i)
{
unsigned char* p = (unsigned char*)src.data();
int a = p[i];
std::cout << a << " ";
}
std::cout << std::endl;
std::cout << "**" <<std::endl;
fcv::cvt_color(src, src, fcv::ColorConvertType::CVT_PA_BGR2PA_RGB);
for (int i = 0; i < 20; ++i)
{
unsigned char
p = (unsigned char
)src.data();
int a = p[i];
std::cout << a << " ";
}

输出结果:
65 71 48 66 72 49 66 71 50 65 70 49 64 69 48 67 72 51 70 76


65 71 48 66 72 49 66 71 50 65 70 49 64 69 48 67 72 51 70 76

有3个C API导出名称风格规范不一致

注意到有3个C API导出名称不一致:
分别是:

  • get_cpu_num
  • get_thread_num
  • set_thread_num

image

应该使用整体的规范,比如:

  • fcvGetCpuNum
  • fcvGetThreadNum
  • fcvSetThreadNum

建议更具体一些的名字,比如:

  • fcvGetPhysicalThreadCount
  • fcvGetLogicalThreadCount
  • fcvSetThreadPoolThreadCount

poly_lines 线条颜色怎么指定?

int poly_lines(Mat& img,
const Point2l* v,
int count,
bool is_closed,
const void* color,
int thickness,
LineType line_type,
int shift);
函数中颜色是const void*类型,这个函数是不是还没有开发完呢?

编译时第三方依赖libturbo-jpeg/libpng/zlib等在Windows环境无法下载

这几个第三方依赖无法自动下载,但可以手动下载,我觉得可以优化一下,怀疑可能和这下bash有关:
image

这个问题可以通过手动下载第三方依赖来避过去:

cd third_party
git clone --progress --depth=1 -b 2.1.4 [email protected]:libjpeg-turbo/libjpeg-turbo.git libjpeg-turbo
git clone --progress --depth=1 -b libpng16 [email protected]:glennrp/libpng.git libpng
git clone --progress --depth=1 -b v1.2.9 [email protected]:madler/zlib.git zlib
git clone --progress --depth=1 -b release-1.12.1 [email protected]:google/googletest.git gtest
git clone --progress --depth=1 -b v1.6.1 [email protected]:google/benchmark.git benchmark

建议优化fcv_download_dependency,避免在Windows环境有一些不太方便或明确的依赖。

fcv::imread解码png图片

平台ARM64 版本V1.1.0

1.1.0文档中说明了解图仅支持JPEG;
链接libpng,发现png解出来的是RGB。。。是不是加转下BGR比较好?

fcv::imwrite("xxx.jpg", mat)时图片过大

平台架构:ARM64
版本:v1.1.0

预编译版和自行编译都试过了。
发现写JPEG图片的时候,体积非常大...比raw data还大?

JPEG filesize=16,812,032 bytes
raw data size=2048*1365*3=8,386,560 bytes

#include <flycv.h>

#include <fstream>
#include <iostream>
#include <opencv2/opencv.hpp>
#include <string>

int main(int argc, char **argv) {
  if (argc < 2) {
    fprintf(stderr, "Usage: %s <img-path>\n", argv[0]);
    exit(1);
  }
  std::string image_path = argv[1];

  cv::Mat cv_img = cv::imread(image_path);
  int width = cv_img.cols;
  int height = cv_img.rows;
  int channels = cv_img.channels();
  printf("image width=%d, height=%d, channels=%d\n", width, height, channels);
  cv::imwrite("cv.jpg", cv_img);

  fcv::Mat fcv_img(width, height, fcv::FCVImageType::PKG_BGR_U8);
  memcpy(fcv_img.data(), cv_img.data, width * height * channels * sizeof(uint8_t));
  fcv::imwrite("fcv.jpg", fcv_img);

  return 0;
}

截图:

Snipaste_2023-04-06_20-17-29

所用图片:

test

flycv 支持 vs插件ImageWatch吗?

请问flycv 支持 vs插件ImageWatch吗,能支持这个很重要,调试方便? 或者,opencv 的mat 可以和flycv的mat互相转换也行.

cvt_color 转换格式 bgr2yuv

平台: ARM64
版本: release/v1.1.0

 fcv::Mat fcv_img = fcv::imread(image_path);
  printf("image width=%d, height=%d, channels=%d\n", fcv_img.width(), fcv_img.height(),
         fcv_img.channels());

  int padding_h = (fcv_img.height() + 1) / 2 * 2 - fcv_img.height();
  int padding_w = (fcv_img.width() + 1) / 2 * 2 - fcv_img.width();
  fcv::copy_make_border(fcv_img, fcv_img, 0, padding_h, 0, padding_w,
                        fcv::BorderType::BORDER_CONSTANT, fcv::Scalar(114, 114, 114));

  fcv::Mat fcv_yuv_img;
  fcv::cvt_color(fcv_img, fcv_yuv_img, fcv::ColorConvertType::CVT_PA_BGR2NV21);
  printf("yuv image width=%d, height=%d, channels=%d\n", fcv_yuv_img.width(), fcv_yuv_img.height(),
         fcv_yuv_img.channels());

跑到 padding 的时候会崩掉:gdb

Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
image width=2048, height=1365, channels=3

Program received signal SIGSEGV, Segmentation fault.
__memcpy_generic () at ../sysdeps/aarch64/multiarch/../memcpy.S:185
185     ../sysdeps/aarch64/multiarch/../memcpy.S: No such file or directory.
(gdb) bt
#0  __memcpy_generic () at ../sysdeps/aarch64/multiarch/../memcpy.S:185
#1  0x0000000000415b58 in fcv::copy_make_border_common(fcv::Mat&, fcv::Mat&, int, int, int, int, fcv::BorderType, fcv::Scalar_<double> const&)
    ()
#2  0x0000000000414394 in fcv::copy_make_border(fcv::Mat&, fcv::Mat&, int, int, int, int, fcv::BorderType, fcv::Scalar_<double> const&) ()
#3  0x0000000000405dec in MiniPadding (img=...) at /home/work/AtlasProjects/MaiAtlas/flycv_test/convert_test.cpp:23
#4  0x0000000000405f18 in main (argc=3, argv=0xfffffffff038) at /home/work/AtlasProjects/MaiAtlas/flycv_test/convert_test.cpp:40

另外,有时候会崩在cvt_color处
w=2048, h=1365
padding成功
w=2048, h=1366

Thread 1 "test" received signal SIGSEGV, Segmentation fault.
_int_malloc (av=av@entry=0xfffeff8e3a70 <main_arena>, bytes=bytes@entry=638400) at malloc.c:3924
3924    malloc.c: No such file or directory.
(gdb) bt
#0  _int_malloc (av=av@entry=0xfffeff8e3a70 <main_arena>, bytes=bytes@entry=638400) at malloc.c:3924
#1  0x0000fffeff807444 in __GI___libc_malloc (bytes=638400) at malloc.c:3075
#2  0x000000000065e720 in fcv::cpu_allocator::cpu_allocator(unsigned long) ()
#3  0x000000000065e284 in fcv::get_allocator_from_platform(unsigned long, fcv::PlatformType, int) ()
#4  0x000000000064ce68 in fcv::Mat::Mat(int, int, fcv::FCVImageType, int, fcv::PlatformType) ()
#5  0x000000000064d7ac in fcv::cvt_color(fcv::Mat const&, fcv::Mat&, fcv::ColorConvertType) ()

test

QNX交叉编译报错

QNX交叉编译报错
imgcodecs.cpp 函数 strcasecmp未定义,需添加<string.h>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.