https://forums.naturalpoint.com/viewtop ... =65&t=9107
I've included the following code in a working openCV project:
Code: Select all
CameraManager::X().WaitForInitialization();
Camera *camera = CameraManager::X().GetCamera();
if(!camera)
{
fprintf(stderr, "...Error opening V120\n");
}
camera->Start();
camera->SetVideoType(Core::GrayscaleMode);
int camWidth = camera->Width();
int camHeight = camera->Height();
cv::Mat matFrame(cv::Size(camWidth, camHeight), CV_8UC1);
const int BACKBUFFER_BITSPERPIXEL = 8;
Frame *frame = camera->GetFrame();
frame->Rasterize(camWidth, camHeight, matFrame.step, BACKBUFFER_BITSPERPIXEL, matFrame.data);
cv::imshow("My Window Name", matFrame);
frame->Release();
(VisualStudio2012 - openCV2.5.9)
It'll compile, but it will crash at the rasterize function.
openCV has been working same project file for a while now, I've even had rasterize not crashing previously (but not working as expected but that's another discussion).
Crash is obviously not what I'm after so I tried to look at Rasterize, but cant get past a simple function declaration ~what is 'span' ?
~How does rasterize work?
~Most importantly, any idea how to get this working?
Also - as an aside - you'll note I had to type 'Core::' in from of the GrayscaleMode enum as it wasn't being recognized, is this something to do with the other thread I posted earlier (I would link it but I cant access it before it's been moderator approved) - it wouldn't even accept '1'.