Ask Your Question
0

[4.1.0-dev] Issue while compiling FaceDetection.cpp example

asked 2019-05-03 07:07:03 -0500

vr0um gravatar image

Hello,

I finally write my first topic after having tried to compile one of the cpp tutorials example without any success. This one exactly : https://docs.opencv.org/master/d4/d26...

I'm using cpp (GCC) 8.3.0 with cmake 3.14.3 on a 5.0.9-2-MANJARO x86_64.


1/So, I first met an issue concerning haarcascade_eye_tree_eyeglasses.xml and haarcascade_frontalface_alt.xml that were missing. After some searchs, I found a topic where it was written to download these files directly on the opencv github. https://github.com/opencv/opencv/tree...

2/ My folder tree looks like this :

.
├── CMakeLists.txt
├── data
│   └── haarcascades
│       ├── haarcascade_eye_tree_eyeglasses.xml
│       └── haarcascade_frontalface_alt.xml
├── FaceDetect.cpp
├── FaceDetection.cpp
└── Makefile

2 directories, 6 files

3/ my CmakeLists.txt looks like this :

$ cat CMakeLists.txt 
cmake_minimum_required(VERSION 2.8)
project( FaceDetection )
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( FaceDetection FaceDetection.cpp )
target_link_libraries( FaceDetection ${OpenCV_LIBS} )

4/ The output of cmake . looks good :

$ cmake .
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /usr/local (found version "4.1.0") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vr0um/cpp/opencv/FaceDetection

5/ Same for the output of make that looks like below :

$ make
Scanning dependencies of target FaceDetection
[ 50%] Building CXX object CMakeFiles/FaceDetection.dir/FaceDetection.cpp.o
[100%] Linking CXX executable FaceDetection
[100%] Built target FaceDetection

6/ I'm facing to an issue once I'm trying to execute the program :

$ ./FaceDetection 
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.1.0-dev) /home/vr0um/OpenCV/opencv/modules/core/src/persistence.cpp:719: error: (-49:Unknown error code -49) Input file is empty in function 'open'

Aborted (core dumped)

I've been looking for a solution for few weeks now and I still don't find how to solve it. I didn't find similar issue that has been solved on search engines. I don't understand what it means by saying "input file is empty in function 'open'.

Do someone know how I could fix the issue?

Thank you.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2019-05-04 04:05:51 -0500

berak gravatar image

updated 2019-05-04 04:09:47 -0500

to download these files directly on the opencv github.

that's probably the failure. the error clearly shows, that the file exists, but that it is empty (0 bytes)

please check your folder again, and to download files from github you need a raw url, not a (html) blob, like:

https://raw.githubusercontent.com/ope...

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-05-03 07:07:03 -0500

Seen: 118 times

Last updated: May 04 '19