1 of 3
1
PS3Eye Camera SDK for use in your own applications!!! 
Posted: 19 October 2008 07:49 PM   [ Ignore ]
Avatar
RankRankRank
Joined  2008-05-08
Total Posts:  342
Administrator

Many of you asked me how can you use this camera in your applications.
Besides the existing implementation of PS3Eye DirectShow filter, I 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:

typedef enum
{
    R320x240
,
    
R640x480,
}PS3EYE_RESOLUTION;

typedef struct tFormat
{
    PS3EYE_RESOLUTION res
;
    
int width;
    
int height;
    
DWORD rate;
    
LONGLONG period;
    
char formatTxt[32];
}PS3EYE_FORMAT;

class 
PS3EYELIB_EXPORT IPS3EyeLib
{
public:
    static 
IPS3EyeLib *Create();

    
virtual ~IPS3EyeLib();

    
virtual void SetFormat(int formatIdx) = 0;
    static 
PS3EYE_FORMAT *GetFormats();
    static 
int GetNumFormats();
    
virtual void StartCapture() = 0;
    
bool GetFrame(PBYTE bufint bitsPerPixelbool flip);
    
virtual void StopCapture() = 0;

    
virtual void DumpEEPROM(LPCTSTR filename) = 0;
    
virtual void DumpRAM(LPCTSTR filename) = 0;
    
virtual void LED(bool on) = 0;

    
virtual bool IsCapturing() = 0;
    
virtual UINT GetWidth() = 0;
    
virtual UINT GetHeight() = 0;
    
virtual PS3EYE_RESOLUTION GetRes() = 0;
    
virtual DWORD GetRate() = 0;
    static 
int GetFormatIndex(int widthint heightLONGLONG period);
    static 
int GetFormatIndex(int widthint heightint rate);
    
virtual LPCTSTR GetCameraVersion() = 0;
};

Here is the example of PS3EyeLib usage in you application:

// Create PS3EyeLib object
IPS3EyeLib *pCam=IPS3EyeLib::Create();

// Query supported video formats
for(int i=0i<IPS3EyeLib::GetNumFormats(); i++)
{
    int width
heightrate;
    
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: 320x240 * 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 (24-bit RGB)
    
if(pCam->GetFrame(pBuffer24false))
    
{
        
// Process/display video frame here
        // ...
        // If your program is done set 'done=true;'
    
}
}
// Free the image buffer
delete [] pBuffer;
// Stop capturing
pCam->StopCapture();
// Free the 
delete pCam;

The latest setup file PS3EyeSetup.2.0b81019 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 in this 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 version of the PS3Eye driver
- Fixed the PS3EyeCamera.inf file so that drivers install correctly

For more info and files go here

Enjoy!

~Alex

 Signature 

Computing is not about computers any more.  It is about living!

Code Laboratories
CL Studio Live - Video like never before
CL Eye Platform SDK

Profile
 
 
Posted: 20 October 2008 01:28 AM   [ Ignore ]   [ # 1 ]
Avatar
RankRankRankRank
Joined  2006-11-09
Total Posts:  1493
Administrator

Alex this is great news!!!

I cant believe how accessible this will make computer vision and sensing… $30 cam+core2duo+opencv=heaven

Congrats and keep up the amazing work smile

 Signature 

~

Profile
 
 
Posted: 20 October 2008 01:39 AM   [ Ignore ]   [ # 2 ]
Avatar
RankRankRankRank
Joined  2008-01-04
Total Posts:  676
Moderator

Great stuff Alex! I’m gonna buy one of these cameras just to try your SDK library tongue wink

Well done mate!

 Signature 

Get Sparked at sparkon.net
ORION Multi-Touch Display (blog)
My YouTube

Profile
 
 
Posted: 20 October 2008 06:37 AM   [ Ignore ]   [ # 3 ]
Avatar
Rank
Joined  2008-06-05
Total Posts:  92
New Member

grande alex =)
since it has a direct show filter does it work already with OSC from touchlib or does it need a twain wrapper?

g.

Profile
 
 
Posted: 20 October 2008 07:27 AM   [ Ignore ]   [ # 4 ]
Avatar
RankRank
Joined  2007-03-15
Total Posts:  224
Member

Hey Alex,

Great work so far, just had a quick question smile ...

Would it be possible to create a DirectShow filter that used 4 eyes as input? essentially giving us a resolution of 1280x960 at 60 frames a sec? so we can treat the 4 cameras kind of like a single camera in touchlib etc.

Cheers
Pleh

Profile
 
 
Posted: 20 October 2008 08:25 AM   [ Ignore ]   [ # 5 ]
Rank
Joined  2008-07-29
Total Posts:  6
New Member

Awesome job Alex.

Profile
 
 
Posted: 20 October 2008 10:40 AM   [ Ignore ]   [ # 6 ]
Avatar
RankRankRankRank
Joined  2008-02-12
Total Posts:  1111
Member

Great Work Alex Keep it up…

 Signature 

Company Website - Knode Research and Development
My Youtube

Profile
 
 
Posted: 20 October 2008 11:07 AM   [ Ignore ]   [ # 7 ]
Avatar
Rank
Joined  2007-11-13
Total Posts:  67
New Member

Thanks you that’s awesome, there’s something new almost every day !!!

Your work is a real pleasure to follow and like nuiman said, I think you’re really boosting the MT community.

I’ve tried your SDK and I’m experiencing troubles to build the application you give as an example.

To be precise, the first line is making GCC go crazy:

IPS3EyeLib pCam=IPS3EyeLib::Create();

Doesn’t work and the debugger says “error: cannot allocate an object of type `IPS3EyeLib’ because the following virtual functions are abstract:”
and it gives a list of every virtual function in IPS3EyeLib.h.

So I tried to declare it as a pointer :

IPS3EyeLib *pCam=IPS3EyeLib::Create();

then the building part is ok but when linking : “undefined reference to `__imp___ZN10IPS3EyeLib6CreateEv’” and it gives it for every function called in this manner : IPS3EyeLib::function().

I’m not used to virtual functions (in fact it’s the first time I see it) so maybe there’s something obvious that I didn’t see.

Everything else seems ok except one little ; which seems missing here:

{
    
// This function will block until a new frame is available
    // It will then fill the buffer with frame image data
    
if(pCam->GetFrame(pBuffer24false))
        
// Display/Process video frame here
}

If someone can tell me where I’m wrong, I would be really great !

Thanks in advance wink

Profile
 
 
Posted: 20 October 2008 12:32 PM   [ Ignore ]   [ # 8 ]
Avatar
RankRankRank
Joined  2008-05-08
Total Posts:  342
Administrator
Paills - 20 October 2008 11:07 AM

Thanks you that’s awesome, there’s something new almost every day !!!

Your work is a real pleasure to follow and like nuiman said, I think you’re really boosting the MT community.



I’ve tried your SDK and I’m experiencing troubles to build the application you give as an example.

To be precise, the first line is making GCC go crazy:

IPS3EyeLib pCam=IPS3EyeLib::Create();


Doesn’t work and the debugger says “error: cannot allocate an object of type `IPS3EyeLib’ because the following virtual functions are abstract:”
and it gives a list of every virtual function in IPS3EyeLib.h.

So I tried to declare it as a pointer :

IPS3EyeLib *pCam=IPS3EyeLib::Create();


then the building part is ok but when linking : “undefined reference to `__imp___ZN10IPS3EyeLib6CreateEv’” and it gives it for every function called in this manner : IPS3EyeLib::function().

I’m not used to virtual functions (in fact it’s the first time I see it) so maybe there’s something obvious that I didn’t see.


Everything else seems ok except one little ; which seems missing here:

{
    
// This function will block until a new frame is available
    // It will then fill the buffer with frame image data
    
if(pCam->GetFrame(pBuffer24false))
        
// Display/Process video frame here
}


If someone can tell me where I’m wrong, I would be really great !

Thanks in advance wink

Paills, thanks for your post. Indeed I had a typo the line should have been:

IPS3EyeLib *pCam=IPS3EyeLib::Create();

I updated this in my post. Regarding linker errors, the thing is that you have to link against the PS3EyeLib.lib file.
You also need to have PS3EyeLib.dll file in the same directory where your executable is or in the system directory (C:\Windows\System32).

~Alex

 Signature 

Computing is not about computers any more.  It is about living!

Code Laboratories
CL Studio Live - Video like never before
CL Eye Platform SDK

Profile
 
 
Posted: 20 October 2008 12:34 PM   [ Ignore ]   [ # 9 ]
Avatar
RankRankRank
Joined  2008-05-08
Total Posts:  342
Administrator
Gene - 20 October 2008 06:37 AM

grande alex =)
since it has a direct show filter does it work already with OSC from touchlib or does it need a twain wrapper?

g.

Hey Gene, I have a TouchLib build that uses this SDK to add support for the PS3Eye camera.
Check it out here.

~Alex

 Signature 

Computing is not about computers any more.  It is about living!

Code Laboratories
CL Studio Live - Video like never before
CL Eye Platform SDK

Profile
 
 
Posted: 20 October 2008 03:16 PM   [ Ignore ]   [ # 10 ]
Avatar
Rank
Joined  2007-11-13
Total Posts:  67
New Member

Thank you for your quick reply !

The linker’s settings are ok (I’m under C::B), I mean I did it the way I usally do (with SDL,OpenGL etc… no problem). I’ll find the problem...da*n it you C++ ^^

Profile
 
 
Posted: 22 October 2008 04:26 AM   [ Ignore ]   [ # 11 ]
Rank
Joined  2008-10-22
Total Posts:  1
New Member

I have been reading up on your efforts to work with the PS3 Eye. Great work!

Would this software work for any OV538 based camera? Why not?

I have been working on getting a OV538 camera to work suing Libusb, but I have not had a lot of success, mainly because I have no clue of what to send the camera so that I can retrieve images using the bulk transfer mode.

Profile
 
 
Posted: 22 October 2008 08:46 AM   [ Ignore ]   [ # 12 ]
Avatar
Rank
Joined  2007-11-13
Total Posts:  67
New Member

I’ve found my problem, I was using GCC instead of the VC++’s compiler. I didn’t know there was a problem when a .lib is used with GCC which uses “only” .a files. I tried to convert the PS3EyeLib.lib file with the help of reimp.exe (a part of MinGW’s tools pack) but I didn’t succeed in doing so.

If someone has a solution to still use GCC I’d be glad to see it ! Still using VC++’s compiler isn’t a big deal.

Anyway your SDK is working great Alex! It’s really easy to use. Once again thanks a lot !

Profile
 
 
Posted: 25 October 2008 07:07 PM   [ Ignore ]   [ # 13 ]
Rank
Joined  2008-10-25
Total Posts:  2
New Member

after installing the latest file PS3EyeSetup.2.0b81021.. the cam stoped working on msn and also i cant capture video with it (cannot capture video render stream) error pops up all the time..

and i dont understand how to use this touchlib and so..
could someone explain to me pls?
thanks

Profile
 
 
Posted: 29 October 2008 03:36 PM   [ Ignore ]   [ # 14 ]
Rank
Joined  2008-08-26
Total Posts:  62
New Member

I am trying to compile a version of the touchlib r400 for the ps3eye the way you have but with the multimouse v0.2.  I was right now I cant even get the svn source to compile at all.  I keep getting errors about not being able to open files such as cvcam.h atlconv.h atlbase.h.  I’m not sure where these files are suppose to be but I would like to be able to compile not just to have the newer mouse driver but also to somewhat learn the steps since it would be my first successful compile in windows.  Could someone please show me whats wrong and also how to add where to add alexp’s code?

Profile
 
 
Posted: 29 October 2008 07:39 PM   [ Ignore ]   [ # 15 ]
Avatar
RankRankRank
Joined  2008-05-08
Total Posts:  342
Administrator
oaa8 - 29 October 2008 03:36 PM

I am trying to compile a version of the touchlib r400 for the ps3eye the way you have but with the multimouse v0.2.  I was right now I cant even get the svn source to compile at all.  I keep getting errors about not being able to open files such as cvcam.h atlconv.h atlbase.h.  I’m not sure where these files are suppose to be but I would like to be able to compile not just to have the newer mouse driver but also to somewhat learn the steps since it would be my first successful compile in windows.  Could someone please show me whats wrong and also how to add where to add alexp’s code?

It seems that you don’t have all the necessary build components installed on your machine.
Take look here and follow the instructions carefully.
After you complete the setup you should be able to compile TouchLib without any problems.

BTW, I do not recommend installing the ‘CMU 1394 Digital Camera Driver’ if you already have firewire camera with its drivers installed.

~Alex

 Signature 

Computing is not about computers any more.  It is about living!

Code Laboratories
CL Studio Live - Video like never before
CL Eye Platform SDK

Profile
 
 
   
1 of 3
1