mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -38,6 +38,35 @@ echo ===========================================================================
|
||||
:: Path to FFMPEG binary files
|
||||
set "PATH=!PATH!;!SCRIPTDIR!\..\..\build\bin\"
|
||||
|
||||
:: Detect compiler
|
||||
cl /? >NUL 2>NUL <NUL
|
||||
if !ERRORLEVEL! NEQ 0 (
|
||||
PUSHD !CD!
|
||||
if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat" (
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat"
|
||||
goto check_msvc
|
||||
)
|
||||
if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat" (
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
||||
goto check_msvc
|
||||
)
|
||||
if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat" (
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
|
||||
goto check_msvc
|
||||
)
|
||||
if exist "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" (
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
goto check_msvc
|
||||
)
|
||||
:check_msvc
|
||||
POPD
|
||||
cl /? >NUL 2>NUL <NUL
|
||||
if !ERRORLEVEL! NEQ 0 (
|
||||
set "MSG=Can't detect Microsoft Visial Studio C++ compiler (cl.exe). MSVS 2015/2017 are supported only from standard locations"
|
||||
goto die
|
||||
)
|
||||
)
|
||||
|
||||
:: Detect CMake
|
||||
cmake --version >NUL 2>NUL
|
||||
if !ERRORLEVEL! EQU 0 (
|
||||
@@ -55,32 +84,10 @@ if NOT DEFINED CMAKE_FOUND (
|
||||
set "MSG=CMake is required to build OpenCV samples. Download it from here: https://cmake.org/download/ and install into 'C:\Program Files\CMake'"
|
||||
goto die
|
||||
) else (
|
||||
call :execute cmake --version
|
||||
echo CMake is detected
|
||||
)
|
||||
|
||||
:: Detect compiler
|
||||
cl /? >NUL 2>NUL <NUL
|
||||
if !ERRORLEVEL! NEQ 0 (
|
||||
PUSHD !CD!
|
||||
if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat" (
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat"
|
||||
) else (
|
||||
if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat" (
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
||||
) else (
|
||||
if exist "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" (
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
)
|
||||
)
|
||||
)
|
||||
POPD
|
||||
cl /? >NUL 2>NUL <NUL
|
||||
if !ERRORLEVEL! NEQ 0 (
|
||||
set "MSG=ERROR: Can't detect Microsoft Visial Studio C++ compiler (cl.exe). MSVS 2015/2017 are supported only from standard locations"
|
||||
goto die
|
||||
)
|
||||
)
|
||||
|
||||
:: Detect available MSVS version
|
||||
if NOT DEFINED VisualStudioVersion (
|
||||
set "MSG=Can't determine MSVS version. 'VisualStudioVersion' is not defined"
|
||||
|
||||
@@ -89,7 +89,8 @@ int liveQRCodeDetect()
|
||||
TickMeter total;
|
||||
for(;;)
|
||||
{
|
||||
Mat frame, src;
|
||||
Mat frame, src, straight_barcode;
|
||||
string decode_info;
|
||||
vector<Point> transform;
|
||||
cap >> frame;
|
||||
if(frame.empty()) { break; }
|
||||
@@ -97,6 +98,11 @@ int liveQRCodeDetect()
|
||||
|
||||
total.start();
|
||||
bool result_detection = detectQRCode(src, transform);
|
||||
if (result_detection)
|
||||
{
|
||||
bool result_decode = decodeQRCode(src, transform, decode_info, straight_barcode);
|
||||
if (result_decode) { cout << decode_info << '\n'; }
|
||||
}
|
||||
total.stop();
|
||||
double fps = 1 / total.getTimeSec();
|
||||
total.reset();
|
||||
@@ -112,11 +118,12 @@ int liveQRCodeDetect()
|
||||
|
||||
int showImageQRCodeDetect(string in, string out)
|
||||
{
|
||||
Mat src = imread(in, IMREAD_GRAYSCALE);
|
||||
Mat src = imread(in, IMREAD_GRAYSCALE), straight_barcode;
|
||||
string decode_info;
|
||||
vector<Point> transform;
|
||||
const int count_experiments = 10;
|
||||
double transform_time = 0.0;
|
||||
bool result_detection = false;
|
||||
bool result_detection = false, result_decode = false;
|
||||
TickMeter total;
|
||||
for (size_t i = 0; i < count_experiments; i++)
|
||||
{
|
||||
@@ -125,12 +132,20 @@ int showImageQRCodeDetect(string in, string out)
|
||||
result_detection = detectQRCode(src, transform);
|
||||
total.stop();
|
||||
transform_time += total.getTimeSec();
|
||||
if (!result_detection) { break; }
|
||||
total.reset();
|
||||
if (!result_detection) { break; }
|
||||
|
||||
total.start();
|
||||
result_decode = decodeQRCode(src, transform, decode_info, straight_barcode);
|
||||
total.stop();
|
||||
transform_time += total.getTimeSec();
|
||||
total.reset();
|
||||
if (!result_decode) { break; }
|
||||
|
||||
}
|
||||
double fps = count_experiments / transform_time;
|
||||
if (!result_detection) { cout << "Not find QR-code." << '\n'; return -2; }
|
||||
if (!result_decode) { cout << "Not decode QR-code." << '\n'; return -3; }
|
||||
|
||||
Mat color_src = imread(in);
|
||||
getMatWithQRCodeContour(color_src, transform);
|
||||
@@ -151,6 +166,7 @@ int showImageQRCodeDetect(string in, string out)
|
||||
cout << "Output image file path: " << out << '\n';
|
||||
cout << "Size: " << color_src.size() << '\n';
|
||||
cout << "FPS: " << fps << '\n';
|
||||
cout << "Decode info: " << decode_info << '\n';
|
||||
|
||||
vector<int> compression_params;
|
||||
compression_params.push_back(IMWRITE_PNG_COMPRESSION);
|
||||
|
||||
Reference in New Issue
Block a user