This basic example shows you how to start using a 3D scanner in the SDK.The code below includes all the necessary steps to initialize a device, capture a single frame and store the resulting 3D surface to an OBJ file on the disk.
- Note
- If you need a comprehensive sample with efficient multithreading and frame registration, consider using scanning-and-process-sample.cpp.
| The files required for compiling this sample are packed in the archive. | 
#undef NDEBUG
#include <string>
#include <iostream>
namespace asdk {
};
using asdk::TRef;
using asdk::TArrayRef;
int main( int argc, char **argv )
{
    
    
    
    
    
    
    std::wcout << L"Enumerating scanners... ";
    {
        std::wcout << L"failed" << std::endl;
        return 1;
    }
    std::wcout << L"done" << std::endl;
    int scanner_count = scannersList->getSize();
    if( scanner_count == 0 )
    {
        std::wcout << L"No scanners found" << std::endl;
        return 3;
    }
    const asdk::ScannerId* idArray = scannersList->getPointer();
    const asdk::ScannerId& defaultScanner = idArray[0]; 
    std::wcout 
        << L" scanner " << defaultScanner.serial << L"... "
    ;
    {
        std::wcout << L"failed" << std::endl;
        return 2;
    }
    std::wcout << L"done" << std::endl;
    std::wcout << L"Capturing frame... ";
    ec = scanner->createFrameProcessor( &processor );
    {
        frame = NULL;
        ec = scanner->capture( &frame, true ); 
        {
            mesh = NULL;
            ec = processor->reconstructAndTexturizeMesh( &mesh, frame );
            {
                std::wcout << L"done" << std::endl;
                
                ec = asdk::io::Obj::save( L"frame.obj", mesh ); 
                
                
                
                
                int normalCount = pointsNormals.size();
                
                std::wcout << L"Captured mesh saved to disk" << std::endl;
            }
            else
            {
                std::wcout << L"failed" << std::endl;
            }
        }
    }
    scanner = NULL;
    std::wcout << L"Scanner released" << std::endl;
    return 0;
}