Software Archive
Read-only legacy content
17061 Discussions

Detecting and Scanning objects on planar space

IEBEI
Novice
545 Views

In this application I use some of the concepts implemented in the DF_3DScan example

I am trying to have an independant detecting and scanning frame windows where the object detection window is running "while(true)" meaning the program does not exit after scanning one object 

The problem appears after I scan the first object, I cannot take the same minFramesBeforeScanStart it seems like minFramesBeforeScanStart is decremneted in the sdk somewhere, and the SDK does not provide much control over this 

Any Ideas?

int main()
{
	PXCSenseManager* pSenseManager = PXCSenseManager::CreateInstance();
	pSenseManager->QuerySession();
	pSenseManager->Enable3DScan();
	pSenseManager->Init();
	PXCCapture::DeviceInfo device_info;
	pSenseManager->QueryCaptureManager()->QueryCapture()->QueryDeviceInfo(0, &device_info);
	PXC3DScan* pScanner = pSenseManager->Query3DScan();
	pxcI32 scanningFramesRemaining = 200;
	int SCAN_FRAMES = scanningFramesRemaining;
	pxcI32 frame = 0;
	pxcI32 firstScanningFrame = 0;
	UtilRender windowScan(L"Scanning");
	UtilRender windowDetect(L"Detecting Object");
	PXC3DScan::Configuration config = pScanner->QueryConfiguration();
	config.minFramesBeforeScanStart = 400;
	config.mode = PXC3DScan::OBJECT_ON_PLANAR_SURFACE_DETECTION;
	config.options = config.options | PXC3DScan::TEXTURE;
	config.options = config.options | PXC3DScan::SOLIDIFICATION;
	pScanner->SetConfiguration(config);
	while (true){
		PXCImage* image = pScanner->AcquirePreviewImage();
		pSenseManager->ReleaseFrame();
		if (pScanner->IsScanning())
		{
			frame++;
			scanningFramesRemaining--;
			if (!firstScanningFrame)
			{
				firstScanningFrame = frame;
				pSenseManager->QueryCaptureManager()->QueryDevice()->SetColorAutoExposure(false);
			}
			else{
				pSenseManager->QueryCaptureManager()->QueryDevice()->SetColorAutoExposure(true);
			}
			UtilRender::RenderProgressBar(image, frame - firstScanningFrame + 1, SCAN_FRAMES, 2);
			windowScan.RenderFrame(image);
			
			if (scanningFramesRemaining == 0){
				PXC3DScan::FileFormat meshFormat = PXC3DScan::OBJ;
				pxcCHAR *meshFileName = //some path;
				frame = 0;
				scanningFramesRemaining = 200;
				pScanner->Reconstruct(meshFormat, meshFileName);
			}
		}
		else{
			windowDetect.RenderFrame(image);
			windowScan.RenderFrame(image);
		}
		image->Release();
	}
	pScanner->Release();
	pSenseManager->Release();
	return 0;
}
0 Kudos
3 Replies
Xusheng_L_Intel
Employee
545 Views

Are you using the latest R4 release? This is a known usability issue which was fixed in the latest (R4) release. In R4, the module no longer controls the delay. And it is up to the caller to implement this delay when needed. Thanks!

0 Kudos
IEBEI
Novice
545 Views

Thank you,

I downloaded the new SDK and it seems that the issue is fixed.

But you guys took away the DF Scan c++ sample :D

and also I am having problems with "pSenseManager->ReleaseFrame();" in the new SDK that I am still trying to debug.

 

0 Kudos
Xusheng_L_Intel
Employee
545 Views

Ok, great. You can use C# 3D scan sample as a reference. Please let me know if you have any issue. Thanks!

0 Kudos
Reply