feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake

1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试
2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程
3.重整权利声明文件,重整代码工程,确保最小化侵权风险

Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake
Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
This commit is contained in:
wangzhengyang
2022-05-10 09:54:44 +08:00
parent ecdd171c6f
commit 718c41634f
10018 changed files with 3593797 additions and 186748 deletions

View File

@ -0,0 +1,76 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
// Not a standalone header.
#include <opencv2/core/utils/configuration.private.hpp>
namespace opencv_test {
using namespace perf;
static
utils::Paths getTestCameras()
{
static utils::Paths cameras = utils::getConfigurationParameterPaths("OPENCV_TEST_PERF_CAMERA_LIST");
return cameras;
}
PERF_TEST(VideoCapture_Camera, waitAny_V4L)
{
auto cameraNames = getTestCameras();
if (cameraNames.empty())
throw SkipTestException("No list of tested cameras. Use OPENCV_TEST_PERF_CAMERA_LIST parameter");
const int totalFrames = 50; // number of expected frames (summary for all cameras)
const int64 timeoutNS = 100 * 1000000;
const Size frameSize(640, 480);
const int fpsDefaultEven = 30;
const int fpsDefaultOdd = 15;
std::vector<VideoCapture> cameras;
for (size_t i = 0; i < cameraNames.size(); ++i)
{
const auto& name = cameraNames[i];
int fps = (int)utils::getConfigurationParameterSizeT(cv::format("OPENCV_TEST_CAMERA%d_FPS", (int)i).c_str(), (i & 1) ? fpsDefaultOdd : fpsDefaultEven);
std::cout << "Camera[" << i << "] = '" << name << "', fps=" << fps << std::endl;
VideoCapture cap(name, CAP_V4L);
ASSERT_TRUE(cap.isOpened()) << name;
EXPECT_TRUE(cap.set(CAP_PROP_FRAME_WIDTH, frameSize.width)) << name;
EXPECT_TRUE(cap.set(CAP_PROP_FRAME_HEIGHT, frameSize.height)) << name;
EXPECT_TRUE(cap.set(CAP_PROP_FPS, fps)) << name;
//launch cameras
Mat firstFrame;
EXPECT_TRUE(cap.read(firstFrame));
EXPECT_EQ(frameSize.width, firstFrame.cols);
EXPECT_EQ(frameSize.height, firstFrame.rows);
cameras.push_back(cap);
}
TEST_CYCLE()
{
int counter = 0;
std::vector<int> cameraReady;
do
{
EXPECT_TRUE(VideoCapture::waitAny(cameras, cameraReady, timeoutNS));
EXPECT_FALSE(cameraReady.empty());
for (int idx : cameraReady)
{
VideoCapture& c = cameras[idx];
Mat frame;
ASSERT_TRUE(c.retrieve(frame));
EXPECT_EQ(frameSize.width, frame.cols);
EXPECT_EQ(frameSize.height, frame.rows);
++counter;
}
}
while(counter < totalFrames);
}
SANITY_CHECK_NOTHING();
}
} // namespace

View File

@ -0,0 +1,37 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
#include "perf_precomp.hpp"
#include "perf_camera.impl.hpp"
namespace opencv_test
{
using namespace perf;
typedef perf::TestBaseWithParam<std::string> VideoCapture_Reading;
const string bunny_files[] = {
"highgui/video/big_buck_bunny.avi",
"highgui/video/big_buck_bunny.mov",
"highgui/video/big_buck_bunny.mp4",
#ifndef HAVE_MSMF
// MPEG2 is not supported by Media Foundation yet
// http://social.msdn.microsoft.com/Forums/en-US/mediafoundationdevelopment/thread/39a36231-8c01-40af-9af5-3c105d684429
"highgui/video/big_buck_bunny.mpg",
#endif
"highgui/video/big_buck_bunny.wmv"
};
PERF_TEST_P(VideoCapture_Reading, ReadFile, testing::ValuesIn(bunny_files) )
{
string filename = getDataPath(GetParam());
VideoCapture cap;
TEST_CYCLE() cap.open(filename);
SANITY_CHECK_NOTHING();
}
} // namespace

View File

@ -0,0 +1,10 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
#include "perf_precomp.hpp"
#if defined(HAVE_HPX)
#include <hpx/hpx_main.hpp>
#endif
CV_PERF_TEST_MAIN(videoio)

View File

@ -0,0 +1,47 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
#include "perf_precomp.hpp"
namespace opencv_test
{
using namespace perf;
typedef tuple<std::string, bool> VideoWriter_Writing_t;
typedef perf::TestBaseWithParam<VideoWriter_Writing_t> VideoWriter_Writing;
const string image_files[] = {
"python/images/QCIF_00.bmp",
"python/images/QCIF_01.bmp",
"python/images/QCIF_02.bmp",
"python/images/QCIF_03.bmp",
"python/images/QCIF_04.bmp",
"python/images/QCIF_05.bmp"
};
PERF_TEST_P(VideoWriter_Writing, WriteFrame,
testing::Combine(
testing::ValuesIn(image_files),
testing::Bool()))
{
const string filename = getDataPath(get<0>(GetParam()));
const bool isColor = get<1>(GetParam());
Mat image = imread(filename, isColor ? IMREAD_COLOR : IMREAD_GRAYSCALE );
#if defined(HAVE_MSMF) && !defined(HAVE_FFMPEG)
const string outfile = cv::tempfile(".wmv");
const int fourcc = VideoWriter::fourcc('W', 'M', 'V', '3');
#else
const string outfile = cv::tempfile(".avi");
const int fourcc = VideoWriter::fourcc('X', 'V', 'I', 'D');
#endif
VideoWriter writer(outfile, fourcc, 25, cv::Size(image.cols, image.rows), isColor);
if (!writer.isOpened())
throw SkipTestException("Video file can not be opened");
TEST_CYCLE_N(100) { writer << image; }
SANITY_CHECK_NOTHING();
remove(outfile.c_str());
}
} // namespace

View File

@ -0,0 +1,10 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
#ifndef __OPENCV_PERF_PRECOMP_HPP__
#define __OPENCV_PERF_PRECOMP_HPP__
#include "opencv2/ts.hpp"
#include "opencv2/videoio.hpp"
#endif