PS3Eye Camera SDK for use in your own applicationsAuthor: AlexPDate: 12-31-2008
Many of you asked us how can you use this camera in your applications, besides the existing implementation of PS3Eye DirectShow filter, we developed the PS3EyeLib as well. This SDK library lets you get full access to the PS3Eye...
Note this article was depreciated on 12-29-2009 - Read about new version here...
Many of you asked us how can you use this camera in your applications, besides the existing implementation of PS3Eye DirectShow filter, we developed the PS3EyeLib as well. This SDK library lets you get full access to the PS3Eye camera and allows you to configure the camera and grab video frames.
Lets look at the PS3EyeLib API:
The setup file (PS3EyeSetup.2.0b81021), besides the PS3Eye driver, DirectShow filter and test app, includes the following files in the SDK directory:
IPS3EyeLib.h - Camera API include file
PS3EyeLib.lib - Camera API library file
PS3EyeLib.dll - Camera API dynamic library file
List of fixes/additions in the current release:
Created DirectShow camera property page (selectable resolution and frame rate)
Support for RGB-16/24/32 color output format
Implemented both 32-bit and 64-bit versions of the PS3Eye driver
Fixed the PS3EyeCamera.inf file so that drivers (32-bit and 64-bit) install correctly
Improved capture performance and responsiveness on Vista OS
Here is the example of PS3EyeLib usage in your application:
// Create PS3EyeLib object
IPS3EyeLib *pCam=IPS3EyeLib::Create();
// Query supported video formats
for(int i = 0; i < IPS3EyeLib::GetNumFormats(); i++)
{
int width, height, rate;
char *description;
width = IPS3EyeLib::GetFormats()[i].width;
height = IPS3EyeLib::GetFormats()[i].height;
rate = IPS3EyeLib::GetFormats()[i].rate;
description = IPS3EyeLib::GetFormats()[i].formatTxt;
// Display available formats …
}
// Decide on the format to use (Example: 320×240 * 30fps)
// Select this format
pCam->SetFormat(IPS3EyeLib::GetFormatIndex(320,240,30));
// Allocate image buffer (we are going to capture 24bit RGB images)
// The supported color depths are 16, 24 and 32
PBYTE pBuffer = new BYTE[(320*240*24)/8];
// Start capturing
pCam->StartCapture();
// Process frames until ’done’
bool done = false;
while( !done )
{
// This function will block until a new frame is available
// It will then fill the buffer with frame image data
if(pCam->GetFrame(pBuffer, 24, false))
{
// Process/display video frame here
// ...
// If your program is done set ’done = true;’
}
}
// Free the image buffer
delete [] pBuffer;
// Stop capturing
pCam->StopCapture();
// Destroy the camera object
delete pCam;