Programming/openCV2021. 1. 14. 17:23

오랫만에 빌드하니 다 까먹었네 -_ㅠ

 

g++ myprog.cpp -lopencv_core -lopencv_imgproc -lopencv_videoio -lopencv_highgui -lopencv_objdetect -o myprog

[링크 : https://answers.opencv.org/question/165673]

 

 

아놔.. 에러 뿜뿜 -_-

/usr/bin/ld: warning: libopencv_imgproc.so.3.4, needed by //usr/local/lib/libopencv_dnn.so, may conflict with libopencv_imgproc.so.3.2
/usr/bin/ld: warning: libopencv_core.so.3.4, needed by //usr/local/lib/libopencv_dnn.so, may conflict with libopencv_core.so.3.2
/usr/bin/ld: /tmp/cc64nD60.o: undefined reference to symbol '_ZNK2cv3Mat5emptyEv'
/usr/bin/ld: //usr/local/lib/libopencv_core.so.3.4: error adding symbols: DSO missing from command line

 

+

아무튼 라즈베리 3B 에서 하는데

3.2.0이 설치되어 있고, 필요에 의해서 3.4.0을 빌드해서 설치했더니 3.2.0과 섞여서 난리가 났다.

그래서 -L 옵션을 통해 3.4.0이 설치된 곳을 우선적으로 보도록 해주니 문제없이 해결!

$ whereis libopencv_imgproc
libopencv_imgproc: /usr/lib/arm-linux-gnueabihf/libopencv_imgproc.so /usr/lib/arm-linux-gnueabihf/libopencv_imgproc.a /usr/local/lib/libopencv_imgproc.so

$ ls -al /usr/local/lib/libopencv_imgproc.so*
lrwxrwxrwx 1 root root      24 Jan 14 08:04 /usr/local/lib/libopencv_imgproc.so -> libopencv_imgproc.so.3.4
lrwxrwxrwx 1 root root      27 Jan 14 08:04 /usr/local/lib/libopencv_imgproc.so.3.4 -> libopencv_imgproc.so.3.4.13
-rw-r--r-- 1 root root 3292320 Jan 14 05:01 /usr/local/lib/libopencv_imgproc.so.3.4.13

$ ls -al /usr/lib/arm-linux-gnueabihf/libopencv_imgproc.so
lrwxrwxrwx 1 root root 24 Feb 12  2019 /usr/lib/arm-linux-gnueabihf/libopencv_imgproc.so -> libopencv_imgproc.so.3.2

$ g++ opencv_video.cpp -lopencv_core -lopencv_dnn -lopencv_imgproc -lopencv_videoio -lopencv_highgui -lopencv_objdetect -lopencv_imgcodecs -L/usr/local/lib

 

 

 

 

MobileNet-SSD의 ssd_detect.cpp 빌드하려다가

아 몰라 대충 흑화중.. 후...

sudo apt-get install libcaffe-cpu-dev libcaffe-cpu1 libboost-all-dev libgflags-dev libgoogle-glog-dev libprotobuf-dev libopenblas-dev

$ g++ ssd_detect.cpp -lopencv_core -lopencv_dnn -lopencv_imgproc -lopencv_videoio -lopencv_highgui -lopencv_objdetect -lopencv_imgcodecs -L/usr/local/lib -o ssd_detect
ssd_detect.cpp:15:10: fatal error: caffe/caffe.hpp: No such file or directory
 #include <caffe/caffe.hpp>
          ^~~~~~~~~~~~~~~~~
compilation terminated.
pi@raspberrypi:~/src/MobileNet-SSD $ g++ ssd_detect.cpp -lopencv_core -lopencv_dnn -lopencv_imgproc -lopencv_videoio -lopencv_highgui -lopencv_objdetect -lopencv_imgcodecs -L/usr/local/lib -o ssd_detect
In file included from /usr/include/caffe/blob.hpp:8,
                 from /usr/include/caffe/caffe.hpp:7,
                 from ssd_detect.cpp:15:
/usr/include/caffe/common.hpp:4:10: fatal error: boost/shared_ptr.hpp: No such file or directory
 #include <boost/shared_ptr.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

pi@raspberrypi:~/src/MobileNet-SSD $ g++ ssd_detect.cpp -lopencv_core -lopencv_dnn -lopencv_imgproc -lopencv_videoio -lopencv_highgui -lopencv_objdetect -lopencv_imgcodecs -L/usr/local/lib -o ssd_detect
In file included from /usr/include/caffe/blob.hpp:8,
                 from /usr/include/caffe/caffe.hpp:7,
                 from ssd_detect.cpp:15:
/usr/include/caffe/common.hpp:5:10: fatal error: gflags/gflags.h: No such file or directory
 #include <gflags/gflags.h>
          ^~~~~~~~~~~~~~~~~
compilation terminated.
$ g++ ssd_detect.cpp -lopencv_core -lopencv_dnn -lopencv_imgproc -lopencv_videoio -lopencv_highgui -lopencv_objdetect -lopencv_imgcodecs -L/usr/local/lib -o ssd_detect
In file included from /usr/include/caffe/common.hpp:19,
                 from /usr/include/caffe/blob.hpp:8,
                 from /usr/include/caffe/caffe.hpp:7,
                 from ssd_detect.cpp:15:
/usr/include/caffe/util/device_alternate.hpp:34:10: fatal error: cublas_v2.h: No such file or directory
 #include <cublas_v2.h>
          ^~~~~~~~~~~~~
compilation terminated.

-DCPU_ONLY


 $ g++ ssd_detect.cpp -lopencv_core -lopencv_dnn -lopencv_imgproc -lopencv_videoio -lopencv_highgui -lopencv_objdetect -lopencv_imgcodecs -L/usr/local/lib -o ssd_detect -DCPU_ONLY
In file included from /usr/include/caffe/util/math_functions.hpp:11,
                 from /usr/include/caffe/filler.hpp:13,
                 from /usr/include/caffe/caffe.hpp:9,
                 from ssd_detect.cpp:15:
/usr/include/caffe/util/mkl_alternate.hpp:14:10: fatal error: cblas.h: No such file or directory
 #include <cblas.h>
          ^~~~~~~~~
compilation terminated.

$ g++ ssd_detect.cpp -lopencv_core -lopencv_dnn -lopencv_imgproc -lopencv_videoio -lopencv_highgui -lopencv_objdetect -lopencv_imgcodecs -L/usr/local/lib -o ssd_detect -DCPU_ONLY -lcaffe
/usr/bin/ld: /tmp/ccDNrn3i.o: undefined reference to symbol '_ZN6google4base21CheckOpMessageBuilder7ForVar2Ev'
/usr/bin/ld: //lib/arm-linux-gnueabihf/libglog.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status


$ g++ ssd_detect.cpp -lopencv_core -lopencv_dnn -lopencv_imgproc -lopencv_videoio -lopencv_highgui -lopencv_objdetect -lopencv_imgcodecs -L/usr/local/lib -o ssd_detect -DCPU_ONLY -lcaffe -lglog
/usr/bin/ld: /tmp/ccO8VjqT.o: undefined reference to symbol '_ZN6google26ShowUsageWithFlagsRestrictEPKcS1_'
/usr/bin/ld: //lib/arm-linux-gnueabihf/libgflags.so.2.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status




$ g++ ssd_detect.cpp -lopencv_core -lopencv_dnn -lopencv_imgproc -lopencv_videoio -lopencv_highgui -lopencv_objdetect -lopencv_imgcodecs -L/usr/local/lib -o ssd_detect -DCPU_ONLY -lcaffe -lgflags -lglog
/usr/bin/ld: warning: libopencv_imgcodecs.so.3.2, needed by /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/libcaffe.so, may conflict with libopencv_imgcodecs.so.3.4
/usr/bin/ld: warning: libopencv_imgproc.so.3.2, needed by /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/libcaffe.so, may conflict with libopencv_imgproc.so.3.4
/usr/bin/ld: warning: libopencv_core.so.3.2, needed by /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/libcaffe.so, may conflict with libopencv_core.so.3.4

 

 

caffe 빌드

위에 lib들 설치하고 아래것 추가로 설치

sudo apt-get install protobuf-compiler libhdf5-dev liblmdb-dev libleveldb-dev libatlas-base-dev python-numpy

 

sudo apt-get install protobuf-compiler

[링크 : https://stackoverflow.com/questions/46698260/could-not-find-protobuf-compiler]

 

sudo apt-get install libhdf5-dev

[링크 : https://github.com/jcjohnson/torch-rnn/issues/121]

 

sudo apt-get install liblmdb-dev

[링크 : https://caffe.berkeleyvision.org/install_apt.html]

 

Could NOT find LevelDB

sudo apt-get install libleveldb-dev

 

Could NOT find Atlas

sudo apt-get install libatlas-base-dev

 

Could NOT find NumPy

sudo apt-get install python-numpy

[링크 : https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/306]

 

'Programming > openCV' 카테고리의 다른 글

cv2.imshow cv2.waitKey  (0) 2022.03.14
virtual mouse  (0) 2022.01.25
opencv face detect  (0) 2019.05.10
vscode python3 opencv lint  (0) 2019.05.10
opencv cannyedge  (0) 2019.01.16
Posted by 구차니

python 안쓰고 c++ 만으로 해보려는데

tensorflow / rosrun 등이 필요함

mobilenet ssd
tensorflow /c++/python
catkin_make

[링크 : https://github.com/haosen9527/mobileNet-ssd]

 

빌드는 독립적으로 되는데 caffe를 먼저 빌드는 해야 함..

caffe를 빌드하는데 openCV-3.4.0 이상을 요구하고 있음..

Also it may help the beginners to build a project using cmake. You don't need to build this within the caffe root. But remember you should compile caffe first.

[링크 : https://github.com/MediosZ/MobileNet-SSD]

 

+

python으로 된 가장 원본 파일?

[링크 : https://github.com/chuanqi305/MobileNet-SSD]

 

+

tensorflow lite 버전과 openCV-4.1.0 이상 버전 요구?

[링크 : https://github.com/finnickniu/tensorflow_object_detection_tflite]

 

+

rpi 2b에서 텐서가 되는지 모르겠네?

[링크 : https://www.tensorflow.org/install/source_rpi?hl=ko]

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tensorflow-lite 모델  (0) 2021.01.18
tensorflow-lite minimal.cc 실행  (0) 2021.01.18
caffe  (0) 2021.01.14
darknet detect  (0) 2021.01.11
CNN convolution과 maxpool  (0) 2021.01.10
Posted by 구차니

 

[링크 : https://caffe.berkeleyvision.org/]

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tensorflow-lite minimal.cc 실행  (0) 2021.01.18
mobileNET/SSD  (0) 2021.01.14
darknet detect  (0) 2021.01.11
CNN convolution과 maxpool  (0) 2021.01.10
CNN과 RNN  (0) 2021.01.09
Posted by 구차니
embeded/ARM2021. 1. 13. 14:47

라즈베리파이 내장(?) arm-arm 컴파일러

$ gcc --version 
gcc (Raspbian 8.3.0-6+rpi1) 8.3.0 
Copyright (C) 2018 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions.  There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[링크 : https://gcc.gnu.org/gcc-8/]

 

i.mx6 용 크로스컴파일러

$ arm-linux-gcc --version 
arm-linux-gcc.br_real (Buildroot 2018.02.5-gee769a6) 6.4.0 
Copyright (C) 2017 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions.  There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[링크 : https://gcc.gnu.org/gcc-6/]

 

시기적으로 크게 차이나는건 아니지만 상위 버전이 6.x와 8.x 차이로 커서 arm neon 관련 지원이 다른걸려나?

[링크 : https://gcc.gnu.org/releases.html]

 

+

gcc changelog 를 뒤져도 아직 발견은 못했는데...

6.x 와 8.x 의 NEON 지원에 무슨 차이가 있는게 아닐까 혹은 vertorized 관련 옵션 구현에 차이가 있나 생각이 든다.

i.mx6용으로 빌드하니 neon 옵션줘도 성능 향상이 없었는데

라즈베리용으로 빌드하니 i.mx6에서 돌릴때 성능 향상이 발생했다.

'embeded > ARM' 카테고리의 다른 글

ARMv9 SVE2  (0) 2021.05.15
cortex-a9 하드웨어 Divider가 없어?!  (0) 2021.03.18
vfp  (0) 2021.01.13
NEON 강제활성화?  (0) 2021.01.12
softfp와 hardfp  (0) 2020.12.10
Posted by 구차니
embeded/ARM2021. 1. 13. 13:48

vfp

뒤에 붙는 D32 D16 F16은 다시 자세히 보니

Double / Float 와 몇개의 레지스터를 가지나 숫자를 표현한 듯?

 

VFPv1
Obsolete
VFPv2
An optional extension to the ARM instruction set in the ARMv5TE, ARMv5TEJ and ARMv6 architectures. VFPv2 has 16 64bit FPU registers.
VFPv3 or VFPv3-D32
Implemented on most Cortex-A8 and A9 ARMv7 processors. It is backwards compatible with VFPv2, except that it cannot trap floating-point exceptions. VFPv3 has 32 64bit FPU registers as standard, adds VCVT instructions to convert between scalar, float and double, adds immediate mode to VMOV such that constants can be loaded into FPU registers.
VFPv3-D16
As above, but with only 16 64-bit FPU registers. Implemented on Cortex-R4 and R5 processors and the Tegra 2 (Cortex-A9).
VFPv3-F16
Uncommon; it supports IEEE754-2008 half-precision (16-bit) floating point as a storage format.
VFPv4 or VFPv4-D32
Implemented on Cortex-A12 and A15 ARMv7 processors, Cortex-A7 optionally has VFPv4-D32 in the case of an FPU with Neon.[110] VFPv4 has 32 64-bit FPU registers as standard, adds both half-precision support as a storage format and fused multiply-accumulate instructions to the features of VFPv3.
VFPv4-D16
As above, but it has only 16 64-bit FPU registers. Implemented on Cortex-A5 and A7 processors in the case of an FPU without Neon.[110]
VFPv5-D16-M
Implemented on Cortex-M7 when single and double-precision floating-point core option exists.

[링크 : https://en.wikipedia.org/wiki/ARM_architecture]

[링크 : https://wiki.debian.org/ArmHardFloatPort/VfpComparison]

 

+

 

[링크 : https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/arm-cortex-a-processors-and-gcc-command-lines]

'embeded > ARM' 카테고리의 다른 글

cortex-a9 하드웨어 Divider가 없어?!  (0) 2021.03.18
gcc 버전 차이?  (0) 2021.01.13
NEON 강제활성화?  (0) 2021.01.12
softfp와 hardfp  (0) 2020.12.10
ampere altra  (0) 2020.11.23
Posted by 구차니
embeded/ARM2021. 1. 12. 17:09

 

[리읔: https://developer.arm.com/documentation/dui0472/i/compiler-coding-practices/enabling-neon-and-fpu-for-bare-metal]

'embeded > ARM' 카테고리의 다른 글

gcc 버전 차이?  (0) 2021.01.13
vfp  (0) 2021.01.13
softfp와 hardfp  (0) 2020.12.10
ampere altra  (0) 2020.11.23
arm cl  (0) 2020.10.29
Posted by 구차니
Linux2021. 1. 12. 16:19

-l 옵션에서 상세하게 적으면 되긴한데...

libc 처럼 so.0 숫자는 같은데 내부 버전이 다를 경우는 어떻게 해야하려나?

반대로.. 붙이려는 원하는 so가 존재한다면 그 파일도 있어야 빌드가 가능하다는 건가?

Instead of using "-lcurl" use "-l:libcurl.so.3" And ofcourse also use "-L _installed_path_"

[링크 : https://stackoverflow.com/questions/828053/how-do-you-link-to-a-specific-version-of-a-shared-library-in-gcc]

[링크 : https://www.xspdf.com/resolution/20065096.html]

'Linux' 카테고리의 다른 글

linux 프레임 버퍼에 이미지, 동영상 재생하기  (0) 2021.01.21
sit1 인터페이스  (0) 2021.01.20
libc static build 하기  (0) 2021.01.12
segmentation fault, bus error  (0) 2021.01.08
linux ip 와 gateway 설정  (0) 2021.01.08
Posted by 구차니
Linux2021. 1. 12. 16:14

원하는 것만 static하게 하는 법을 좀 더 찾아 봐야겠네

LDFLAGS = -static

[링크 : https://stackoverflow.com/questions/2856438/how-can-i-link-to-a-specific-glibc-version]

 

+

[링크 : https://xspdf.com/resolution/50038879.html]

'Linux' 카테고리의 다른 글

sit1 인터페이스  (0) 2021.01.20
특정 버전의 파일로 링크걸어서 빌드하기  (0) 2021.01.12
segmentation fault, bus error  (0) 2021.01.08
linux ip 와 gateway 설정  (0) 2021.01.08
udev  (0) 2021.01.05
Posted by 구차니
개소리 왈왈/블로그2021. 1. 11. 21:09

두 페이지 정도 밀렸는데 언제 정리 하냐 ㅠㅠ

'개소리 왈왈 > 블로그' 카테고리의 다른 글

남의 돈으로 기분내는 기부  (2) 2021.03.25
크크큭 흑화된다?  (0) 2021.03.24
블로그 휴식  (0) 2020.12.18
방문자가 점점 줄어드네 ㅠㅠ  (2) 2020.10.28
오랫만에 해피빈 기부  (0) 2020.10.28
Posted by 구차니
embeded2021. 1. 11. 16:07

uboot 용으로 받아둔거긴 하지만 pthread를 미지원 한다는건

리눅스 커널 상에서만 pthread를 지원하기 때문인가?

그래서 uboot 에서는 커널에서 도는게 아니기에 pthread를 지원할 수 없는 건가?

 

[링크 : https://nancom.tistory.com/177]

'embeded' 카테고리의 다른 글

중고 부품 지름  (0) 2025.01.06
i.mx6quad용 gcc 옵션  (0) 2021.01.08
orange pi r1+  (0) 2021.01.08
i.mx6 solo 비디오 성능 문제?  (0) 2020.10.19
간만에 부품 지름  (2) 2020.03.04
Posted by 구차니