Changeset 128 in flair-src


Ignore:
Timestamp:
Jan 17, 2017, 4:57:10 PM (4 years ago)
Author:
Sanahuja Guillaume
Message:

save image

Location:
trunk/lib/FlairSensorActuator/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/Camera.cpp

    r125 r128  
    140140}
    141141
    142 void Camera::SavePictureToFile(std::string filename) const {
    143         string::size_type idx = filename.rfind('.');
     142void Camera::SavePictureToFile(string filename) const {
     143        if(filename=="") filename="./"+ObjectName()+"_"+std::to_string(GetTime())+".jpg";
     144    string::size_type idx = filename.rfind('.');
    144145
    145         if(idx != std::string::npos) {
     146        if(idx != string::npos) {
    146147                Printf("saving %s\n", filename.c_str());
    147                 std::string extension = filename.substr(idx+1);
     148                string extension = filename.substr(idx+1);
    148149               
    149150                output->GetMutex();
  • trunk/lib/FlairSensorActuator/src/Camera.h

    r124 r128  
    101101  * \brief Save picture to file
    102102  *
    103   * \param filename filename
     103  * \param filename filename; if ommitted, current time is used and file is saved in current directory with jpg compression
    104104  */
    105   void SavePictureToFile(std::string filename) const;
     105  void SavePictureToFile(std::string filename="") const;
    106106
    107107  /*!
Note: See TracChangeset for help on using the changeset viewer.