GetFrameImage throws exception

Post Reply
Veehmot
Posts: 10
Joined: Fri Mar 06, 2009 5:28 am

GetFrameImage throws exception

Post by Veehmot » Mon Jun 29, 2009 7:45 am

When I try to use GetFrameImage() I get this error:
Unhandled exception at 0x77e78197 in Texture Project.exe: 0xC0000005: Access violation reading location 0x0a0a0a0e.
All other functions works ok. I have used this function before, but I get this error when trying to use this DLL.

This is my Debug Log:

[spoiler]

Code: Select all

'Texture Project.exe': Loaded 'C:\Development\Programming\Unity\TexturePlugin\TexturePlugin\Texture Project\Texture Project\Texture Project.exe'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\user32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\secur32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\shell32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\ole32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\version.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\glu32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\winmm.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\ws2_32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\ws2help.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\dinput.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\imm32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\alcxnt.dll', Binary was not built with debug information.
'Texture Project.exe': Unloaded 'C:\WINDOWS\system32\alcxnt.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\alcxnt.dll', Binary was not built with debug information.
'Texture Project.exe': Unloaded 'C:\WINDOWS\system32\alcxnt.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\alcxnt.dll', Binary was not built with debug information.
'Texture Project.exe': Unloaded 'C:\WINDOWS\system32\alcxnt.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\alcxnt.dll', Binary was not built with debug information.
'Texture Project.exe': Unloaded 'C:\WINDOWS\system32\alcxnt.dll'
'Texture Project.exe': Loaded 'C:\Development\Programming\Unity\TexturePlugin\TexturePlugin\Texture Project\Texture Project\Data\unity\wrap_oal.dll', Binary was not built with debug information.
'Texture Project.exe': Loaded 'C:\Development\Programming\Unity\TexturePlugin\TexturePlugin\Texture Project\Texture Project\Data\unity\mono-1-vc.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\psapi.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\d3d9.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\d3d8thk.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\clbcatq.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\comres.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\wbem\wbemprox.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\wbem\wbemcomn.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\xpsp2res.dll', Binary was not built with debug information.
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\wbem\wbemsvc.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\wbem\fastprox.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\msvcp60.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\ntdsapi.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\dnsapi.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\netapi32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\wldap32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\msctf.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\msctfime.ime'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\dinput8.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\hid.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\wintrust.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\crypt32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\msasn1.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\imagehlp.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\dsound.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\alcxnt.dll', Binary was not built with debug information.
'Texture Project.exe': Unloaded 'C:\WINDOWS\system32\alcxnt.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\alcxnt.dll', Binary was not built with debug information.
'Texture Project.exe': Unloaded 'C:\WINDOWS\system32\alcxnt.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\wdmaud.drv'
'Texture Project.exe': Unloaded 'C:\WINDOWS\system32\wdmaud.drv'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\wdmaud.drv'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\msacm32.drv'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\msacm32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\midimap.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\ksuser.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\rsaenh.dll'
'Texture Project.exe': Loaded 'C:\Development\Programming\Unity\TexturePlugin\TexturePlugin\Texture Project\Texture Project\Data\Plugins\UnityTexture.dll', Symbols loaded.
'Texture Project.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597c3456\msvcr90d.dll', Symbols loaded.
'Texture Project.exe': Loaded 'C:\Program Files\NaturalPoint\Optitrack\bin\OptiTrack.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\mfc42u.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\atl.dll'
'Texture Project.exe': Loaded 'C:\Program Files\NaturalPoint\Optitrack\bin\cameradll.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\mfc42.dll'
'Texture Project.exe': Loaded 'C:\Program Files\NaturalPoint\Optitrack\bin\xerces-c_2_5_0.dll', Binary was not built with debug information.
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\avifil32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\msvfw32.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\mfc42loc.dll', Binary was not built with debug information.
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\msi.dll'
'Texture Project.exe': Loaded 'C:\WINDOWS\system32\sxs.dll'
The thread 'Win32 Thread' (0x13d0) has exited with code 1 (0x1).
Bad footer CRC on incoming data

First-chance exception at 0x04b441da in Texture Project.exe: 0xC0000005: Access violation writing location 0x00246000.
First-chance exception at 0x77ef440a in Texture Project.exe: 0xC0000005: Access violation reading location 0x0a0a1614.
First-chance exception at 0x77e78197 in Texture Project.exe: 0xC0000005: Access violation reading location 0x0a0a0a0e.
Unhandled exception at 0x77e78197 in Texture Project.exe: 0xC0000005: Access violation reading location 0x0a0a0a0e.
The program '[4948] Texture Project.exe: Native' has exited with code 0 (0x0).
[/spoiler]

This is my project:

Mirror 1
Mirror 2
Mirror 3

Veehmot
Posts: 10
Joined: Fri Mar 06, 2009 5:28 am

Re: GetFrameImage throws exception

Post by Veehmot » Mon Jun 29, 2009 11:30 am

Ok if I write it this way it works:

camera->GetFrameImage(frame, width, height, 0, 8, 0));

This is, without sending out a buffer. So It's obvious it's a size thing.

Since my buffer has to be of size:

(PixelWidth x PixelHeight x (BitsPerPixel / 8))

Is this enough?:

buffer = new BYTE[640*480];

Birch
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon

Re: GetFrameImage throws exception

Post by Birch » Mon Jun 29, 2009 3:36 pm

Yes, that should work for the buffer size.

Here is some code bits extracted from one of our samples :


#define IMAGE_BPP 8
#define BUFFER_FRAME_SIZE 640*480
static unsigned char bufFrameCurrent[BUFFER_FRAME_SIZE];

camera->get_Width (&width);
camera->get_Height (&height);

camera->GetFrameImage(frame, width, height, width * (IMAGE_BPP/8), IMAGE_BPP, (byte *) bufFrameCurrent);

Post Reply