Hi there,
i have been trying to start ueye usb 1540 LE monochrome camera using opencv on ubuntu 14.04. program runs and camera is initialised also, memory is also allocated, but my window is showing blank images so far.any clues ??
here is my code... got this code from [link text](https://github.com/StevenPuttemans/opencv_tryout_code/tree/master/camera_interfacing)
//start camera//
void initializeCameraInterface(HIDS* hCam_internal)
{
// Open cam and see if it was succesfull
INT nRet = is_InitCamera (hCam_internal, NULL);
if (nRet == IS_SUCCESS){
cout << "Camera initialized!" << endl;
}
// Setting the pixel clock to retrieve data
UINT nPixelClockDefault = 24;
nRet = is_PixelClock(*hCam_internal, IS_PIXELCLOCK_CMD_SET, (void*)&nPixelClockDefault, sizeof(nPixelClockDefault));
if (nRet == IS_SUCCESS){
cout << "Camera pixel clock succesfully set!" << endl;
}else if(nRet == IS_NOT_SUPPORTED){
cout << "Camera pixel clock setting is not supported!" << endl;
}
// Set the color mode of the camera
INT colorMode = IS_CM_MONO8;
nRet = is_SetColorMode(*hCam_internal,colorMode);
if (nRet == IS_SUCCESS){
cout << "Camera color mode succesfully set!" << endl;
}
// Store image in camera memory --> option to chose data capture method
// Then access that memory to retrieve the data
INT displayMode = IS_SET_DM_DIB;
nRet = is_SetDisplayMode (*hCam_internal, displayMode);
if (nRet == IS_SUCCESS){
cout << "display mode succesfully set!" << endl;
}
}
// Capture a frame and push it in a OpenCV mat element
Mat getFrame(HIDS* hCam, int width, int height, cv::Mat& mat)
{
// Allocate memory for image
char* pMem = NULL;
int memID = 0;
if( is_AllocImageMem(*hCam, width, height, 8, &pMem, &memID) == IS_SUCCESS)
{
//cout<< "allocation successful" <= 0 ){
break;
}
}
// Release the camera again
is_ExitCamera(hCam);
return 0;
}
↧