Items with no label
3335 Discussions

Error creating a projection

idata
Employee
1,721 Views

Hi, i´m trying to create a projection, i have actually created it following the steps of the SDK documentation,but when i run my program i get an error of reading access, i think i might be doing something wrong with projection, i dón´t know if i need to use projection while i´m recording with the camera... i´m taking a frame from a recorded file with de r200 an trying to obtain the dept and color values with ProjectColortoCamera

The error is: " Exception produced at 0x00000000 is CameraViewer.cpp_d.exe: 0xC0000005: Access violation when executing location 0x00000000. "

Here is my code, any ideas of why i´m getting this error?

Thanks!!

void readFrame(pxcCHAR *file, bool record) {

PXCSenseManager* sm = PXCSenseManager::CreateInstance();

// Set file playback name

sm->QueryCaptureManager()->SetFileName(file, false);

// Enable stream and Initialize

sm->EnableStream(PXCCapture::STREAM_TYPE_COLOR, 640, 480, 0);//En la página ponía 0, 0, simplemente.

sm->EnableStream(PXCCapture::STREAM_TYPE_DEPTH, 0, 0, 0);

sm->Init();

// Set realtime=false and pause=true

sm->QueryCaptureManager()->SetRealtime(false);

sm->QueryCaptureManager()->SetPause(true);

// Streaming loop

for (int i = 0; i < 4; i++) {

// Set to work on every frame of data

sm->QueryCaptureManager()->SetFrameByIndex(i);

sm->FlushFrame();

// Ready for the frame to be ready

pxcStatus sts = sm->AcquireFrame(true);

if (sts < PXC_STATUS_NO_ERROR) break;

// Retrieve the sample and work on it. The image is in sample->color.

PXCCapture::Sample* sample = sm->QuerySample();

PXCImage::ImageData data;

PXCImage::PixelFormat format;

format= PXCImage::PIXEL_FORMAT_DEPTH_RAW;

sample->depth->AcquireAccess(PXCImage::ACCESS_READ, format, &data);

int width = sample->color->QueryInfo().width;

int height = sample->color->QueryInfo().height;

if (!format)

format = sample->depth->QueryInfo().format;

//printf("Zona 5\n");

PXCPoint3DF32* cp = new PXCPoint3DF32[width * height*100];

PXCPoint3DF32* cvp = new PXCPoint3DF32[width * height*100];

int *mappedPixels;

for (int j = 0, k = 0; j < height; j++)

{

for (int i = 0; i < width; i++, k++)

{

//Create 3D point with the colour (x,y) coordinates and corresponding z value

if (k == 100000) break;

cp->x = i;

cp->y = j;

cp->z = mappedPixels[j * width + i];

cp++;

}

}

PXCCapture::Device* device; // Here i get the error!!!!!

Projection *projection = device->CreateProjection();

projection->ProjectColorToCamera(height*width,cp, cvp);

projection->Release();

printf("Acabado\n\n");

// Resume processing the next frame

sm->ReleaseFrame();

}

// Clean up

sm->Release();

}

0 Kudos
7 Replies
idata
Employee
405 Views

Hi Migueel,

Thanks for your interest in the Intel® Realsense™ Platform.

I'm sorry to hear that you are having an error while attempting to create a projection. I was able to run the sample Projection in the SDK R2 2016 (https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?sample_projection_cpp.html Intel® RealSense™ SDK 2016 R2 Documentation ) without any issues (Please see image below), I would encourage you to take this sample code and used it as reference.

Please let me know if any questions come up, have a nice day!

Best Regards,

 

-Jose P.
0 Kudos
idata
Employee
405 Views

Hi Jose, thank you for the post.

Do you think that the fact that i´m using a 2012 version could affect the creation of projection? Did you have trouble related to projection in previous versions of the realsense SDK´s?

Thanks Jose!

Regards.

0 Kudos
idata
Employee
405 Views

Hi Migueel,

 

 

I have not found information about issues related to projection in previous versions, however, I'd recommend you to use the Intel RealSense SDK R2 2016.

 

 

Best Regards,

 

-Yermi A.

 

0 Kudos
jb455
Valued Contributor II
405 Views

You need to 'fill in' the device instance first by doing something like

device = pSenseManager.captureManager.QueryDevice();

0 Kudos
idata
Employee
405 Views

Hi guys,

 

 

jb455 thanks for your input!

 

 

Migueel were you able to try the Projection sample in the Intel Realsense SDK R2 2016?

 

 

We will be waiting for your reply, have a nice day!

 

 

Best Regards,

 

-Jose P.
0 Kudos
idata
Employee
405 Views

Hi Jose, yes i have been able to create the projection already.

Thanks for the help guys!!

0 Kudos
idata
Employee
405 Views

Hi Migueel,

 

 

We are here to help! Please don't hesitate to come back if any questions come up.

 

 

Have a great day!

 

 

Best Regards,

 

-Jose P.
0 Kudos
Reply