Blog’s new home…

•March 30, 2009 • 1 Comment

I finnaly got around registering my own domain. This blog is therefore moved there.

I will not post any updates of my posts here  so please update your links. In addition to that on my new site I added a forum that you can join. My new site is at: http://www.alexpopovich.com/blog/

See you all there!!!

MacBook Rev. F Audio Skipping in Vista Analisys and Solution – Part 2

•December 22, 2008 • 10 Comments

In my previous post I talked about reducing the DPC latency in order to prevent frequent audible clicks and audio skipping. The solution was to fix the CPU affinity in the KbdMgr.exe file. This resulted in great reduction of DPC latency of the system. 

The Problem

However, I noticed that every 50-60 seconds the DPC latency spiked to about 16ms. Since most professional audio software requires absolute low latency at all times, this DPC spikes will result in audible skips in those high-performance audio programs. I decided to look into this more closely.

latencyrevisited1

As it turns out (by the process of elimination) this spikes are caused by the Broadcom wireless driver. As seen in devince manager:

broadcom-devmgr1

Here are the driver details:

broadcom-driver

The reason why this spikes happen every 60 seconds or so is that, when enabled, Vista is actively scanning and detecting available wireless network and managing wireless network profile. The service responsible for this is called ‘WLAN AutoConfig Service’ which is similar to ‘Wireless Zero Configuration service’ in XP. 

Since this service is required in order for us to establish a wireless conection, we cannot just disable it. 

The Solution

The quickest thing is to create two cmd files and allow user to manually turn on and off the WLAN autoconfig feature. Here is what I have done. I created two files and placed them on my desktop. After establishing a wireless connection to my access point, I double-click on the ’WlanAutocfgOff.cmd’. This turns off the WLAN autoconfig feature, but keeps me connected to my access point. In order to later be able to connect to it again (eg. after Windows restart), I just double-click on ’WlanAutocfgOn.cmd’ and wait until I get connected. Then after establishing a wireless connection to my access point, I double-click on the ’WlanAutocfgOff.cmd’to stop DPC spikes from happening again. 

File ‘WlanAutocfgOn.cmd’:

netsh wlan set autoconfig enabled=yes interface="Wireless Network Connection"

 
File ‘WlanAutocfgOff.cmd’:

netsh wlan set autoconfig enabled=no interface="Wireless Network Connection"

As you can see each file consists of single command.

After running ‘WlanAutocfgOff.cmd’, the DPC spikes will be gone (max latency ~1ms), and you’ll be able to use your pro audio app of choice without any skipping and stuttering.

latencyrevisited2

MacBook Rev. F Audio Skipping in Vista Analisys and Solution – Part 1

•October 30, 2008 • 31 Comments

Last week I got the latest Apple’s 13.3″ MacBook Rev. F. (aluminum unibody model)

This is an amazing looking laptop, and is one of the fastest performing laptops out there. I decided to have dual boot OS and installed Vista and Apple’s BootCamp.
Here is MacBook’s performance index in Vista:

As you can see, the overall rating is pretty high and the graphics card has pretty high rating (5.4) as well. One nice thing is that at the back Apple gave us easy access to the hard drive on the back. This makes a very easy upgrade. The thing that I found is that this is the only laptop that can fit new 500GB SATA laptop drives which are thicker (12.5mm) than standard 250GB laptop drive (9.5mm). So I managed to easily upgrade mine to 500GB 5400rpm Hitachi laptop drive.

The Problem

After playing with MacBook for a while on Vista, I noticed that when playing music, frequently there are audible clicks and audio skipping. This was even more audible when I was listening streamed radio stations over shoutcast network. On top of this, I think that there is significant reduction of the MacBook battery run time as well (comparing to OSX). I decided to investigate this more closely.

In short, I found, the reason why this happens is because of the exceptionally high DPC latency.

Why Audio Drop-outs Occur?

(Taken from http://www.thesycon.de/deu/latency_check.shtml)

Processing of streaming data in real-time is a very challenging task for Windows based applications and device drivers. This is because by design Windows is not a real-time operating system. There is no guarantee that certain (periodic) actions can be executed in a timely manner.

Audio or video data streams transferred from or to an external device are typically handled by a kernel-mode device driver. Data processing in such device drivers is interrupt-driven. Typically, the external hardware periodically issues interrupts to request the driver to transfer the next block of data. In Windows NT based systems (Windows 2000 and better) there is a specific interrupt handling mechanism. A device driver cannot process data immediately in its interrupt routine. It has to schedule a Deferred Procedure Call (DPC) which basically is a callback routine that will be called by the operating system as soon as possible. Any data transfer performed by the device driver takes place in the context of this callback routine, named DPC for short.

The operating system maintains DPCs scheduled by device drivers in a queue. There is one DPC queue per CPU available in the system. At certain points the kernel checks the DPC queue and if no interrupt is to be processed and no DPC is currently running the first DPC will be un-queued and executed. DPC queue processing happens before the dispatcher selects a thread and assigns the CPU to it. So, a Deferred Procedure Call has a higher priority than any thread in the system.

Note that the Deferred Procedure Call concept exists in kernel mode only. Any user-mode code (Windows applications) runs in the context of a thread. Threads are managed and scheduled for execution by the dispatcher.

While there is a pre-emptive multitasking for threads, DPCs are executed sequentially according to the first in, first out nature of a DPC queue. Thus, a sort of cooperative multitasking scheme exists for Deferred Procedure Calls. If any DPC runs for an excessive amount of time then other DPCs will be delayed by that amount of time. Consequently, the latency of a particular DPC is defined as the sum of the execution time of all DPCs queued in front of that DPC. In order to achieve reasonable DPC latencies, in the Windows Device Driver Kit (DDK) documentation Microsoft recommends to return from a DPC routine as quick as possible. Any lengthy operation and specifically loops that wait for a hardware state change (polling) are strongly discouraged.

Unfortunately, many existing device drivers do not conform to this advice. Such drivers spend an excessive amount of time in their DPC routines, causing an exceptional large latency for any other driver’s DPCs. For a device driver that handles data streams in real-time it is crucial that a DPC scheduled from its interrupt routine is executed before the hardware issues the next interrupt. If the DPC is delayed and runs after the next interrupt occurred, typically a hardware buffer overrun occurs and the flow of data is interrupted. A drop-out occurs.

The Solution

After running the DPC Latency Checker program, I found that the excessive DPC latency was indeed the cause of all the audio skipping. 

Here is the DPC Latency with my MacBook idling:

At moments the latency was as high as 30.5ms!

After running the Process Explorer program I was able to track down the program that was causing the problem. It was the Apple’s KbdMgr.exe. This program is responsible for managing the keyboard, handling the special keys and displaying the OSD (on-screen-display) when you, for example, change screen brightness. 

For a program that is mostly idle the KbdMgr.exe consumes quite a lot of CPU cycles.

You can see that KbdMgr has eight threads, but only one of them constantly consumes high number of CPU cycles. After inspecting the API calls that thread (TID 1352) makes, I found that the main cause for the high CPU cycles is the bad KbdMgr’s multiprocessor implementation (deadlock situation betwen CPU cores in User/Kernel mode). In another words, by simply limiting KbdMgr to a CPU core #1 (CPU affinity) and optionally setting KdbMgr’s priority to Idle, the DPC latency of my MacBook improved dramatically:

As you can see the latency went from whopping high 30.5ms down to 1ms. The result was smooth audio playback with no skipping, much more responsive machine and improved laptop’s battery life.

Here is the fix: KbdMgr.rar
The new fixed version will automatically run on CPU #1 with low priority and will reduce the DPC latency of MacBook.

Installation:
1. Go to Task Manager and kill KbdMgr.exe process
2. Download and extract the contents of the KbdMgr.rar file to a temporary directory
3. Backup the original KbdMgr.exe file located in C:\Program Files\Boot Camp directory
4. Copy new KbdMgr.exe file to C:\Program Files\Boot Camp directory
5. Restart your machine

PS3Eye Camera SDK for use in your own applications!!!

•October 20, 2008 • 45 Comments

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

 
If you find the software useful or if you feel like supporting this project, please feel free to click the donation link below.

 

And of course, the files: PS3EyeSetup (v2.0b81021) and PS3Eye TouchLib (rev400) build.

Enjoy!

Sony PS3Eye Camera TouchLib, DirectShow and more…

•October 17, 2008 • 38 Comments

I’m pleased to announce the new release of the PS3Eye driver. The camera code had been completely rewritten from the ground up. The driver now uses Microsoft’s WinUSB driver. I decided to go this route since the old driver had some performance issues. It is strange that Sony have chosen to stream video over USB bulk transfer pipe. Usually, video and audio USB devices use isohronous transfers since they have higher priority. On a slower systems this results in the video frame data drop resulting in shifted (out of sync) image.

Anyways, the good new is that this time around the driver will work with both x86 and x64 version of Windows (XP and Vista). This will hopefully make many of you who were asking for x64 version very happy.

Installation

Please make sure you completely remove any previous versions of PS3Eye drivers and software. 
You can easily check if this is done properly by plugging the camera checking if Windows detects and automatically installs the driver. 
If it doesn’t, the driver has been removed. To install download and run the latest PS3EyeSetup file and follow the instructions. 
If your camera is not automatically detected when you plug it in, point the device manager to the Driver directory under the installation path. The driver will install and your camera is now ready. 
VC++ 2005 SP1 redistributable is also included in the PS3EyeSetup for your convenience.

PS3Eye as DirectShow Capture Device

The PS3Eye.ax is the DirectShow video capture component that is automatically registered by the PS3EyeSetup. It exposes the camera frames in the RGB24 color format for better software compatibility. Here is the list of currently supported resolutions and frame rates:

  • 320×240 @ 15fps 
  • 320×240 @ 30fps 
  • 320×240 @ 60fps 
  • 320×240 @ 75fps 
  • 320×240 @ 100fps 
  • 320×240 @ 125fps 
  • 320×240 @ 150fps (experimental) 
  • 640×480 @ 30fps 
  • 640×480 @ 40fps 
  • 640×480 @ 50fps 
  • 640×480 @ 60fps 
  • 640×480 @ 75fps (experimental)

PS3Eye TouchLib Build

I am very excited to announce the first TouchLib build that now fully supports the PS3Eye camera. All of the above resolutions and frame rates are supported in the current build. 
I implemented a new TouchLib filter called ps3eyecapture that loads the PS3Eye driver directly and allows the use of this device in multitouch applications. The direct to PS3Eye camera through the driver guaranties the minimal capture latency.

To select the desired resolution and frame rate, just uncomment the format parameter line as shown here:

TouchLibFilterGraph.jpg

NOTE: Please make sure you backup the config.xml file before running TouchLib since it will overwrite it on exit and you will lose all of the commented formats.

And of course, the files: PS3EyeSetup (v2.0b81109) and TouchLib (PS3Eye) build .

Enjoy!

If you find the software useful or if you feel like supporting this project, please feel free to click the donation link below.

Sony PS3Eye Camera DirectShow Capture Source Filter *Update* v2.1.0.0130

•October 2, 2008 • 505 Comments

Well, here it is… 
I managed to put together a first version of the DirectShow capture filter for PS3Eye camera. 
This will allow us to use this great camera in various Windows applications (assuming they are compatible with DirectShow system) including TouchLib for use in multitouch applications.

I made single PS3EyeSetup application that will install PS3Eye driver, DirectShow filter and test applications all at once. It will also allow for clean Unistall, for those of you that are experiencing problems with Flash content in IExplorer and Mozilla browsers. Please note that before running Uninstaller you must close any application that uses PS2Eye camera or some of the camera component will not be properly removed.

Installation Steps:

- Unplug the PS3Eye camera from your comupter.
- Uninstall any previous version of PS3Eye software.
- Download and run the latest PS3EyeSetup file.
- Click ‘Install’ and follow the setup process.
- Plug in the camera.

After successful installation, your Device Manager should look similar to this: 

You can run the PS3EyeTest application from the start menu at this point to verify if camera installed properly. You’ll see something like this:

I added the option of controlling the camera settings such as Gain, Exposure, White balance etc.

DirectShow Video Source for PS3Eye camera will also be installed, registered and ready for use. To test if PS3Eye DirectShow component functions properly, run the AmCap application from the start menu.

After a few moments the camera will start capturing and the AMCAP will show the camera preview in its window: 

Camera properties selects video format:

Camera settings:

Currently the PS3Eye camera DirectShow component is set by default to capture uncompressed 640×480 RGB (24bit) video at 30fps. 

Now you can enjoy using this great camera in your favorite Windows app!

NOTE: Thank you all for your feedback. For those of you who are experiencing problems, you can now uninstall the software by running Uninstall from the start menu. If for some reason the camera DirectShow files (PS3Eye.ax and PS3EyeLib.dll) are not removed and still on your system, follow these steps to manually remove them:

Manual removal of PS3Eye.ax and PS3EyeLib.dll files:

- Close any program that are using PS3Eye camera.
- Press ‘WinKey’+R on your keyboard or alternatively go to Start->Run
- Type the following: regsvr32 /u “C:\Program Files\AlexP\PS3Eye.ax”
- You will see the following dialog box confirming successful un-registration of the PS3Eye.ax file.

- Now you can safely delete PS3Eye.ax and PS3EyeLib.dll from your machine.

If the manual removal steps above fail for some reason, run your Windows in safe mode and repeat these steps.

To Do List:

– Make Setup application
– Create camera property pages
– Add camera resolution selection (640×480, 320×240, 160×120)
- Add selectable camera capture window (x, y, width, height)
– Add capture frame rate adjustment (640×480@60fps max, 320×240@120fps max)
– Add selection of Auto/Manual camera operation modes
– Manual adjustment for Exposure and Gain
– Add RGB-16/24/32 color output format (this will increase compatibility with the software out there)
– Implement 64-bit version of the PS3Eye driver

I am currently working on implementing these features. As am only working part-time on this project please be patient and check here for future updates.

NOTE: Since currently I do not control the PS3Eye’s microphone (detected and installed by Windows by default), there is no way for me to make sure that every program that uses both camera and microphone will work properly. I am aware that there are some issues with this when running WML and other programs on some machines. I am currently looking into this and possibly a way to find a workaround.

And most importantly, the PS3Eye Setup file:

PS3EyeSetup (v1.0b81006)

Notes (v1.0b81006): I worked on major bug fix. Flash player camera capture now works properly. I successfully tested it on http://www.cameroid.com

PS3EyeSetup (v1.0b81007)

Notes (v1.0b81007): Increased compatibility by setting default capture frame rate to 15fps for DirectShow filter (320×240), making it fully compatible with Flash and many video conferencing programs out there. Fixed ‘green screen’ bug.

PS3EyeSetup (v1.0b81008)

Notes (v1.0b81008): Fixed preview/capture issue with AMCAP and other programs. The camera resources are properly released now.

PS3EyeSetup (v2.0b81019)

Notes (v2.0b81019): 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. Included PS3EyeLib SDK as described here.

PS3EyeSetup (v2.0b81021)

Notes (v2.0b81021): Driver installation tested on both Vista x86 and x64 it now works properly and driver files are found correctly. As of this version (v2.0b81021) the PS3EyeLib driver uses the advanced thread scheduling features only available in Vista. This greatly improves its performance and stability on this OS.

PS3EyeSetup (v2.0b81029)

Notes (v2.0b81029): New version of driver now supports resolution selection as well as the adjustment of the camera settings such as Gain, Exposure, White balance etc. Please make sure you fully uninstall any previous version of PS3Eye software you have on your machine before installing this latest release.

PS3EyeSetup (v2.0b81109)

Notes (v2.0b81109): Fixed crash problems with various browsers involving Flash content, including crashes when going into ‘Settings’ option in the embedded Flash player. This also fixes problems some experienced with MSN, Skype and others. Succesfully tested the new version on the Cameroid website. Please make sure you fully uninstall any previous version of PS3Eye software you have on your machine before installing this latest release.

PS3EyeSetup (v2.0b81111) (MD-5: 7DCDCDBF6B0E184AEAA8E709F259E576)

Notes (v2.0b81111): Fixed bug that caused errors in AMCAP in the previous version. At the same time fixed error issues in Flash player. Some of you reported that there is a worm in a setup file. After investigating the issue I found out that my ISP’s server was infected. They fixed the issue and I uploaded the setup file again. I included the MD-5 checksum of the original file. I tested this file with both Kaspersky and Avast! and it is clean.

The camera was tested and works with Skype. Here are some screenshots of camera setup window in Skype.

Skype video:

Camera settings:

PS3EyeSetup (v2.0b81231) (MD-5: EB14A19766BE5DEC8340E78C6AC03819)

Notes (v2.0b81231): Fixed issue with ‘file in use’ (write protected) PS3Eye.ax file. This was due to running installer/uninstaller while MSN messenger is opened. Fixed annoying ’software upgrade’ popup.

>>> PS3EyeSetup (v2.1.0.0130) (MD-5: 67F0D2D4D10D3428B3D6F861AD478A12) <<<

Notes (v2.1.0.0130): Thank you for your valuable feedback. I finally tracked down and fixed the annoying popup to upgrade the software. It was due to one of the libraries I was using in my code. I fully rewrote that part.

 

works-on-my-machine-starburst_3

If you find the software useful or if you feel like supporting this project, please feel free to click the donation link below.

 

Differences Between B3.04.06.1 and B4.04.27.1 PS3Eye Camera Firmware

•September 15, 2008 • 3 Comments

The analysis of the differences between B3.04.06.1 and B4.04.27.1 firmware revealed that the only difference between them is the reported amount of power that the device consumes. This information is stored in configuration descriptor in the camera’s EEPROM. 
The B3.04.06.1 version reports 10mA and B4.04.27.1 reports 500mA. This change is due to the fact that in the newer version of the camera the OV538 chip sits directly on the USB bus as opposed to OV534 chip being behind the GL850A USB2.0 hub controller chip.

PS3Eye firmware B3.04.06.1 dump:

PS3Eye firmware B4.04.27.1 dump:

The first two differences belong to the camera device descriptor and refer to the current consumption of this device.

The OV538 Based PS3Eye Camera (Version B4.04.27.1)

•September 10, 2008 • 4 Comments

This newer version of the PS3Eye camera features less parts. In this version Sony removed the GL850A USB2.0 hub thus greatly simplifying their design. Check here if you want to see the internals of the older version of this camera.

 
Here you can see the OV538 USB 2.0 camera controller chip.

 
I marked the I2C signals that can be used to dump the commands sent to the OV7720 as well as data being read from the EEPROM during camera’s boot sequence.

 
The front side of camera’s PCB contains minimal amount of parts in comparison the older camera version.

 
Both versions of PS3Eye camera feature 24C64 (8K) EEPROM chip that contains USB descriptor table as well as the camera’s firmware. Check here for camera firmware difference analisys. I checked the status of the WP pin and it is tied to the GND (EEPROM is not write protected!). This means that camera’s firmware is software upgradeable. By disconnecting (floating) pin 8, you’ll get the OmniVision’s default (OV0534) PID and VIDs (Not recomended unless you are a firmware developer or want to modify camera’s firmware)

Sony PS3EYE (B3.04.06.1) IR Filter Removal and More…

•September 5, 2008 • 8 Comments

After playing with the software part and getting PS3Eye to capture under Windows, I decided to see how difficult is to remove the IR blocking filter from the lens of this camera. Please note that this tutorial is only for experienced users who are interested in using the PS3Eye camera for multitouch applications.

NOTE: The pictures used in this tutorial refer to the camera version B3.04.06.1. This is the older version of PS3Eye camera and features the OV534 USB controller chip. For the pictures of the newer version (B4.04.27.1) of PS3Eye camera featuring OV538 chip scroll down. 
BTW, this tutorial applies to both versions of PS3Eye camera.

I recorded the whole process in a few pictures. In addition I took a closer look at this camera’s chipset.

 
First remove the four screws at the back of the camera.

 
After carefully removing the back cover, you will see the camera’s main board.

 
To remove the front cover of the camera, remove another four screws.

 
Now you’ll have a full access to the camera’s PCB. Note that four microphones are further protected by a plastic cover.

Lets take a closer look at the chipset.

 
The main camera USB2.0 controller chip by OmniVision.

 
The GL850A USB2.0 hub controller chip.

 
Here you see the two clock crystals. One for each chip.

 
The 8K I2C EEPROM chip. This is where the Sony’s camera/audio vendor IDs, product IDs and firmware are stored. By disconnecting (floating) pin 8, you’ll get the OmniVision’s default (OV0534) PID and VID (Not recomended unless you are a firmware developer or want to modify camera’s firmware)

 
This is where the Sony’s GL850A hub vendor and product IDs are stored. By disconnecting (floating) pin 1, you’ll get the Genesys Logic’s default (GL850A) IDs. (Again, not recomended unless you are a firmware developer or want to modify camera’s firmware)

Now, lets remove the lens and IR blocking filter.

 
To do this remove the two CMOS lens screws.

 
Carefully pull off the lens assembly to reveal the OV07720 CMOS sensor.

 
The IR blocking lens is mounted on the inside of the lens, close to the CMOS sensor. It is heat-pressed in, so it is fairly easily removed.

 
After cutting around the IR filter with a sharp knife, you should be able to just pop it out.

 
Here you see the IR blocking filter plastic socket.

 
I was prying to much on the IR filter and cracked it.

Now just follow the reverse steps to put the camera together.

Your camera shoud be ready for Multitouch/IR vision applications. Please note that camera sensor is very sensitive to the IR light which makes it even more attractive (besides the high capture frame rates) for these applications.

Sony PS3Eye Camera on Windows OS

•September 3, 2008 • 34 Comments

Well boys and girls, I’ve been working hard last few weeks to make this great camera work under Windows.

As you may seen it before, here are the specs:

- 4 channel audio input:16 bits/channel, 48kHz, SNR 90db 
- 56º or 75º Field of View zoom lens 
- 2.1 F-stop, <1% distortion, fixed focus (25cm to 8 at 75º FOV) 
- 640 x 480 at 60 frames/second 
- 320 x 240 at 120 frames/second 
- USB.0 high-speed data transfer 
- Uncompressed video or optional JPEG compression

This makes the PS3Eye ideal for multitouch applications. The best part is the price $39.99! I found mine here.

Now, the main problem with this camera is that there are no drivers for Windows. The camera’s chipset info is virtually non-existent on the web. 
After examining the camera internals (pictures here) I found that it features the OV534-LB50 camera USB 2.0 bridge and the OV7720 CMOS VGA sensor. Both of these are made by OmniVision.

I started thinking to my self: “This camera is awesome and it will be such a great and inexpensive replacement for Firefly MV and the like. If we could just get it to work under Windows…”

Initially, I started poking around with the USB trying to send some commands to the PS3Eye and see what happens…

After many long nights I’m bringing you the result: 
- Full VGA (640×480) 60fps video capture test app that features uncompressed high quality raw video 
- Low CPU overhead (since there is no decompression involved on the PC) 
- Very low latency (1 frame time period)

The camera currently streams video in YUYV format, therefore each frame is 640*480*2 bytes. 
At 30fps this amounts to about 17.5MB/s which is pretty low in comparison to the total USB 2.0 bandwidth. 
At 60fps the amount of data gets higher and it could be affected by other peripherals connected to the USB host controller. 
This is why it is recommended that the camera be the only device connected to the USB host controller.

Most of the CPU overhead that I currently have is the color conversion code that is implemented in straight C/C++ without any SIMD optimizations. 
For real (MT) applications this code will go away, since we will be extracting raw grayscale image (every second byte of YUYV).

My driver exposes PS3Eye camera as a device with direct access, thus eliminating the complexities and the overhead of DirectShow system. 
For multitouch applications (where low latency is a key) I will be working on custom PS3EYE capture filter for use in TouchLib. In parallel I will be working on a DirectShow filter that will allow wide use of this camera on Windows. 
NOTE: I am currently running Vista and all the code is developed and tested under this particular OS, but it should work on XP with no problems.

Installation:

- Download and run PS3EyeSetup file.
- Click ‘Install’ and follow the setup process.
- Plug in the camera.

After successful installation, your Device Manager should look similar to this:

Now run the PS3EyeTest.exe program, and the captured video as well as the FPS counter will be displayed.

Go, try it for yourself…

Enjoy!

I created a new single PS3EyeSetup that will autmoatically install all the necessary files.
For more info and up-to-date files go here.

*UPDATE* 10-16-2008
New driver allows the camera to run under x86 and x64 Windows systems.
New TouchLib filter allows the use of this great camera in multitouch applications!!!
Incredible capture frame rates and image quality!!!
Read more here…

If you find the software useful or if you feel like supporting this project, please feel free to click the donation link below.