[Jderobot-admin] jderobot-r1095 - trunk/src/stable/libs/parallelIce

rocapal en jderobot.org rocapal en jderobot.org
Dom Nov 10 19:48:50 CET 2013


Author: rocapal
Date: 2013-11-10 19:48:49 +0100 (Sun, 10 Nov 2013)
New Revision: 1095

Modified:
   trunk/src/stable/libs/parallelIce/cameraClient.cpp
   trunk/src/stable/libs/parallelIce/cameraClient.h
Log:
#110 added average in framerate of images


Modified: trunk/src/stable/libs/parallelIce/cameraClient.cpp
===================================================================
--- trunk/src/stable/libs/parallelIce/cameraClient.cpp	2013-11-09 00:35:37 UTC (rev 1094)
+++ trunk/src/stable/libs/parallelIce/cameraClient.cpp	2013-11-10 18:48:49 UTC (rev 1095)
@@ -80,8 +80,12 @@
 	colorspaces::Image::FormatPtr fmt;
 	IceUtil::Time last;
 
+	int iterIndex = 0;
+	int totalRefreshRate = 0;
+
 	last=IceUtil::Time::now();
 	while (!(_done)){
+		iterIndex ++;
 		if (pauseStatus){
 			IceUtil::Mutex::Lock sync(this->controlMutex);
 			this->sem.wait(sync);
@@ -109,8 +113,17 @@
 			usleep(this->cycle - (IceUtil::Time::now().toMicroSeconds() - last.toMicroSeconds()));
 		}
 
-		this->refreshRate=(int)(1000000/(IceUtil::Time::now().toMicroSeconds() - last.toMicroSeconds()));
+		int rate =(int)(1000000/(IceUtil::Time::now().toMicroSeconds() - last.toMicroSeconds()));
+		totalRefreshRate =  totalRefreshRate + rate;
+		this->refreshRate= totalRefreshRate / iterIndex;		
 		last=IceUtil::Time::now();
+
+		if (iterIndex == INT_MAX) 
+		{
+			iterIndex = 0;
+			std::cout << "*** Reinicio contador" << std::endl;
+		}
+		
 	}
 }
 

Modified: trunk/src/stable/libs/parallelIce/cameraClient.h
===================================================================
--- trunk/src/stable/libs/parallelIce/cameraClient.h	2013-11-09 00:35:37 UTC (rev 1094)
+++ trunk/src/stable/libs/parallelIce/cameraClient.h	2013-11-10 18:48:49 UTC (rev 1095)
@@ -30,8 +30,8 @@
 #include <cv.h>
 #include <sstream>
 #include <fstream>
+#include <climits>
 
-
 namespace jderobot {
 
 class cameraClient: public IceUtil::Thread {



More information about the Jderobot-admin mailing list