I’m trying to get a full color QVGA image from the PS3 Eye at 187 frames per second.
I modified the sample called “CLEyeWinFormsTest” in the following ways:
void OnLoaded(object sender, EventArgs e)
{
int w = 0, h = 0;
_camera = CLEyeCreateCamera(CameraUUID(0), CLEyeCameraColorMode.CLEYE_COLOR_PROCESSED, CLEyeCameraResolution.CLEYE_QVGA, 187);
if (_camera == IntPtr.Zero) return;
CLEyeCameraGetFrameDimensions(_camera, ref w, ref h);
CreateBitmap(w, h);
// create thread exit event
_exitEvent = new ManualResetEvent(false);
// start capture here
ThreadPool.QueueUserWorkItem(Capture);
}
void CreateBitmap(int w, int h)
{
// allocate bitmap memory
_ptrBmpPixels = Marshal.AllocHGlobal(w * h);
RtlZeroMemory(_ptrBmpPixels, w * h);
// create bitmap object
Bitmap bmpGraph = new Bitmap(w, h, w, PixelFormat.Format32bppRgb, _ptrBmpPixels);
// setup gray-scale palette
//ColorPalette GrayPalette = bmpGraph.Palette;
//for (int i = 0; i < GrayPalette.Entries.Length; i++)
// GrayPalette.Entries[i] = Color.FromArgb(i, i, i);
//bmpGraph.Palette = GrayPalette;
// set bitmap to the picture box
_form.pictureBox1.Image = bmpGraph;
}
However, when this runs it crashes and complains about memory access problems. In particular this is thrown:
Unhandled exception at 0x72E6E64B (clr.dll) in CLEyeWinFormsTest.exe: 0xC0000005: Access violation reading location 0x00050400.
If there is a handler for this exception, the program may be safely continued.
Followed by a whole bunch of these:
Exception thrown at 0x72E6E64B (clr.dll) in CLEyeWinFormsTest.exe: 0xC0000005: Access violation reading location 0x00050400.
If there is a handler for this exception, the program may be safely continued.
I haven’t been able to tell what’s causing it, but my best guess is that the Bitmap object isn’t setup correctly. Can anyone shed some light on this?
Thanks.