I’m trying to retrieve a cv::cuda::GpuMat
from CUDA EGLStream.
My code is based on jetson_multimedia_api/argus/samples/syncSensor
The current setting of my stream is
iEGLStreamSettings->setPixelFormat(PIXEL_FMT_YCbCr_420_888);
iEGLStreamSettings->setResolution(STREAM_SIZE);
iEGLStreamSettings->setEGLDisplay(g_display.get());
I’ve made some modifications on ScopedCudaEGLStreamFrameAcquire::generateHistogram
bool ScopedCudaEGLStreamFrameAcquire::generateHistogram(unsigned int histogramData[HISTOGRAM_BINS],
float *time)
{
if (!hasValidFrame() || !histogramData || !time)
ORIGINATE_ERROR("Invalid state or output parameters");
unsigned int height = m_frame.height;
unsigned int width = m_frame.width;
NppiSize in_size{
.width = static_cast<int>(width),
.height = static_cast<int>(height),
};
cv::cuda::GpuMat gpuMat;
gpuMat.create(cv::Size(width, height), CV_8UC4);
NppStatus status = nppiNV21ToBGR_8u_P2C4R((const Npp8u * const*)m_frame.frame.pPitch[0],
m_frame.pitch,
(Npp8u *)gpuMat.cudaPtr(),
gpuMat.step,
in_size);
return true;
}
The function terminates successfully, but throws an error on the next call at gpuMat.create()
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.6.0) /home/nano1/opencv/modules/core/src/cuda/gpu_mat.cu:116: error: (-217:Gpu API call) unspecified launch failure in function 'allocate'
I haven’t called any OpenCV
function outside generateHistogram()
Any help will be appreciated!