I'm trying to run the Facedetect sample using OpenCV, I compiled the code the build_all.sh file.
Then I ran the code with
sudo ./facedetect --cascade="../../data/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade="../../data/haarcascades/haarcascade_eye.xml" --scale=1.3 lena.jpg
A few instructions are displayed
This program demonstrates the cascade recognizer. Now you can use Haar or LBP features.
This classifier can recognize many kinds of rigid objects, once the appropriate classifier is trained.
It's most known use is for faces.
Usage:
./facedetect [--cascade=<cascade_path> this is the primary trained classifier such as frontal face]
[--nested-cascade[=nested_cascade_path this an optional secondary classifier such as eyes]]
[--scale=<image scale greater or equal to 1, try 1.3 for example>]
[--try-flip]
[filename|camera_index]
see facedetect.cmd for one call:
./facedetect --cascade="../../data/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade="../../data/haarcascades/haarcascade_eye.xml" --scale=1.3
During execution:
Hit any key to quit.
Using OpenCV version 2.4.8
Processing 1 --cascade=../../data/haarcascades/haarcascade_frontalface_alt.xml
from which we have cascadeName= ../../data/haarcascades/haarcascade_frontalface_alt.xml
Processing 2 --nested-cascade=../../data/haarcascades/haarcascade_eye.xml
Processing 3 --scale=1.3
from which we read scale = 1.3
Processing 4 lena.jpg
And in the end I get the following error:
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 cvNamedWindow, file /home/userk/Development/OpenCV/opencv-2.4.8/modules/highgui/src/window.cpp, line 483
terminate called after throwing an instance of 'cv::Exception'
what(): /home/userk/Development/OpenCV/opencv-2.4.8/modules/highgui/src/window.cpp:483: error: (-2) 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 function cvNamedWindow
The packages libgtk2.0-dev and pkg-config were already installed. Do you guys have any advice?
SOLVED:
As Berak suggested, I recompiled opencv from its main directory with:
cmake -D CMAKE_BUILD_TYPE=RELEASE ..
make
sudo make install
Related
I'm trying to use ECW files in my application. I've built GDAL Library whit this command:
./configure --with-ecw:/usr/local/hexagon
after completion of build process, when I Entered:
gdalinfo --formats | grep ECW
I got:
ECW -raster- (rw+): ERDAS Compressed Wavelets (SDK 5.5)
JP2ECW -raster,vector- (rw+v): ERDAS JPEG2000 (SDK 5.5)
also when I've used
gdalinfo map.ecw
it returns all metadata of ECW files.
but when I compile my C++ program, it returns:
Error: GDAL Dataset returned null from read
ERROR 4: `map.ecw' not recognized as a supported file format.
Dose anyone know why I can't use ECW files in C++ program?
By the way, I use
Cmake
,GDAL 3.3.0
,Erdas-ECW SDK 5.5 hexagon
for building the program.
I found the answer. This problem occurs if the gdal_bin binary package is installed before creating GDAL.
Just make sure gdal_bin is deleted before installing the version you created.
I am installing Caffe on Mac OS X 10.11 El Capitan, which somehow requires that I install OpenCV with libstdc++. To do so, I did "brew update opencv" and adding the following lines below "def install" as mentioned on the Caffe website (http://caffe.berkeleyvision.org/install_osx.html):
def install
# ADD THE FOLLOWING:
ENV.append "CXXFLAGS", "-stdlib=libstdc++"
ENV.append "CFLAGS", "-stdlib=libstdc++"
ENV.append "LDFLAGS", "-stdlib=libstdc++ -lstdc++"
# The following is necessary because libtool likes to strip LDFLAGS:
ENV["CXX"] = "/usr/bin/clang++ -stdlib=libstdc++"
...
However, when I go install it using "brew install --build-from-source -vd opencv", I get the following error:
cd /tmp/opencv-20170909-8122-1xa5qpl/opencv-3.3.0/build/modules/dnn &&
/usr/local/Cellar/cmake/3.9.2/bin/cmake -E cmake_symlink_library
../../lib/libopencv_dnn.3.3.0.dylib ../../lib/libopencv_dnn.3.3.dylib
../../lib/libopencv_dnn.dylib [ 59%] Built target opencv_dnn make: ***
[all] Error 2 /usr/local/Homebrew/Library/Homebrew/debrew.rb:11:in
`raise' BuildError: Failed executing: make
1. raise
2. ignore
3. backtrace
4. irb
5. shell Choose an action:
Anyone know how to solve this? Thank you in advance!
EDIT: Actually, I realized that my original opencv.rb file is producing the exact same problem. How do I fix/find an opencv.rb file that works?
It looks like he build you are going for in not compatible with the OS. If installing on Mac would suggest trying this method of implementation. It also uses homebrew but allows for a quick and simple implementation.
I have built the openCV 3.0 alpha version from source with support for CUDA and TBB. Now, I want to do feature detection and feature matching using SURF algorithm. SurfFeatureDetector is present in the include file
opencv2/nonfree/features2d.hpp & opencv2/nonfree/features2d.hpp
But the module nonfree is missing in this version of openCV. I tried checking the opencv forums at answers.opencv.org but the site is under construction.
How to use the non free modules?
with opencv3.0, SURF/SIFT and some other things have been moved to a seperate opencv_contrib repo .
you will have to download that, add it to your main opencv cmake settings (please look at the readme there), and rerun cmake/make.
then:
#include "opencv2/xfeatures2d.hpp"
...
Ptr<SIFT> sift = cv::xfeatures2d::SIFT::create(...);
sift->detect(...);
You could also install all the non-free stuff from this PPA
sudo add-apt-repository ppa:ignaciovizzo/opencv3-nonfree
sudo apt-get update
sudo apt install libopencv-dev
I'm trying to get django-wiki running.
It works well so far, except I can't display .jpeg images.
At first I had trouble when only importing jpeg files in the webapp.
I fixed this modifying setup.py of PIL's setup.py as follows:
JPEG_ROOT = libinclude("/usr/lib")
# Line 214
add_directory(library_dirs, "/usr/lib")
add_directory(library_dirs, "/usr/lib/x86_64-linux-gnu")
Jpeg libs I have currently installed:
libjpeg-progs
libjpeg62:amd64
libjpeg62-dev:amd64
libjpeg8:amd64
libopenjpeg2:amd64
After install PIL with pip install PIL, I get this output which doesn't look that bad, at least I thought so
*** TKINTER support not available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
*** FREETYPE2 support not available
*** LITTLECMS support not available
No error messages (and no "decoder ntót available") and I can view the images properly on my server, which means upload works great. But in the wiki only the file names are shown and when I click on them I get
"This image failed to load."
Could someone please help me? I can't find any error output (debug mode is activated).
Thanks in advance
You are compiling software! You need to install development libraries for these things to compile, e.g. apt-get install libjpeg-dev.
Also, install Pillow, it has less chances of failure to compile - pip install pillow.
I am trying to re-compile sox source with mp3 support on CentOS 5. Note sox-12.18.1-1.el5_5.1 has been installed on my CentOS machine for a while.
Following http://techblog.netwater.com/?p=4, I installed the following packages using yum.
yum install gcc-c++ libmad libmad-devel libid3tag libid3tag-devel lame lame-devel flac-devel libvorbis-devel make
./configure shows the following.
BUILD OPTIONS
Debugging build............no
Distro name ...............not specified!
Dynamic loading support....no
Pkg-config location........$(libdir)/pkgconfig
Play and rec symlinks......yes
Symlinks enabled...........yes
OPTIONAL DEVICE DRIVERS
ao (Xiph)..................no
alsa (Linux)...............no
coreaudio (Mac OS X).......no
sndio (OpenBSD)............no
oss........................yes
pulseaudio.................no
sunaudio...................no
OPTIONAL FILE FORMATS
amrnb......................no
amrwb......................no
ffmpeg.....................no
flac.......................yes
gsm........................yes (in-tree)
lpc10......................yes (in-tree)
mp3........................yes
id3tag....................yes
lame......................yes
dlopen lame...............no
mad.......................yes
dlopen mad................no
oggvorbis..................yes
sndfile....................no
wavpack....................no
OTHER OPTIONS
ladspa effects.............no
magic support..............yes
png support................no
GOMP support...............yes
But after executing "make && make install", issuing
sox test.mp3 tmp1.mp3 reverse
returns
sox: Failed reading test.mp3: Do not understand format type: mp3
What am I missing here? Thanks.
I had the same issue.
Make sure that there is no other Sox installed on the server:
yum remove sox
Next:
make uninstall
make clean
./configure
make
make install