Hi,
I would like to work on a video stream and do some computation element by element on the frames, the output of which needs to be displayed in realtime. I am just starting with Opencv and am a newbie. In this case, I guess I wont be using one of the in-built GPU functions in opencv, but will be writing my own CUDA kernel. In addition, the output Image will be smaller than the input image due to the nature of my computations. Can I know what would be the pseudocode for this? I have come up with this so far:
include "cv.h"
include "highgui.h"
include "CUDABOF.hpp"
include "Array.hpp"
include "LinearMemory.hpp"
include "MemoryUtils.hpp"
using namespace std; using namespace cv; using namespace CUDABOF;
int main(int, char**) { VideoCapture cap(0); if(!cap.isOpened()) return -1;
Mat custom_output;
namedWindow("custom_output",1);
for(;;)
{
Mat frame;
cap >> frame;
cvtColor(frame, custom_output, CV_BGR2GRAY);
// memory Copy from Host to Device; // Call CUDA kernel; // memory Copy from Device to Host;
imshow("custom_output", custom_output);
if(waitKey(30) >= 0) break;
}
return 0;
}
Can someone help me with the API's to fill up the commented places in my code. Your help is much appreciated!
-Bharath