Issue 1:
System information (version)

OpenCV => 4.2.0

Operating System / Platform => Windows 7 64-bit

Compiler => Visual Studio 2019

CMake => 3.16.5

Detailed description

Cmake fails to configure the environment when building OpenCV 4.2.0 from source. After processing WORLD modules, CMake fails with a syntax error.

This syntax error is caused by the use of EITHER backslashes or forward slashes when running CMake from the command line (notice in the error below, there are both back and forward slashes even though only forward slashes are used in the configuration). After researching, I came across https://stackoverflow.com/questions/14112279/cmake-parse-error-invalid-escape-sequence-o about an issue like this. I followed "Fraser"'s recommendation and the script executed without issue.

Error message:

Cmd configuration:

"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvars64.bat"

set "openCvSource=D:/Workspace/opencv/opencv-4.2.0"

set "openCVExtraModules=D:/Workspace/opencv/opencv_contrib-4.2.0/modules"

set "openCvBuild=%openCvSource%/build"

set "buildType=Release"

set "generator=Ninja"

set "pathToAnaconda=C:/ProgramData/Anaconda3"

set "pyVer=37"

"C:/Program Files/CMake/bin/cmake.exe" -B"%openCvBuild%/" -H"%openCvSource%/" -G"%generator%" -DCMAKE_BUILD_TYPE=%buildType% -DOPENCV_EXTRA_MODULES_PATH="%openCVExtraModules%/" ^

-DINSTALL_TESTS=ON -DINSTALL_C_EXAMPLES=ON -DBUILD_EXAMPLES=ON ^

-DBUILD_opencv_world=ON ^

-DWITH_CUDA=ON -DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2" -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DCUDA_ARCH_BIN=5.3,6.0,6.1,7.0,7.5 -DCUDA_ARCH_PTX=7.5 -DWITH_NVCUVID=ON ^

-DWITH_OPENGL=ON ^

-DWITH_MFX=ON ^

-DBUILD_opencv_python3=ON -DPYTHON3_INCLUDE_DIR=%pathToAnaconda%/include -DPYTHON3_LIBRARY=%pathToAnaconda%/libs/python%pyVer%.lib -DPYTHON3_EXECUTABLE=%pathToAnaconda%/python.exe -DPYTHON3_NUMPY_INCLUDE_DIRS=%pathToAnaconda%/lib/site-packages/numpy/core/include -DPYTHON3_PACKAGES_PATH=%pathToAnaconda%/Lib/site-packages/ -DOPENCV_SKIP_PYTHON_LOADER=ON

Steps to reproduce

Review this tutorial: https://jamesbowley.co.uk/accelerate-opencv-4-2-0-build-with-cuda-and-python-bindings/

I am using Anaconda x64 with Python 3.7.4 located in C:\ProgramData\Anaconda3.

Add the Ninja compiler to the system path.

Run the above command configuration in terminal.

Notes

I was able to fix this by changing 'macro' and 'endmacro' on lines 1420 and 1429 in OpenCVUtils.cmake to 'function' and 'endfunction'.

Issue 2:
System information (version)

OpenCV => 3.2.0

Operating System / Platform => Ubuntu 18.04

Compiler => gcc

Detailed description

When drawing an ellipse with specific but not pathological values and a line thickness less than 5, horizontal lines are displayed.

Steps to reproduce

The following snipped is sufficient to expose the problem:

#include <opencv2/viz/types.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui.hpp> // for imshow

int main(int argc, char** argv){
cv::RotatedRect rect;
rect.angle = 6.52944;
rect.center.x = 201.968;
rect.center.y = 373.492;
rect.size.width = 65.2557;
rect.size.height = 20.5783;

cv::Mat test(848,800,CV_8UC3);
cv::ellipse(test,rect,cv::viz::Color::magenta(),2);
cv::imshow("windowName", test);
cv::waitKey(0);
}

When using a higher thickness (e.g., 5) the problem goes away.