Issue 1:
System information (version)

OpenCV => 3.4.1

Operating System / Platform => Ubuntu 16.04 amd64

Compiler => g++ 5.4

Detailed description

I try to use cudacodec VideoReader to read a mkv :

cudacodec::createVideoReader("file.mkv")

OpenCV throws this error :

OpenCV(3.4.1) Error: The function/feature is not implemented (The called functionality is disabled for current build or platform) in throw_no_cuda, file /home/damien/code/lib/opencv-3.4.1/opencv-3.4.1/modules/core/include/opencv2/core/private.cuda.hpp, line 111
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(3.4.1) /home/damien/code/lib/opencv-3.4.1/opencv-3.4.1/modules/core/include/opencv2/core/private.cuda.hpp:111: error: (-213) The called functionality is disabled for current build or platform in function throw_no_cuda

I compile OpenCV with external cuda-enabled ffmpeg :

$ ffmpeg
ffmpeg version n3.4.2-6-g1b9b469 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
configuration: --enable-cuda --enable-nvenc --enable-cuvid --enable-nonfree --extra-cflags='-I/usr/local/cuda/include -I/home/damien/code/lib/Video_Codec_SDK_8.1.24/Samples/NvCodec/NvEncoder' --extra-ldflags=-L/usr/local/cuda/lib64 --enable-shared --disable-static
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
Hyper fast Audio and Video encoder

I compile OpenCV with this cmake :

cmake --enable-shared -D WITH_NVCUVID

Giving me this OpenCV configuration :

General configuration for OpenCV 3.4.1 =====================================
Version control: unknown

Extra modules:
Location (extra): /home/damien/code/lib/opencv-3.4.1/opencv_contrib-3.4.1/modules
Version control (extra): unknown

Platform:
Timestamp: 2018-04-03T15:40:15Z
Host: Linux 4.13.0-37-generic x86_64
...
Video I/O:
DC1394: YES (ver 2.2.4)
FFMPEG: YES
avcodec: YES (ver 57.107.100)
avformat: YES (ver 57.83.100)
avutil: YES (ver 55.78.100)
swscale: YES (ver 4.8.100)
avresample: NO
...
NVIDIA CUDA: YES (ver 9.1, CUFFT CUBLAS)
NVIDIA GPU arch: 30 35 37 50 52 60 61 70
NVIDIA PTX archs:

OpenCL: YES (no extra features)
Include path: /home/damien/code/lib/opencv-3.4.1/opencv-3.4.1/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
...

After taking a look at the source code, I see that :

Using cudacodec VideoReader needs the HAVE_NVCUVID envvar to be set :

https://github.com/opencv/opencv/blob/3.4.1/modules/cudacodec/src/video_reader.cpp#L49-L54

This envvar is set only if CUDA_nvcuvid_LIBRARY is set :

https://github.com/opencv/opencv/blob/3.4.1/cmake/OpenCVDetectCUDA.cmake#L36-L38

And this variable is set only when we are on WIN32 :

https://github.com/opencv/opencv/blob/3.4.1/cmake/FindCUDA.cmake#L792-L794

So I think that there is no way to enable NVCUVID. Do I miss something ? If not, I think that it should be fixed.

Furthermore, I don't want to use the CuvidVideoSource, but I want to use the shared FFMPEG lib that already can use cuvid, with the FFmpegVideoSource. And I think that there is no need for OpenCV to link to cuvid to use this ffmpeg backend. So the FFMPEG backend should be available event if HAVE_NVCUVID is not defined. Is it ?

I can do these changes, but I think that having a confirmation before working on could be interresting.

Steps to reproduce

Compile OpenCV 3.4.1 with CUDA 9.1, NVCUVID

try to open a mkv :

cudacodec::createVideoReader("file.mkv")

More informations about this problem : http://answers.opencv.org/question/188525/enable-cudacodecvideoreader/

Issue 2:
System information (version)

OpenCV => 3.4.3

CMake => 3.12.3

Operating System / Platform => OSX 10.13.6

Compiler => clang(?)

Detailed description

When configuring my OpenCV project, I get the following error:

CMake Error at /Library/Frameworks/opencv2.framework/OpenCVConfig.cmake:96: Parse error. Expected a command name, got unquoted argument with text "@CUDA_CONFIGCMAKE@". Call Stack (most recent call first): CMakeLists.txt:3 (find_package)

Steps to reproduce

I downloaded the OpenCV ios pack and dragged the framework to my User Library. I installed CMake using the .dmg. My most recent error was that there was no OpenCVConfig.cmake file in my OpenCV_DIR path, so I added the one I found here on GitHub (without the ".in" suffix) to the folder Library/Frameworks/opencv2.framework.

my project directory:

/OpenCV_Setup

----/OpenCV_Setup

--------/main.cpp

----/OpenCV_Setup.xcodeproj

----/CMakeLists.txt

Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.0)

project( DisplayImage )

find_package( OpenCV REQUIRED )

target_link_libraries(MY_TARGET_NAME ${OpenCV_LIBS})

add_executable( DisplayImage DisplayImage.cpp)

target_link_libraries( DisplayImage ${OpenCV_LIBS})

I have tried it with minimum required version as 3.12 as well, with the same result.

I've seen that some people solved similar errors by detecting non-printing characters using a hex editor, and while I can see the hex version of this code in Sublime Text... understanding it is beyond me at the moment.

I'm looking forward to starting to study OpenCV as soon as possible. I'll keep trying to figure this out on my own as well, but any help would be greatly appreciated.