Ask Your Question

Revision history [back]

Apologies, I see that you are knew to OpenCV. Unfortunately not all of the data types and functions supported by OpenCv natively on the CPU are supported by CUDA on the GPU.

I suspect that the functions you require, BGR2YUV_IYUV and BGR2YUV_YV12, whose enums evaluate to conversion code 127 and 131 respectively are not supported in the CUDA implementation.

If you inspect the source, the maximum conversion code is 127 < BGR2YUV_IYUV. Additionally you will notice that in both conversion to //YUV 4:2:0 formats family and //YUV 4:2:2 formats family there are 0's in the mapping from OpenCV colour conversion code to the CUDA implementation.

Both of these things imply to me that there are no corresponding CUDA implementations to or from YUV 4:2:[0|2].

I hope this hel

Apologies, I see that you are knew to OpenCV. Unfortunately not all of the data types and functions supported by OpenCv natively on the CPU are supported by CUDA on the GPU.

I suspect that the functions you require, BGR2YUV_IYUV and BGR2YUV_YV12, whose enums evaluate to conversion code 127 and 131 respectively are not supported in the CUDA implementation.

If you inspect the source, the maximum conversion code is 127 < BGR2YUV_IYUV. Additionally you will notice that in both conversion to //YUV 4:2:0 formats family and //YUV 4:2:2 formats family there are 0's in the mapping from OpenCV colour conversion code to the CUDA implementation.

Both of these things imply to me that there are no corresponding CUDA implementations to or from YUV 4:2:[0|2].

I hope this helhelps.

Apologies, I see that you are knew new to OpenCV. Unfortunately not all of the data types and functions supported by OpenCv natively on the CPU are supported by CUDA on the GPU.

I suspect that the functions you require, BGR2YUV_IYUV and BGR2YUV_YV12, whose enums evaluate to conversion code 127 and 131 respectively are not supported in the CUDA implementation.

If you inspect the source, the maximum conversion code is 127 < BGR2YUV_IYUV. Additionally you will notice that in both conversion to //YUV 4:2:0 formats family and //YUV 4:2:2 formats family there are 0's in the mapping from OpenCV colour conversion code to the CUDA implementation.

Both of these things imply to me that there are no corresponding CUDA implementations to or from YUV 4:2:[0|2].

I hope this helps.

Apologies, I see that you are new to OpenCV. Unfortunately not all of the data types and functions supported by OpenCv natively on the CPU are supported by CUDA on the GPU.

I suspect that the functions you require, BGR2YUV_IYUV and BGR2YUV_YV12, whose enums evaluate to conversion code 127 and 131 respectively are not supported in the CUDA implementation.

If you inspect the source, the maximum conversion code is 127 < BGR2YUV_IYUV. Additionally you will notice that in both conversion to //YUV 4:2:0 formats family and //YUV 4:2:2 formats family there are 0's in the mapping from OpenCV colour conversion code to the CUDA implementation.

Both of these things imply to me that there are no corresponding CUDA implementations to or from YUV 4:2:[0|2].

I may be wrong but I ran a quick test from Python and was able to convert successfully COLOR_RGB2YUV_IYUV on the CPU and COLOR_RGB2YUV with CUDA but I got an unsupported error when trying COLOR_RGB2YUV_IYUV in CUDA.

import numpy as np
import cv2 as cv
rgb = np.random.randint(255, size=(1024,1024,3),dtype=np.uint8)
yuv_iyuv = cv.cvtColor(rgb,cv.COLOR_RGB2YUV_IYUV)
# no errors here
cu_rgb = cv.cuda_GpuMat()
cu_rgb.upload(rgb)
cu_yuv = cv.cuda.cvtColor(cu_rgb,cv.COLOR_RGB2YUV)
# still no errors
cu_yuv_IYUV = cv.cuda.cvtColor(cu_rgb,cv.COLOR_RGB2YUV_IYUV)
# error: OpenCV(4.0.0) J:\opencv_contrib\modules\cudaimgproc\src\color.cpp:2103: error: (-206:Bad flag (parameter or structure field)) Unknown/unsupported color conversion code in function 'cv::cuda::cvtColor'

I hope this helps.

I am not sure why you received a memory error instead, which version of OpenCv are you using?