还是完全依赖于大黄蜂(或任何其他点灰度成像传感器)? 我正在尝试链接bumblebee 2立体声装备附带的立体声处理API来处理一些离线图像。看来,triclops立体声功能需要一些上下文标志和校准文件,格式为input.cal和input.ppm(即一个包含两个立体校正图像的图像以某种方式模糊和重叠)。如何从其他离线图像获取此input.ppm文件仍然可以使用triclops立体声API。那么校准文件input.cal怎么样才能获得它与离线图像一致以及如何?
答案 0 :(得分:2)
是的,Triclops API可用于处理离线图像。您指出的要求是来自相机和图像文件的校准文件(.cal)。校准文件最好在图像捕获时提取,但根据我的经验,除非您更改设置,它始终保持不变。为了满足Triclops API的输入,您还需要使用Point Grey Fly Capture API,因为它提供了图像转换的方法。我的项目正在完成您所要求的所有内容。我在场中捕获原始像素交错图像,然后使用FlyCapture和Triclops API处理它们,以创建整流和视差图像以及立体对中的点云。
检查Point Grey样本及其API文档,了解如何捕获校准文件。基本上这个方法是这样的:flycaptureGetCalibrationFileFromCamera( context, &szCalFile );
上下文是'相机上下文'
您的初始图像文件格式会改变转换方法,但在我的情况下,我使用C ++进行从原始到立体声的转换。我正在使用大黄蜂XB3彩色相机,原始图像尺寸为1280x960,并从外部两个相机中抓取图像:
// Read raw file
//pFile = fopen ( "FlyCap.raw" , "rb" );
pFile = fopen ( argv[1] , "rb" );
if (pFile==NULL) {fputs ("File error",stderr); exit (1);}
// Set raw file size
ISize = (numCols*numRows*bytesPerPixel);
// allocate memory to contain the whole file:
buffer = (unsigned char*) malloc (sizeof(char)*ISize);
if (buffer == NULL) {fputs ("Memory error",stderr); exit (2);}
// copy the file into the buffer:
result = fread (buffer,1,ISize,pFile);
if (result != ISize) {fputs ("Reading error",stderr); exit (3);}
// Create the FlyCapture Context for processing
fe = flycaptureCreateContext( &flycapture );
_HANDLE_FLYCAPTURE_ERROR( "flycaptureCreateContext()", fe );
fe = flycaptureSetColorProcessingMethod(flycapture, FLYCAPTURE_HQLINEAR);
_HANDLE_FLYCAPTURE_ERROR( "flycaptureSetColorProcessingMethod()", fe );
fe = flycaptureSetColorTileFormat(flycapture, FLYCAPTURE_STIPPLEDFORMAT_GBRG);
_HANDLE_FLYCAPTURE_ERROR( "flycaptureSetColorTileFormat()", fe );
//Import the raw image in buffer into FlyCaptureImage structure
flycaptureImage.iCols = 1280;
flycaptureImage.iRows = 960;
flycaptureImage.iNumImages = 2;
flycaptureImage.bStippled = true;
flycaptureImage.pixelFormat = FLYCAPTURE_RAW16;
flycaptureImage.iRowInc = 2560;
flycaptureImage.timeStamp.ulSeconds = 100;
flycaptureImage.timeStamp.ulMicroSeconds = 100;
flycaptureImage.pData = buffer;
// Create buffers for holding the color and mono images
unsigned char* rowIntColor =
new unsigned char[ numCols * numRows * flycaptureImage.iNumImages * 4 ];
unsigned char* rowIntMono =
new unsigned char[ numCols * numRows * flycaptureImage.iNumImages ];
// Create a temporary FlyCaptureImage for preparing the stereo image
FlyCaptureImage tempColorImage;
FlyCaptureImage tempMonoImage;
tempColorImage.pData = rowIntColor;
tempMonoImage.pData = rowIntMono;
// Convert the pixel interleaved raw data to row interleaved format
fe = flycapturePrepareStereoImage( flycapture, flycaptureImage, &tempMonoImage, &tempColorImage );
_HANDLE_FLYCAPTURE_ERROR( "flycapturePrepareStereoImage()", fe );
//Save side-by-side color stereo image
fe = flycaptureSaveImage( flycapture, &tempColorImage, stereoimg, FLYCAPTURE_FILEFORMAT_PPM );
_HANDLE_FLYCAPTURE_ERROR( "flycaptureSaveImage()", fe );
printf ("Saving Stereo...\n");
请注意,到目前为止,我根本没有使用Triclops API。 flycaptureSaveImage();
的输出是Triclops方法的输入。此时有一些选项可以处理颜色与单色。看看他们的Triclops API附带的Point Grey示例'stereoto3dpoints.cpp'它从我离开的地方接管。我希望这能够帮到你。