OpenCV g++ compile

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

OpenCV g++ compile

2,135 次查看
HT_MOB
Contributor II

I got imx8mpevk and implemented imx-image-full on the board with Yocto rev.5.10.9_1.0.0.

I want to build tensorflow-lite with c ++, but I don't know how to link the opencv library with g++ options.

How do I compile the opencv library?

For example, on ubuntu, amd64
g++ -o <> .o <> .cpp `pkg-config opencv4 --libs --cflags`
If you command like, the compilation will succeed.

On the board, I found the opencv library in find in the following location:
/usr/lib/libopencv_core.so.4.4.0
/usr/lib/libopencv_imgproc.so.4.4.0

0 项奖励
回复
3 回复数

2,122 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello HT_MOB,

One alternative to using Tensorflow C++ API I found is to use cppflow.

It's a lightweight C++ wrapper around Tensorflow C API. You get very small executables and it links against the libtensorflow.so already compiled file. There are also examples of use and you use CMAKE instead of Bazel.

https://www.tensorflow.org/lite/api_docs/cc

 

Regards

 

0 项奖励
回复

2,113 次查看
HT_MOB
Contributor II

Hellow Bio_TICFSL.

I was able to compile the tensorflow library with c ++ on my host pc using the method you showed.

How do I deploy this compiled bin to imx8mpevk?

I copied the bin generated on the host pc to imx8mpevk and ran it, resulting in an error like this:

root @ imx8mpevk: ~ / source / tensolflow_test # ./main
-sh: ./main: cannot execute binary file: Exec format error

 

I think this error is due to an architectural difference.
I'm assuming you have a device cross-compilation environment, do you have one?

 

0 项奖励
回复

2,059 次查看
HT_MOB
Contributor II

Does anyone know the problem above?

0 项奖励
回复