|
@@ -6,11 +6,11 @@ project(bytesflow-opencv-media)
|
|
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/output/bin)
|
|
|
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/output/lib)
|
|
|
|
|
|
-add_subdirectory(opencv)
|
|
|
+add_subdirectory(src)
|
|
|
add_subdirectory(jni)
|
|
|
|
|
|
|
|
|
-############################################# 加入jni支持,linux############################################
|
|
|
+############################################# 加入jni支持############################################
|
|
|
message(FIND JAVA_HOME---> $ENV{JAVA_HOME})
|
|
|
set(JAVA_HOME $ENV{JAVA_HOME})
|
|
|
message(JAVA_HOME ${JAVA_HOME})
|
|
@@ -20,6 +20,8 @@ if (NOT DEFINED ENV{JAVA_HOME})
|
|
|
set(JNI_PATH ${JAVA_HOME}/include)
|
|
|
endif ()
|
|
|
|
|
|
+############################################# 加入 ffmpeg src 支持############################################
|
|
|
+
|
|
|
IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
|
set(JNI_MD_PATH ${JAVA_HOME}/include/linux)
|
|
|
set(JNI_PATH ${JAVA_HOME}/include)
|
|
@@ -29,6 +31,14 @@ IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
|
set(OPENCV_INCLUDE ${OPENCV_HOME}/include/opencv4/)
|
|
|
set(OPENCV_LIBS ${OPENCV_HOME}/lib64)
|
|
|
|
|
|
+ set(FFMPEG_PREFIX /usr)
|
|
|
+ set(FFMPEG_INCLUDE_DIRS ${FFMPEG_PREFIX}/include/ffmpeg/)
|
|
|
+ set(FFMPEG_LIBRARIES ${FFMPEG_PREFIX}/lib64/)
|
|
|
+ MESSAGE(FFMPEG_PREFIX ${FFMPEG_PREFIX})
|
|
|
+ MESSAGE(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS})
|
|
|
+ MESSAGE(FFMPEG_LIBS ${FFMPEG_LIBRARIES})
|
|
|
+
|
|
|
+
|
|
|
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
|
|
set(JNI_PATH ${JAVA_HOME}/include)
|
|
|
set(JNI_MD_PATH ${JAVA_HOME}/include/darwin)
|
|
@@ -37,6 +47,15 @@ ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
|
|
set(OPENCV_INCLUDE ${OPENCV_HOME}/include/opencv4)
|
|
|
set(OPENCV_LIBS ${OPENCV_HOME}/lib)
|
|
|
|
|
|
+
|
|
|
+ set(FFMPEG_PREFIX /usr/local/Cellar/ffmpeg@4/4.4.1)
|
|
|
+ set(FFMPEG_INCLUDE_DIRS ${FFMPEG_PREFIX}/include/ffmpeg/)
|
|
|
+ set(FFMPEG_LIBS ${FFMPEG_PREFIX}/lib64/)
|
|
|
+ MESSAGE(FFMPEG_PREFIX ${FFMPEG_PREFIX})
|
|
|
+ MESSAGE(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS})
|
|
|
+ MESSAGE(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES})
|
|
|
+
|
|
|
+
|
|
|
ELSE ()
|
|
|
MESSAGE(STATUS "other platform: ${CMAKE_SYSTEM_NAME}")
|
|
|
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
@@ -44,15 +63,29 @@ ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
|
message(OPENCV_INCLUDE>${OPENCV_INCLUDE})
|
|
|
message(OPENCV_LIBS>${OPENCV_LIBS})
|
|
|
message(JAVA_HOME>${JAVA_HOME})
|
|
|
-link_directories(${OPENCV_LIBS})
|
|
|
+
|
|
|
include_directories(${OPENCV_INCLUDE})
|
|
|
include_directories(${JNI_MD_PATH})
|
|
|
+include_directories(${FFMPEG_INCLUDE_DIRS})
|
|
|
|
|
|
+link_directories(${OPENCV_LIBS})
|
|
|
+link_directories(${FFMPEG_LIBS})
|
|
|
|
|
|
add_library(piaoquan_java_opencv SHARED
|
|
|
- ${OPENCV_SRC}
|
|
|
+ ${Project_SRC}
|
|
|
${JAVA_JNI_SRC})
|
|
|
|
|
|
+add_library(video_similarity_detection SHARED
|
|
|
+ ${Project_SRC})
|
|
|
+
|
|
|
+set(FFmpeg_LIBS
|
|
|
+ -lavcodec
|
|
|
+ -lavdevice
|
|
|
+ -lavfilter
|
|
|
+ -lavformat
|
|
|
+ -lavutil
|
|
|
+ -lswscale
|
|
|
+ -lswresample)
|
|
|
set(OpenCV_LIBS
|
|
|
-lopencv_imgproc
|
|
|
-lopencv_imgcodecs
|
|
@@ -118,13 +151,23 @@ if (CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -O0")
|
|
|
message("Debug mode:${CMAKE_C_FLAGS_DEBUG}")
|
|
|
add_executable(ImageBlurDetection_debug main.cpp
|
|
|
- ${OPENCV_SRC}
|
|
|
+ ${Project_SRC}
|
|
|
count_down_latch.h
|
|
|
${JAVA_JNI_SRC}
|
|
|
)
|
|
|
target_link_libraries(ImageBlurDetection_debug -lpthread
|
|
|
${OpenCV_LIBS}
|
|
|
)
|
|
|
+
|
|
|
+ add_executable(video_similarity_detection_debug main.cpp
|
|
|
+ ${Project_SRC}
|
|
|
+ count_down_latch.h
|
|
|
+ ${JAVA_JNI_SRC}
|
|
|
+ )
|
|
|
+ target_link_libraries(video_similarity_detection_debug -lpthread
|
|
|
+ ${OpenCV_LIBS}
|
|
|
+ ${FFmpeg_LIBS}
|
|
|
+ )
|
|
|
elseif (CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -O3")
|
|
|
message("Release mode:${CMAKE_C_FLAGS_RELEASE}")
|
|
@@ -136,6 +179,10 @@ endif ()
|
|
|
target_link_libraries(piaoquan_java_opencv
|
|
|
${OpenCV_LIBS}
|
|
|
)
|
|
|
+target_link_libraries(video_similarity_detection
|
|
|
+ ${OpenCV_LIBS}
|
|
|
+ ${FFmpeg_LIBS}
|
|
|
+ )
|
|
|
|
|
|
|
|
|
|