Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Gpu API call

$
0
0
Hi erverybody, I have a little question, which I hope you can help me with: I just started working with Cuda over OpenCV. As a part of my algorithm I need to calculate the Histogram of a certain region around each pixel. So, I upload my image (1600*1600) to the gpu memory via gpu_MainImage = new GpuMat(); gpu_MainImage->upload(*m_myImageStruct->mainImage); Then, for every Pixel, that is far away from the border to have enough space around him, I call: inline vector* m_Histogram(const GpuMat *tmpGpuMat, const Range *myRowRange, const Range *myColRange) { GpuMat GpuDest; GpuMat pgu_partImage(*tmpGpuMat, *myRowRange,*myColRange); cv::cuda::calcHist(pgu_partImage,GpuDest); Mat* tmpMat = new Mat(); GpuDest.download(*tmpMat); vector *returnVector = new vector(*tmpMat); normalize(*returnVector, *returnVector, 0, 1, NORM_MINMAX); return returnVector; } This works fine for the first pixel, but crashes for the second pixel, saying: > OpenCV Error: Gpu API call in hist::histogram256, file E:/....../src/cuda/hist.cu, line 106 Now, I kind of understand, that the adress of every object has to be a multiple of 8, but I dont know how to make sure of that. Can someone explain to me why the error occurses and how I can fix it?

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>