dkurt / hair_segmentation

Hair recoloring on RISC-V with OpenCV
11 stars 0 forks source link

hello,i want to ask question #1

Open dragonforward opened 11 months ago

dragonforward commented 11 months ago

I want to compile an opencv static library for the riscv64 architecture, using the cross-compilation tool chain Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.0-rc3. When I compile, I want to call videocapture function and imshow function, but after compiling, it can not be found, I cross-compile the dependency library "\n" "General configuration for OpenCV 4.5.4-dev =====================================\n" " Version control: unknown\n" "\n" " Platform:\n" " Timestamp: 2023-10-23T07:05:03Z\n" " Host: Linux 5.15.90.1-microsoft-standard-WSL2 x86_64\n" " Target: Linux riscv64\n" " CMake: 3.25.2\n" " CMake generator: Unix Makefiles\n" " CMake build tool: /usr/bin/make\n" " Configuration: Release\n" "\n" " CPU/HW features:\n" " Baseline:\n" " requested: RVV\n" " Dispatched code generation:\n" " requested: RVV\n" "\n" " C/C++:\n" " Built as dynamic libs?: NO\n" " C++ standard: 11\n" " C++ Compiler: /root/opencv_hat/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.0-rc3/bin/riscv64-unknown-linux-gnu-g++ (ver 10.4.0)\n" " C++ flags (Release): -static -march=rv64imafdcxtheadc -mabi=lp64d -mtune=c920 -O3 -Wl,-whole-archive -lpthread -Wl,-no-whole-archive -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG\n" " C++ flags (Debug): -static -march=rv64imafdcxtheadc -mabi=lp64d -mtune=c920 -O3 -Wl,-whole-archive -lpthread -Wl,-no-whole-archive -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -DDEBUG -D_DEBUG\n" " C Compiler: /root/opencv_hat/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.0-rc3/bin/riscv64-unknown-linux-gnu-gcc\n" " C flags (Release): -static -march=rv64imafdcxtheadc -mabi=lp64d -mtune=c920 -O3 -Wl,-whole-archive -lpthread -Wl,-no-whole-archive -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG\n" " C flags (Debug): -static -march=rv64imafdcxtheadc -mabi=lp64d -mtune=c920 -O3 -Wl,-whole-archive -lpthread -Wl,-no-whole-archive -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -DDEBUG -D_DEBUG\n" " Linker flags (Release): -Wl,--gc-sections -Wl,--as-needed \n" " Linker flags (Debug): -Wl,--gc-sections -Wl,--as-needed \n" " ccache: NO\n" " Precompiled headers: NO\n" " Extra dependencies: /root/opencv_hat/OpenCV/build/3rdparty/lib/libcsi_cv.a dl m pthread rt\n" " 3rdparty dependencies: libprotobuf ade libjpeg-turbo libwebp libpng libtiff libopenjp2 zlib quirc\n" "\n" " OpenCV modules:\n" " To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo stitching ts video videoio\n" " Disabled: world\n" " Disabled by dependency: -\n" " Unavailable: java python2 python3\n" " Applications: tests perf_tests apps\n" " Documentation: NO\n" " Non-free algorithms: NO\n" "\n" " GUI: NONE\n" " GTK+: NO\n" "\n" " Media I/O: \n" " ZLib: build (ver 1.2.11)\n" " JPEG: libjpeg-turbo (ver 2.1.0-62)\n" " WEBP: build (ver encoder: 0x020f)\n" " PNG: build (ver 1.6.37)\n" " TIFF: build (ver 42 - 4.2.0)\n" " JPEG 2000: build (ver 2.4.0)\n" " HDR: YES\n" " SUNRASTER: YES\n" " PXM: YES\n" " PFM: YES\n" "\n" " Video I/O:\n" " DC1394: NO\n" " FFMPEG: NO\n" " avcodec: NO\n" " avformat: NO\n" " avutil: NO\n" " swscale: NO\n" " avresample: NO\n" " GStreamer: NO\n" " v4l/v4l2: YES (linux/videodev2.h)\n" "\n" " Parallel framework: none\n" "\n" " Trace: YES (built-in)\n" "\n" " Other third-party libraries:\n" " Lapack: NO\n" " Custom HAL: YES (csi-cv (ver 0.0.1))\n" " Protobuf: build (3.19.1)\n" "\n" " Python (for build): /usr/bin/python2.7\n" "\n" " Install to: /root/opencv_hat/OpenCV/install\n" "-----------------------------------------------------------------\n" "\n"

dkurt commented 11 months ago

When I compile, I want to call videocapture function and imshow function, but after compiling, it can not be found, I cross-compile the dependency library

@dragonforward, According to the logs, OpenCV is compiled fine. Try do make install and then compile a simple app using cmake:

CMakeLists.txt

find_package(OpenCV REQUIRED)

add_executable(app main.cpp)
target_include_directories(app PRIVATE ${OpenCV_INCLUDE_DIRS})
target_link_libraries(app ${OpenCV_LIBRARIES})

main.cpp

#include <opencv2/opencv.hpp>

int main(int argc, char** argv) {
     cv::VideoCapture cap(0);
    return 0;
}