Good day, everyone.
I am currently trying to implement Image Demosaicing (debayering)
by OpenCV3.1 with CUDA8.0 on Nvidia Jetson TX1 board,
and suffering from unsolved errors.
Following code is the problematic part.
cv::cuda::GpuMat debayeredImage_cuda;
PvImage* lImage_raw = lBuffer->GetImage();
lImage_raw->Alloc(lWidth, lHeight, PvPixelMono8);
unsigned char* img = lImage_raw->GetDataPointer();
cv::cuda::GpuMat rawImage_cuda(lHeight, lWidth, CV_8UC1, img, cv::Mat::AUTO_STEP);
//---------Following Line Occurs ERROR-----------//
cv::cuda::demosaicing(rawImage_cuda, debayeredImage_cuda, cv::cuda::COLOR_BayerGB2RGB_MHT, 3);
Error Message is
OpenCV Error: Gpu API call (unknown error) in bindTexture, file /media/ubuntu/payload/opencv/modules/core/include/opencv2/core/cuda/common.hpp, line 102
/media/ubuntu/payload/opencv/modules/core/include/opencv2/core/cuda/common.hpp:102: error: (-217) unknown error in function bindTexture
And this is the error-triggering file common.hpp:102
cudaSafeCall( cudaBindTexture2D(0, tex, img.ptr(), &desc, img.cols, img.rows, img.step) );
I followed OpenCV installation manual for Jetson TX1 ( OpenCV: Building OpenCV for Tegra with CUDA )
in order to build OpenCV 3.1 combining pre-built CUDA8.0.
And here is my cmake command.
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_PNG=OFF \
-DBUILD_TIFF=OFF \
-DBUILD_TBB=OFF \
-DBUILD_JPEG=OFF \
-DBUILD_JASPER=OFF \
-DBUILD_ZLIB=OFF \
-DBUILD_EXAMPLES=ON \
-DBUILD_opencv_java=ON \
-DBUILD_opencv_python2=OFF \
-DBUILD_opencv_python3=OFF \
-DENABLE_PRECOMPILED_HEADERS=OFF \
-DWITH_OPENCL=OFF \
-DWITH_OPENMP=OFF \
-DWITH_FFMPEG=ON \
-DWITH_GSTREAMER=OFF \
-DWITH_GSTREAMER_0_10=OFF \
-DWITH_CUDA=ON \
-DWITH_GTK=ON \
-DWITH_VTK=OFF \
-DWITH_TBB=ON \
-DWITH_1394=OFF \
-DWITH_OPENEXR=OFF \
-DCUDA_GENERATION=Auto \
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 \
-DCUDA_ARCH_BIN=5.3 \
-DCUDA_ARCH_PTX="" \
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_TESTS=OFF \
-DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \
../../opencv
I downgrade from OpenCV 3.3 to OpenCV 3.1 because the same error occured in 3.3, but still it’s not fixed in 3.1.
I carefully suggest following possible scenarios.
- DCUDA_ARCH_BIN. I searched a lot from google, and many of them talked about DCUDA_ARCH_BIN, which is 5.3 in my case. However, the version 5.3 is suitable as Nvidia informed in the web-site, so I think this is not a problem.
- Misuse of cv::cuda::demosaicing( , , , ) function in my code. I'm not sure whether I correctly used cv::cuda::GpuMat to store image data.
I am highly motivated to test any ideas of you comment at this article,
so please let me know if you have any possible solutions.
Thank you.