Hello,
At the moment, I'm working on a university project that uses the OpenNI kinect library, to do image processing.
I'm having the following problem
The code is a modification of an existing project, which works perfectly. It has a series of global variables declared on
main.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include "kinect-stuff.h" // this is just a "simplification". There are many includes
#include "imgProc.h" //my object, imgProc
.
.
.
//globals
DepthGenerator g_depth;
ImageGenerator g_image;
//functions, procedures and main
.
.
.
| |
The class imgProc reunites all the image processing functions. In order to do that, we need to use the global variables in main.cpp, so I did the following.
in imgProc.h
1 2 3 4 5 6 7 8 9 10 11 12
|
class imgProc
{
private:
DepthGenerator * _g_depth;
ImageGenerator * _g_image;
DepthMetaData _g_depthMD;
ImageMetaData _g_imageMD;
public:
imgProc(DepthGenerator& dg, ImageGenerator& ig);
~imgProc(void);
| |
in imgProc.cpp
1 2 3 4 5 6 7 8 9 10
|
imgProc::imgProc(DepthGenerator& dg, ImageGenerator& ig){
_g_depth = &dg;
_g_image = &ig;
_g_depth->GetMetaData(_g_depthMD); // CRASH
_g_image->GetMetaData(_g_imageMD);
}
imgProc::~imgProc(void)
{
}
| |
Now, on main.cpp i do
imgProc p(g_depth, g_image);
The code compiles properly. However, I obtain the following error executing the application
Uncontrolled exception in 0x654ed455 in NiSimpleViewer.exe (The executable file)
: 0xC0000005: access infraction reading 0x00000050
(Sorry if the translation isn't perfect, the error was in spanish )
Thanks in advance for your help