Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Pseudocode for custom GPU computation

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

click to hide/show revision 2
No.2 Revision

Pseudocode for custom GPU computation

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"

#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;

CUDABOF; int main(int, char**) { VideoCapture cap(0); if(!cap.isOpened()) return -1;

-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;

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