feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试 2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程 3.重整权利声明文件,重整代码工程,确保最小化侵权风险 Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
This commit is contained in:
		
							
								
								
									
										72
									
								
								3rdparty/opencv-4.5.4/modules/highgui/misc/plugins/build_plugins.sh
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										72
									
								
								3rdparty/opencv-4.5.4/modules/highgui/misc/plugins/build_plugins.sh
									
									
									
									
										vendored
									
									
										Executable file
									
								
							@ -0,0 +1,72 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
if [ -z $1 ] ; then
 | 
			
		||||
    echo "$0 <destination directory>"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 | 
			
		||||
OCV="$( cd "${DIR}/../../../.." >/dev/null 2>&1 && pwd )"
 | 
			
		||||
mkdir -p "${1}"  # Docker creates non-existed mounts with 'root' owner, lets ensure that dir exists under the current user to avoid "Permission denied" problem
 | 
			
		||||
DST="$( cd "$1" >/dev/null 2>&1 && pwd )"
 | 
			
		||||
CFG=${2:-Release}
 | 
			
		||||
 | 
			
		||||
do_build()
 | 
			
		||||
{
 | 
			
		||||
TAG=$1
 | 
			
		||||
D=$2
 | 
			
		||||
F=$3
 | 
			
		||||
shift 3
 | 
			
		||||
docker build \
 | 
			
		||||
    --build-arg http_proxy \
 | 
			
		||||
    --build-arg https_proxy \
 | 
			
		||||
    $@ \
 | 
			
		||||
    -t $TAG \
 | 
			
		||||
    -f "${D}/${F}" \
 | 
			
		||||
    "${D}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
do_run()
 | 
			
		||||
{
 | 
			
		||||
TAG=$1
 | 
			
		||||
shift 1
 | 
			
		||||
docker run \
 | 
			
		||||
    -it \
 | 
			
		||||
    --rm \
 | 
			
		||||
    -v "${OCV}":/opencv:ro \
 | 
			
		||||
    -v "${DST}":/dst \
 | 
			
		||||
    -e CFG=$CFG \
 | 
			
		||||
    --user $(id -u):$(id -g) \
 | 
			
		||||
    $TAG \
 | 
			
		||||
    "$@"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
build_gtk2_ubuntu()
 | 
			
		||||
{
 | 
			
		||||
VER=$1
 | 
			
		||||
shift 1
 | 
			
		||||
TAG=opencv_highgui_ubuntu_gtk2_builder:${VER}
 | 
			
		||||
do_build $TAG "${DIR}/plugin_gtk" Dockerfile-ubuntu-gtk2 --build-arg VER=${VER}
 | 
			
		||||
do_run $TAG /opencv/modules/highgui/misc/plugins/plugin_gtk/build.sh /dst gtk2_ubuntu${VER} ${CFG} "$@"
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
build_gtk3_ubuntu()
 | 
			
		||||
{
 | 
			
		||||
VER=$1
 | 
			
		||||
shift 1
 | 
			
		||||
TAG=opencv_highgui_ubuntu_gtk3_builder:${VER}
 | 
			
		||||
do_build $TAG "${DIR}/plugin_gtk" Dockerfile-ubuntu-gtk3 --build-arg VER=${VER}
 | 
			
		||||
do_run $TAG /opencv/modules/highgui/misc/plugins/plugin_gtk/build.sh /dst gtk3_ubuntu${VER} ${CFG} "$@"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
echo "OpenCV: ${OCV}"
 | 
			
		||||
echo "Destination: ${DST}"
 | 
			
		||||
 | 
			
		||||
build_gtk2_ubuntu 16.04
 | 
			
		||||
build_gtk2_ubuntu 16.04 -DOPENCV_PLUGIN_NAME=opencv_highgui_gtk2-opengl_ubuntu16.04 -DWITH_OPENGL=ON -DWITH_GTK_2_X=ON
 | 
			
		||||
build_gtk2_ubuntu 18.04
 | 
			
		||||
build_gtk3_ubuntu 18.04
 | 
			
		||||
build_gtk3_ubuntu 20.04
 | 
			
		||||
							
								
								
									
										58
									
								
								3rdparty/opencv-4.5.4/modules/highgui/misc/plugins/plugin_gtk/CMakeLists.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								3rdparty/opencv-4.5.4/modules/highgui/misc/plugins/plugin_gtk/CMakeLists.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,58 @@
 | 
			
		||||
cmake_minimum_required(VERSION 3.5)
 | 
			
		||||
project(opencv_highgui_gtk)
 | 
			
		||||
 | 
			
		||||
get_filename_component(OpenCV_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../.." ABSOLUTE)
 | 
			
		||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVPluginStandalone.cmake")
 | 
			
		||||
 | 
			
		||||
# scan dependencies
 | 
			
		||||
set(WITH_GTK ON)
 | 
			
		||||
include("${OpenCV_SOURCE_DIR}/modules/highgui/cmake/init.cmake")
 | 
			
		||||
 | 
			
		||||
if(NOT HAVE_GTK)
 | 
			
		||||
  message(FATAL_ERROR "GTK: NO")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated-declarations)
 | 
			
		||||
 | 
			
		||||
set(OPENCV_PLUGIN_DEPS core imgproc imgcodecs)
 | 
			
		||||
if(TARGET ocv.3rdparty.gtk3)
 | 
			
		||||
  set(__deps ocv.3rdparty.gtk3)
 | 
			
		||||
elseif(TARGET ocv.3rdparty.gtk2)
 | 
			
		||||
  set(__deps ocv.3rdparty.gtk2)
 | 
			
		||||
elseif(TARGET ocv.3rdparty.gtk)
 | 
			
		||||
  set(__deps ocv.3rdparty.gtk)
 | 
			
		||||
else()
 | 
			
		||||
  message(FATAL_ERROR "Missing dependency target for GTK libraries")
 | 
			
		||||
endif()
 | 
			
		||||
ocv_create_plugin(highgui "opencv_highgui_gtk" "${__deps}" "GTK" "src/window_gtk.cpp")
 | 
			
		||||
if(WITH_OPENGL)
 | 
			
		||||
  if(HAVE_GTK2
 | 
			
		||||
      AND TARGET ocv.3rdparty.gtkglext
 | 
			
		||||
      AND TARGET ocv.3rdparty.gtk_opengl
 | 
			
		||||
      AND NOT OPENCV_GTK_DISABLE_GTKGLEXT
 | 
			
		||||
      AND NOT OPENCV_GTK_DISABLE_OPENGL
 | 
			
		||||
  )
 | 
			
		||||
    message(STATUS "OpenGL: YES")
 | 
			
		||||
    target_link_libraries(${OPENCV_PLUGIN_NAME} PRIVATE
 | 
			
		||||
        ocv.3rdparty.gtkglext ocv.3rdparty.gtk_opengl
 | 
			
		||||
    )
 | 
			
		||||
  else()
 | 
			
		||||
    message(WARNING "OpenGL dependencies are not available!")
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(HAVE_GTK3)
 | 
			
		||||
  message(STATUS "GTK3+: ver ${GTK3_VERSION}")
 | 
			
		||||
elseif(HAVE_GTK3)
 | 
			
		||||
  message(STATUS "GTK2+: ver ${GTK2_VERSION}")
 | 
			
		||||
elseif(DEFINED GTK_VERSION)
 | 
			
		||||
  message(STATUS "GTK+: ver ${GTK_VERSION}")
 | 
			
		||||
else()
 | 
			
		||||
  message(STATUS "GTK+: YES")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(HAVE_GTHREAD)
 | 
			
		||||
  message(STATUS "GThread : YES (ver ${GTHREAD_VERSION})")
 | 
			
		||||
else()
 | 
			
		||||
  message(STATUS "GThread : NO")
 | 
			
		||||
endif()
 | 
			
		||||
							
								
								
									
										28
									
								
								3rdparty/opencv-4.5.4/modules/highgui/misc/plugins/plugin_gtk/Dockerfile-ubuntu-gtk2
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								3rdparty/opencv-4.5.4/modules/highgui/misc/plugins/plugin_gtk/Dockerfile-ubuntu-gtk2
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,28 @@
 | 
			
		||||
ARG VER
 | 
			
		||||
FROM ubuntu:$VER
 | 
			
		||||
 | 
			
		||||
RUN \
 | 
			
		||||
  apt-get update && \
 | 
			
		||||
  DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
 | 
			
		||||
    pkg-config \
 | 
			
		||||
    cmake \
 | 
			
		||||
    g++ \
 | 
			
		||||
    ninja-build \
 | 
			
		||||
  && \
 | 
			
		||||
  rm -rf /var/lib/apt/lists/*
 | 
			
		||||
 | 
			
		||||
RUN \
 | 
			
		||||
  apt-get update && \
 | 
			
		||||
  DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
 | 
			
		||||
    libgtk2.0-dev \
 | 
			
		||||
  && \
 | 
			
		||||
  rm -rf /var/lib/apt/lists/*
 | 
			
		||||
 | 
			
		||||
RUN \
 | 
			
		||||
  apt-get update && \
 | 
			
		||||
  DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
 | 
			
		||||
    libgtkglext1-dev \
 | 
			
		||||
  && \
 | 
			
		||||
  rm -rf /var/lib/apt/lists/*
 | 
			
		||||
 | 
			
		||||
WORKDIR /tmp
 | 
			
		||||
							
								
								
									
										21
									
								
								3rdparty/opencv-4.5.4/modules/highgui/misc/plugins/plugin_gtk/Dockerfile-ubuntu-gtk3
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								3rdparty/opencv-4.5.4/modules/highgui/misc/plugins/plugin_gtk/Dockerfile-ubuntu-gtk3
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
			
		||||
ARG VER
 | 
			
		||||
FROM ubuntu:$VER
 | 
			
		||||
 | 
			
		||||
RUN \
 | 
			
		||||
  apt-get update && \
 | 
			
		||||
  DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
 | 
			
		||||
    pkg-config \
 | 
			
		||||
    cmake \
 | 
			
		||||
    g++ \
 | 
			
		||||
    ninja-build \
 | 
			
		||||
  && \
 | 
			
		||||
  rm -rf /var/lib/apt/lists/*
 | 
			
		||||
 | 
			
		||||
RUN \
 | 
			
		||||
  apt-get update && \
 | 
			
		||||
  DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
 | 
			
		||||
    libgtk-3-dev \
 | 
			
		||||
  && \
 | 
			
		||||
  rm -rf /var/lib/apt/lists/*
 | 
			
		||||
 | 
			
		||||
WORKDIR /tmp
 | 
			
		||||
							
								
								
									
										21
									
								
								3rdparty/opencv-4.5.4/modules/highgui/misc/plugins/plugin_gtk/build.sh
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										21
									
								
								3rdparty/opencv-4.5.4/modules/highgui/misc/plugins/plugin_gtk/build.sh
									
									
									
									
										vendored
									
									
										Executable file
									
								
							@ -0,0 +1,21 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 | 
			
		||||
 | 
			
		||||
OPENCV_PLUGIN_DESTINATION=$1
 | 
			
		||||
OPENCV_PLUGIN_NAME=opencv_highgui_$2
 | 
			
		||||
CMAKE_BUILD_TYPE=${3:-Release}
 | 
			
		||||
 | 
			
		||||
shift 3 || true
 | 
			
		||||
 | 
			
		||||
set -x
 | 
			
		||||
cmake -GNinja \
 | 
			
		||||
    -DOPENCV_PLUGIN_NAME=${OPENCV_PLUGIN_NAME} \
 | 
			
		||||
    -DOPENCV_PLUGIN_DESTINATION=${OPENCV_PLUGIN_DESTINATION} \
 | 
			
		||||
    -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
 | 
			
		||||
    "$@" \
 | 
			
		||||
    $DIR
 | 
			
		||||
 | 
			
		||||
ninja -v
 | 
			
		||||
		Reference in New Issue
	
	Block a user