- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Forum,
I'm working on a 3D-scanner in openframeworks. I recently updated to R2 of the SDK, and my R1-based project wasnt working anymore. For some reason i have an read-access violation when i release access to my ImageData. When i do not release it, well, you have a memory-hungry application.
This is the part of the update where everyting is going south;
PXCImage *previewImage = scanModule->AcquirePreviewImage(); if (previewImage && uPreview) { PXCImage::ImageData previewData; PXCImage::ImageInfo previewInfo = previewImage->QueryInfo(); if (logImageTypes) ofLogNotice("senseManger previewImage: " + ofToString(previewInfo.width) + ", " + ofToString(previewInfo.height) + " in: " + convertWString(PXCImage::PixelFormatToString(previewInfo.format))); if (!previewPixels.isAllocated()) previewPixels.allocate(previewInfo.width, previewInfo.height,ofPixelFormat::OF_PIXELS_BGR); if (previewPixels.getWidth() != previewInfo.width) previewPixels.resize(previewInfo.width, previewInfo.height); pxcStatus accessStatus = previewImage->AcquireAccess(PXCImage::ACCESS_READ, PXCImage::PIXEL_FORMAT_RGB24, &previewData); if (accessStatus == PXC_STATUS_NO_ERROR) { previewPixels.setFromExternalPixels(reinterpret_cast<uint8_t*>(previewData.planes[0]), previewInfo.width, previewInfo.height, ofPixelFormat::OF_PIXELS_BGR); previewImage->ReleaseAccess(&previewData); previewImage->Release(); } else { //everything is terrible. }
I can imagine that setFromExternalPixels isnt done yet and causes the error, however im using that for the color and depth stream as well. Not giving any problems. Is there any other way that using acquireAccess and releaseAccess?
Tom
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Solved. Either publish or dont. I found this a bit voodoo-ish method.
previewImage is released at the start of the new frame aqcuire.
if(previewImage != nullptr){ previewImage->Release(); previewImage = NULL; } // rest of frameaqcuire
The access to previewImage is released earlier, in the frameRelease function.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page