Exemple #1
0
CLevel::CLevel() :
#ifdef __NEBULA_STATS__
    statsNumSpaceCollideCalled(0),
    statsNumNearCallbackCalled(0),
    statsNumCollideCalled(0),
    statsNumCollided(0),
    statsNumSpaces(0),
    statsNumShapes(0),
    statsNumSteps(0),
#endif
	TimeToSim(0.0),
	StepSize(0.01),
	CollisionSounds(0.0),
	ODEWorldID(0),
	ODEDynamicSpaceID(0),
	ODEStaticSpaceID(0),
	ODECommonSpaceID(0),
	ContactJointGroup(0),
	Gravity(0.0f, -9.81f, 0.0f)
{
	PROFILER_INIT(profFrameBefore, "profMangaPhysFrameBefore");
	PROFILER_INIT(profFrameAfter, "profMangaPhysFrameAfter");
	PROFILER_INIT(profStepBefore, "profMangaPhysStepBefore");
	PROFILER_INIT(profStepAfter, "profMangaPhysStepAfter");
	PROFILER_INIT(profCollide, "profMangaPhysCollide");
	PROFILER_INIT(profStep, "profMangaPhysStep");
	PROFILER_INIT(profJointGroupEmpty, "profMangaPhysJointGroupEmpty");
}
Exemple #2
0
int main()
{
	PROFILER_INIT();

	FrameList frameList(10);	// Keep a history of up to 100 frames (might be used by some modules)
	
	// Modules
	//BackgroundModelling_simple::BackgroundModel backgroundModel;
	BackgroundModelling::BackgroundModel backgroundModel;
	ForegroundProcessing::ForegroundProcessor foregroundProcessor;
	Identification::Identifier identifier;
	Prediction::Kalman kalmanFilter;
	Evaluation evaluate(&frameList, 20);

	// Init
	foregroundProcessor.setAlgortihm(ForegroundProcessing::SLOW); //Use slow, toggle shadows in the init command
	foregroundProcessor.init(3, 2, 125, 4, false);
	foregroundProcessor.initShadow(0.5, 0.5, 0.3, 0.99);
	identifier.init(Identification::Ultimate);
	evaluate.readXML2FrameList("clip1.xml");
	//evaluate.readXML2FrameList("CAVIAR1/fosne2gt.xml");

	int waitForBGConvergence = 60;
	
	
	// Load frame source
	//frameList.open("CAVIAR1/OneStopNoEnter2front.mpg");
	//frameList.open("clip1.mpeg");
	frameList.open("camera1.mov");
	//frameList.open("Renova_20080420_083025_Cam10_0000.mpeg");
	
	//Record video
	VideoWriter demo("trackingDemo.mpeg", CV_FOURCC('P','I','M','1'), 20, frameList.movieSize*2);

	// Create windows
	namedWindow("Info",CV_WINDOW_AUTOSIZE);
	namedWindow("Background",CV_WINDOW_AUTOSIZE);
	namedWindow("Foreground",CV_WINDOW_AUTOSIZE);
	namedWindow("Tracking",CV_WINDOW_AUTOSIZE);
	namedWindow("Raw image", CV_WINDOW_AUTOSIZE);
	//namedWindow("BackgroundModel",CV_WINDOW_AUTOSIZE);
	namedWindow("Evaluation", CV_WINDOW_AUTOSIZE);

	while (frameList.queryNextFrame())
	{
		PROFILER_RESET();

		sampleDown(frameList.getLatestFrame().image, frameList.getLatestFrame().image, 1);	// Speed up by sampling down the image
		
		// Do the nessecary processing
		backgroundModel.update(frameList.getFrames());							PROFILE("BackgroundModel");
		if (frameList.getCurrentFrameNumber() > waitForBGConvergence)	//Wait for convergence
			foregroundProcessor.segmentForeground(frameList.getLatestFrame());	PROFILE("ForegroundSeg.");
		identifier.identify(frameList.getFrames());								PROFILE("Identification");	
		kalmanFilter.predict(frameList.getLatestFrame());						PROFILE("Kalman Prediction");
		evaluate.currentFrame();												PROFILE("Evaluation");

		// Display result
		frameList.display("Tracking");
		frameList.displayBackground("Background");
		if (frameList.getCurrentFrameNumber() > waitForBGConvergence) //Wait for convergence
			frameList.displayForeground("Foreground");
		evaluate.displayInfo("Evaluation");
		// Give the GUI time to render
		waitKey(1);															PROFILE("Display");
		
		// Write current frame (and info) to file
		demo << frameList.getLatestFrame().demoImage;
		
		// Optional pause between each frame
		//stepWiseFromFrame(frameList, 55);
																			PROFILE("QueryNextFrame");										
																			PROFILE_TOTALTIME();
																			PROFILE("FPS");
																			PROFILE_FPS();
		// Evaluate accuracy and precision
		evaluate.MOTA();
		evaluate.MOTP();

		// Display info
		frameList.displayInfo("Info");
	} 
	
	evaluate.displaySequenceInfo("Evaluation");
	waitKey(0);
	return 0;
}