最近我在ubuntu 16.04机器上安装了opencv(我已经做过很多次了,并且可以正常使用)。我尝试编译yolo程序,它编译正常并运行正常。当我在Makefile中设置OPENCV = 1时,它将使用opencv编译程序。要设置编译和链接标志,它具有这两行。
LDFLAGS+= `pkg-config --libs opencv` -lstdc++
COMMON+= `pkg-config --cflags opencv`
我的pkg-config命令正常工作。请参见下面的输出。
ckim@chan-ubuntu:~/YOLOV2/darknet$ pkg-config --cflags opencv
-I/home/ckim/opencv_install/installation/OpenCV-3.4/include/opencv -I/home/ckim/opencv_install/installation/OpenCV-3.4/include
ckim@chan-ubuntu:~/YOLOV2/darknet$ pkg-config --libs opencv
-L/home/ckim/opencv_install/installation/OpenCV-3.4/lib -lopencv_stitching -lopencv_videostab -lopencv_superres -lopencv_surface_matching -lopencv_dnn_objdetect -lopencv_line_descriptor -lopencv_aruco -lopencv_img_hash -lopencv_xobjdetect -lopencv_dpm -lopencv_freetype -lopencv_stereo -lopencv_face -lopencv_objdetect -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_saliency -lopencv_hfs -lopencv_ccalib -lopencv_tracking -lopencv_datasets -lopencv_plot -lopencv_optflow -lopencv_ximgproc -lopencv_fuzzy -lopencv_bioinspired -lopencv_highgui -lopencv_videoio -lopencv_text -lopencv_dnn -lopencv_reg -lopencv_hdf -lopencv_bgsegm -lopencv_rgbd -lopencv_sfm -lopencv_xfeatures2d -lopencv_calib3d -lopencv_shape -lopencv_imgcodecs -lopencv_features2d -lopencv_video -lopencv_ml -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core
几天前,我尝试编译在网页上找到的简单opencv pgrogram并尝试对其进行编译。 (希望测试基本显示窗口的行为)。该程序就是这样。非常典型)
#include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream> using namespace cv; using namespace std; int main( int argc, char** argv ) { if( argc != 2) { cout <<" Usage: display_image ImageToLoadAndDisplay" << endl; return -1; } Mat image; image = imread(argv[1], CV_LOAD_IMAGE_COLOR); // Read the file if(! image.data ) // Check for invalid input { cout << "Could not open or find the image" << std::endl ; return -1; } namedWindow( "Display window", WINDOW_AUTOSIZE );// Create a window for display. imshow( "Display window", image ); // Show our image inside it. waitKey(1); // Wait for a keystroke in the window return 0; }
当我编译并与命令链接时
gcc -c test.cpp `pkg-config --cflags opencv` `pkg-config --libs opencv` -o test
它没有给我任何错误,我看到了文件
test
,但它不是可执行文件。设置chmod +x test
后运行它,我得到
ckim@chan-ubuntu:~/opencvtest$ ./test bash: ./test: cannot execute binary file: Exec format error ckim@chan-ubuntu:~/opencvtest$ file test test: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
可能有什么问题?
最近我在ubuntu 16.04机器上安装了opencv(我已经做过很多次了,并且可以正常使用)。我尝试编译yolo程序,它编译正常并运行正常。当我在Makefile中设置OPENCV = 1时,...
根据注释,您是命令行...