Monday, July 31, 2017

Python opencv contour printing

http://docs.opencv.org/trunk/d4/d73/tutorial_py_contours_begin.html
https://stackoverflow.com/questions/22137511/python-opencv-drawcontours-does-not-show-anything

import numpy as np
import cv2
im = cv2.imread('/home//t.png') # full path

imgray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
ret, thresh = cv2.threshold(imgray, 127, 255, 0)
im2, contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
cv2.imshow("window title", im)
cv2.waitKey()



https://stackoverflow.com/questions/22137511/python-opencv-drawcontours-does-not-show-anything 

sudo apt-get install libgtk2.0-dev pkg-config



pip install opencv_python

# OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /io/opencv/modules/highgui/src/window.cpp, line 583

sudo apt-get install liblapacke-dev checkinstall

https://github.com/opencv/opencv/issues/8537

# Here the steps I make to make GUI functions work # Uninstalling OpenCV
sudo apt-get purge libopencv*
sudo dpkg -r opencv
# Check
sudo dpkg -r opencv


#Reinstall OpenCV after removing it
https://github.com/BVLC/caffe/wiki/OpenCV-3.2-Installation-Guide-on-Ubuntu-16.04


#Then, go to the build directory and
sudo make uninstall

#After, you can rebuild with this make command
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_V4L=ON -DWITH_QT=ON -DWITH_OPENGL=ON -DWITH_CUBLAS=ON -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" -DWITH_GDAL=ON -DWITH_XINE=ON -DBUILD_EXAMPLES=ON ..

# or  remove -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES"

cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_V4L=ON -DWITH_QT=ON -DWITH_OPENGL=ON -DWITH_CUBLAS=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DBUILD_EXAMPLES=ON ..
 
# And then, finally
sudo make install

The pages that guided me:
Uninstalling OpenCV
Installing OpenCV 3.2 on Ubuntu 16.04


 fatal error: LAPACKE_H_PATH-NOTFOUND/lapacke.h: No such file or directory
 #include "LAPACKE_H_PATH-NOTFOUND/lapacke.h"

http://answers.opencv.org/question/121651/fata-error-lapacke_h_path-notfound-when-building-opencv-32/








No comments:

Post a Comment