'Programming/openCV'에 해당되는 글 52건

  1. 2022.01.25 virtual mouse
  2. 2021.01.14 opencv-3.4.0 어플리케이션 빌드
  3. 2019.05.10 opencv face detect
  4. 2019.05.10 vscode python3 opencv lint
  5. 2019.01.16 opencv cannyedge
  6. 2019.01.16 opencv 원 추정
  7. 2018.04.25 OpenCV 분산처리
  8. 2018.03.19 openCV release mode와 debug mode 속도 차이
  9. 2018.03.19 openCV multicore support
  10. 2016.07.18 stitch / opencv / python
Programming/openCV2022. 1. 25. 18:11

키즈카페에 있는 빔 프로젝터 + 카메라 식으로

카메라를 통해 사람을 인식하고 사람의 영역을 인식해 마우스 이벤트로 혹은

영역을 선택해 해당 영역의 객체를 터트리는 식으로 구현해볼까 고민중..

 

[링크 : https://pythonrepo.com/repo/HxnDev-Virtual-Mouse-using-OpenCV-python-computer-vision]

[링크 : https://thecodacus.com/posts/2021-12-14-gesture-recognition-virtual-mouse-using-opencv/]

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

virtual mouse  (0) 2022.01.25
opencv-3.4.0 어플리케이션 빌드  (0) 2021.01.14
opencv face detect  (0) 2019.05.10
vscode python3 opencv lint  (0) 2019.05.10
opencv cannyedge  (0) 2019.01.16
opencv 원 추정  (0) 2019.01.16
Posted by 구차니

댓글을 달아 주세요

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' 카테고리의 다른 글

virtual mouse  (0) 2022.01.25
opencv-3.4.0 어플리케이션 빌드  (0) 2021.01.14
opencv face detect  (0) 2019.05.10
vscode python3 opencv lint  (0) 2019.05.10
opencv cannyedge  (0) 2019.01.16
opencv 원 추정  (0) 2019.01.16
Posted by 구차니

댓글을 달아 주세요

Programming/openCV2019. 5. 10. 19:17

 

 

import cv2

 

dirname = '/home/user/.local/lib/python3.6/site-packages/cv2/data/'

 

face_cascade = cv2.CascadeClassifier(dirname + 'haarcascade_frontalface_default.xml')

eye_cascade = cv2.CascadeClassifier(dirname + 'haarcascade_eye.xml')

 

cam = cv2.VideoCapture(0)

cam.set(3, 160) # CV_CAP_PROP_FRAME_WIDTH

cam.set(4, 120) # CV_CAP_PROP_FRAME_HEIGHT

cam.set(5, 60) # CV_CAP_PROP_FPS

print(cam.get(3))

print(cam.get(4))

print(cam.get(5))

 

while True:

ret_val, img = cam.read()

gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

 

faces = face_cascade.detectMultiScale(gray, 1.3, 5)

print(faces)

for (x, y, w, h) in faces:

img = cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)

roi_gray = gray[y:y+h, x:x+w]

roi_color = img[y:y+h, x:x+w]

eyes = eye_cascade.detectMultiScale(roi_gray)

for (ex, ey, ew, eh) in eyes:

cv2.rectangle(roi_color, (ex, ey), (ex+ew, ey+eh), (0, 255, 0), 2)

 

cv2.imshow("Cam Viewer", img)

cv2.imshow("Cam Viewer gray", gray)

if cv2.waitKey(1) == 27:

break

 

[링크 : https://opencv-python-tutroals.readthedocs.io/.../py_face_detection/py_face_detection.html]

[링크 : https://stackoverflow.com/questions/30508922/error-215-empty-in-function-detectmultiscale]

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

virtual mouse  (0) 2022.01.25
opencv-3.4.0 어플리케이션 빌드  (0) 2021.01.14
opencv face detect  (0) 2019.05.10
vscode python3 opencv lint  (0) 2019.05.10
opencv cannyedge  (0) 2019.01.16
opencv 원 추정  (0) 2019.01.16
Posted by 구차니

댓글을 달아 주세요

Programming/openCV2019. 5. 10. 19:05

 

{

"python.linting.pylintArgs": ["--extension-pkg-whitelist=cv2"]

}

[ : https://github.com/Microsoft/vscode-python/issues/2879]

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

opencv-3.4.0 어플리케이션 빌드  (0) 2021.01.14
opencv face detect  (0) 2019.05.10
vscode python3 opencv lint  (0) 2019.05.10
opencv cannyedge  (0) 2019.01.16
opencv 원 추정  (0) 2019.01.16
OpenCV 분산처리  (0) 2018.04.25
Posted by 구차니

댓글을 달아 주세요

Programming/openCV2019. 1. 16. 19:13

cv2.Canny() 함수 사용법


[링크 : https://docs.opencv.org/3.1.0/da/d22/tutorial_py_canny.html]

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

opencv face detect  (0) 2019.05.10
vscode python3 opencv lint  (0) 2019.05.10
opencv cannyedge  (0) 2019.01.16
opencv 원 추정  (0) 2019.01.16
OpenCV 분산처리  (0) 2018.04.25
openCV release mode와 debug mode 속도 차이  (0) 2018.03.19
Posted by 구차니

댓글을 달아 주세요

Programming/openCV2019. 1. 16. 19:10


[링크 : https://docs.opencv.org/2.4/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.html]

[링크 : https://kr.mathworks.com/help/images/ref/imfindcircles.html]


[링크 : https://code.i-harness.com/ko-kr/q/96763b]

[링크 : http://k-imagineer.tistory.com/7]

[링크 : https://dreamaz.tistory.com/431]

[링크 : https://docs.opencv.org/3.4.1/.../group__imgproc__feature.html#ga47849c3be0d0406ad3ca45db65a25d2d]

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

vscode python3 opencv lint  (0) 2019.05.10
opencv cannyedge  (0) 2019.01.16
opencv 원 추정  (0) 2019.01.16
OpenCV 분산처리  (0) 2018.04.25
openCV release mode와 debug mode 속도 차이  (0) 2018.03.19
openCV multicore support  (0) 2018.03.19
Posted by 구차니

댓글을 달아 주세요

Programming/openCV2018. 4. 25. 08:44

Odroid U3를 두개 묶어 놓다 보니 든 생각..

한대에서 영상 두개를 받고(USB로)

그 이미지중 하나(그러니까 사람으로 치면 오른눈-오른눈잡이)를 본인이 처리하고

다른쪽 영상 하나를 다른 시스템으로 넘겨서 처리하거나


아니면 각각 하나의 영상을 받아서

처리 결과만 다른쪽으로 넘겨주면 어떨까?


적고 보니 후자가 더 안정적일 수도 있겠네


[링크 : http://pachyderm.readthedocs.io/en/latest/getting_started/beginner_tutorial.html]

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

opencv cannyedge  (0) 2019.01.16
opencv 원 추정  (0) 2019.01.16
OpenCV 분산처리  (0) 2018.04.25
openCV release mode와 debug mode 속도 차이  (0) 2018.03.19
openCV multicore support  (0) 2018.03.19
stitch / opencv / python  (0) 2016.07.18
Posted by 구차니

댓글을 달아 주세요

Programming/openCV2018. 3. 19. 10:38

각종 최적화랑 ASSERT 문으로 인해 속도 저하가 극심하니

릴리즈로 해라.. 정도?


[링크 : https://stackoverflow.com/.../opencv-slow-camera-framerate]

[링크 : https://stackoverflow.com/.../why-is-this-code-running-over-100-times-slower-in-debug-mode-than-release]

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

opencv 원 추정  (0) 2019.01.16
OpenCV 분산처리  (0) 2018.04.25
openCV release mode와 debug mode 속도 차이  (0) 2018.03.19
openCV multicore support  (0) 2018.03.19
stitch / opencv / python  (0) 2016.07.18
opencv stitch  (0) 2016.07.14
Posted by 구차니

댓글을 달아 주세요

Programming/openCV2018. 3. 19. 10:38

openCV 2.4.6.1

intel TBB에서 openMP로 변환하여 라이브러리 빌드

[링크 : https://iamsrijon.wordpress.com/.../how-to-compile-opencv-to-utilize-multiple-core-processor-in-linux/]


라즈베리도 TBB에서 openMP로..

[링크 : https://stackoverflow.com/questions/28938644/opencv-multi-core-support]


openCV 3.4.1

얘도 머.. TBB

[링크 : https://docs.opencv.org/trunk/d7/dff/tutorial_how_to_use_OpenCV_parallel_for_.html]

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

OpenCV 분산처리  (0) 2018.04.25
openCV release mode와 debug mode 속도 차이  (0) 2018.03.19
openCV multicore support  (0) 2018.03.19
stitch / opencv / python  (0) 2016.07.18
opencv stitch  (0) 2016.07.14
opencv rtsp  (0) 2016.07.13
Posted by 구차니

댓글을 달아 주세요

Programming/openCV2016. 7. 18. 19:01

라즈베리에서 돌릴려고 하니 이미지가 큰지 segmentation fault가 뜨네 ㅠㅠ



소스는 해당 링크에서 다운로드..

클래스는 소스가 웹상에 없으니 이메일 써주고 받는게 속 편함

[링크 : http://www.pyimagesearch.com/2016/01/11/opencv-panorama-stitching/]



ImportError: No module named cv2

요런 에러 뜨면 패키지가 덜 설치 된거니 추가 설치 필요함


$ sudo apt-get install libopencv-dev python-opencv

[링크 : http://raspberrypi.stackexchange.com/questions/29148/python-cannot-import-opencv-module]

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

openCV release mode와 debug mode 속도 차이  (0) 2018.03.19
openCV multicore support  (0) 2018.03.19
stitch / opencv / python  (0) 2016.07.18
opencv stitch  (0) 2016.07.14
opencv rtsp  (0) 2016.07.13
openMP + openCV 실패한 이유가..  (0) 2015.11.27
Posted by 구차니

댓글을 달아 주세요