[vtkusers] importing video to VTK

Xu Zhong Hao xyzhao at singnet.com.sg
Sun Mar 7 00:33:48 EST 2004


Hi All

I 've got some problem importing some video into vtk, i am using 
ARtoolkit to capture frames and feed into vtkimageActor frame by frame 
in a loop. The the image actor was added to a 2nd renderer on top of 
the medical3 renderer. However, i can have only one picture onto the 
skull instead of the video when i run on a pc and on mac, i can only 
have a blank screen onto the skull. this is the video loop


static void mainLoop(void)
{

     ARUint8         *dataPtr;
	unsigned char			*processedImg;
	
	/* grab a vide frame */
	
	/* if ((dataPtr = (ARUint8 *)arVideoGetImage()) ==NULL)
	 {
		arUtilSleep(2);
		ren1->Clear();
		return;
	}
	
   if( count == 0 ) arUtilTimerReset();	
   count++;*/
dataPtr = (ARUint8*) arVideoGetImage();
	  processedImg = reorderImagePix(dataPtr);


    // vtkImageImport *importer = vtkImageImport::New();
	importer->SetDataScalarTypeToUnsignedChar();
	importer->SetImportVoidPointer((void * ) processedImg);
	//importer->SetWholeExtent(0, 1, 0, 1, 0,0);
	//importer->SetDataExtentToWholeExtent();
	//importer->SetNumberOfScalarComponents( 3 );
	//importer->SetDataSpacing(1,1,1);
	//vtkImageMapToColors *picColors = vtkImageMapToColors::New();
	//vtkLookupTable* imageTable = vtkLookupTable::New();
	//imageTable->SetTableRange(0,2000);
	//imageTable->SetHueRange(0.6,0.6);
	//imageTable->SetSaturationRange(0,1);
	//imageTable->SetValueRange(1,1);
	//imageTable->SetAlphaRange(0,1);
	//picColors->SetLookupTable(imageTable);
     picColors->SetInput(importer->GetOutput());

     picActor->SetInput(importer->GetOutput());
     picActor->SetDisplayExtent(0,xsize-1, 0,ysize-1, 0,0);
		 //ren1->AddActor(picActor);
		//ren1->Modified();
		//ren1->Clear();
		//renWin->Render();
		//ren1->Render();

     arVideoCapNext();


     argSwapBuffers();
}


when the ren1 is uncommented, the program will hand, please help to see 
the problem..


Zhong Hao
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 3347 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040307/ece61c1e/attachment.bin>


More information about the vtkusers mailing list