Search code examples
copencvyolodarknet

Demo needs OpenCV for webcam images.(opencv is installed and set opencv4=1)


I am trying to do object detection from a video file by using https://github.com/pjreddie/darknet. I've installed libopencv-dev for opencv. I've set opencv4=1 in Makefile.

And run this code. ./darknet detector demo cfg/coco.data cfg/yolo-tiny-obj.cfg yolov3.weights data/1.mp4 And got error Demo needs OpenCV for webcam images.

Could anyone help me? Thanks.


Solution

    1. Try to clean make file and recompile darknet
    make clean
    make
    
    1. You can load OpenCV from git and install sources
    git clone https://github.com/opencv/opencv
    cd opencv
    mkdir build
    cd build
    cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. 
    make -j7
    sudo make install
    

    And after recompile the darknet with

    make clean
    make