Revision: 8796
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8796&view=rev
Author:   jpgr87
Date:     2010-06-28 01:28:57 +0000 (Mon, 28 Jun 2010)

Log Message:
-----------
Applied patch 3010358: Player SVN trunk: small improvements for camera drivers

Modified Paths:
--------------
    code/player/trunk/server/drivers/camera/compress/cameracompress.cc
    code/player/trunk/server/drivers/camera/imgcmp/imgcmp.cc

Modified: code/player/trunk/server/drivers/camera/compress/cameracompress.cc
===================================================================
--- code/player/trunk/server/drivers/camera/compress/cameracompress.cc  
2010-06-25 02:00:22 UTC (rev 8795)
+++ code/player/trunk/server/drivers/camera/compress/cameracompress.cc  
2010-06-28 01:28:57 UTC (rev 8796)
@@ -55,8 +55,19 @@
 
 @par Configuration file options
 
-- none
+- check_timestamps (int)
+  - Default: 0
+  - If non-zero, timestamps are checked so only new images are compressed
+    and published.
 
+- save (int)
+  - Default: 0
+  - If non-zero, uncompressed images are saved to disk (with a .jpeg extension)
+
+- image_quality (float)
+  - Default: 0.8
+  - Image quality for JPEG compression
+
 @par Example
 
 @verbatim
@@ -120,6 +131,7 @@
     private: double quality;
 
     // Save image frames?
+    private: int check_timestamps;
     private: int save;
     private: int frameno;
 };
@@ -151,7 +163,8 @@
   }
   this->camera_time = 0.0;
 
-  this->save = cf->ReadInt(section,"save",0);
+  this->check_timestamps = cf->ReadInt(section, "check_timestamps", 0);
+  this->save = cf->ReadInt(section, "save", 0);
   this->quality = cf->ReadFloat(section, "image_quality", 0.8);
 
   return;
@@ -199,10 +212,13 @@
 
   if (Message::MatchMessage(hdr, PLAYER_MSGTYPE_DATA, 
PLAYER_CAMERA_DATA_STATE, camera_id))
   {
-       assert(data);
+    assert(data);
     player_camera_data_t * recv = reinterpret_cast<player_camera_data_t * > 
(data);
-    camera_time = hdr->timestamp;
-    ProcessImage(*recv);
+    if ((!(this->check_timestamps)) || (this->camera_time != hdr->timestamp))
+    {
+      this->camera_time = hdr->timestamp;
+      ProcessImage(*recv);
+    }
     return 0;
   }
 

Modified: code/player/trunk/server/drivers/camera/imgcmp/imgcmp.cc
===================================================================
--- code/player/trunk/server/drivers/camera/imgcmp/imgcmp.cc    2010-06-25 
02:00:22 UTC (rev 8795)
+++ code/player/trunk/server/drivers/camera/imgcmp/imgcmp.cc    2010-06-28 
01:28:57 UTC (rev 8796)
@@ -65,11 +65,11 @@
   - Allowed values: 0 - 255
   - Maximal luminance distance between two pixels in old and new images; if 
luminance distance
     computed for two pixels (old and new) is greater than max_lum_dist, these 
pixels differ.
-- max_diff_pixels (integer)
-  - Default: 0
-  - Allowed value: 0 - 100
-  - Percents of pixels that differ (see above) to consider that two images
-    (old and new) are different.
+- max_diff_pixels (double)
+  - Default: 0.0
+  - Allowed value: 0.0 - 1.0
+  - Maximal degree to which two images (old and new) differs (see above) to 
consider that they
+    are actually different.
 - idle_publish_interval (double)
   - Default: 0.5
   - Image publish interval (in seconds) whenever differences were not detected.
@@ -89,7 +89,7 @@
   provides ["output:::camera:0" "dio:0"]
   skip_lines 16
   max_lum_dist 128
-  max_diff_pixels 50
+  max_diff_pixels 0.01
   keep_buffer 0
 )
 @endverbatim
@@ -147,7 +147,7 @@
   private: IntProperty skip_lines;
   private: IntProperty sleep_nsec;
   private: IntProperty max_lum_dist;
-  private: IntProperty max_diff_pixels;
+  private: DoubleProperty max_diff_pixels;
   private: DoubleProperty idle_publish_interval;
   private: IntProperty keep_buffer;
 };
@@ -167,7 +167,7 @@
   skip_lines("skip_lines", 0, false),
   sleep_nsec("sleep_nsec", 10000, false),
   max_lum_dist("max_lum_dist", 0, false),
-  max_diff_pixels("max_diff_pixels", 0, false),
+  max_diff_pixels("max_diff_pixels", 0.0, false),
   idle_publish_interval("idle_publish_interval", 0.5, false),
   keep_buffer("keep_buffer", 1, false)
 {
@@ -268,7 +268,7 @@
     this->SetError(-1);
     return;
   }
-  if ((this->max_diff_pixels.GetValue() < 0) || 
(this->max_diff_pixels.GetValue() > 255))
+  if ((this->max_diff_pixels.GetValue() < 0.0) || 
(this->max_diff_pixels.GetValue() > 1.0))
   {
     this->SetError(-1);
     return;
@@ -569,8 +569,7 @@
             // I assume that Publish() (with copy = false) freed those output 
data!
             output = NULL;
           }
-          diffs = (static_cast<int>((static_cast<double>(diffs) / 
static_cast<double>((rawdata->width) * (rawdata->height))) * 100.0));
-          differ = (diffs > (this->max_diff_pixels.GetValue()));
+          differ = ((static_cast<double>(diffs) / 
static_cast<double>((rawdata->width) * (rawdata->height))) > 
(this->max_diff_pixels.GetValue()));
         }
         memset(&dio_data, 0, sizeof dio_data);
         dio_data.count = 1;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to