Follow this link to skip to the main content

camera_image.cc

Go to the documentation of this file.
00001 // -*-c++-*- 
00002 //---------------------------< /-/ CLARAty /-/ >------------------------------
00003 /** 
00004  * @file  camera_image.cc
00005  *
00006  * Functions for the Camera_Image class.
00007  *
00008  * <br>@b Designer(s):  Issa A.D. Nesnas
00009  *                      Max Bajracharya
00010  * <br>@b Author(s):    Max Bajracharya
00011  *                      Issa A.D. Nesnas
00012  * <br>@b Date:         January 17, 2002
00013  *
00014  * <b>Software License:</b><br>
00015  * <code>  http://claraty.jpl.nasa.gov/license/open_src.html  or
00016  *         file: ../share/license.txt  </code>
00017  *
00018  * &copy; 2007, Jet Propulsion Laboratory, California Institute of Technology<br>
00019  *
00020  * $Revision: 1.5 $
00021  */ 
00022 //-----------------------------------------------------------------------------
00023 
00024 
00025 #include "claraty/camera_image.h"
00026 #include <iostream>
00027 #include <sstream>
00028 
00029 #include "claraty/fdm_parse_tree.h"
00030 //#include "claraty/camera_model.h"
00031 
00032 using namespace std;
00033 
00034 namespace claraty {
00035 
00036 class Camera_Model {
00037   Camera_Model() {};
00038   Camera_Model(Camera_Model * m) {};
00039   int model;
00040 };
00041 
00042 //-----------------------------------------------------------------------------
00043 
00044 Camera_Image_Properties::Property::
00045 Property(float val, float min_val, float max_val, Mode m) :
00046   value(val),
00047   min_value(min_val),
00048   max_value(max_val),
00049   mode(m)
00050 {
00051 }
00052 //-----------------------------------------------------------------------------
00053 
00054 bool Camera_Image_Properties::Property::
00055 io(FDM_Map map)
00056 {
00057   bool ok = true;
00058   ok &= map.field("value",     value);
00059   ok &= map.field("min_value", min_value);
00060   ok &= map.field("max_value", max_value);
00061 //  switch (mode) {
00062 //  case INVALID:
00063   //   ok &= map.field("mode", mode);
00064   //   break;
00065   // default:
00066   //  ok &= map.field("mode", "INVALID");
00067   //  break;
00068   // }
00069   return ok;
00070 }
00071 
00072 //-----------------------------------------------------------------------------
00073 /**
00074  * Default camera image properties
00075  */
00076 Camera_Image_Properties:: 
00077 Camera_Image_Properties() :
00078   brightness  ( Property () ),
00079   contrast    ( Property () ),
00080   exposure    ( Property () ),
00081   iris        ( Property (0.0, 0.0, 1.0  ) ),
00082   focus       ( Property (0.0, 0.0, 0.016) ),
00083   temperature (0.0),
00084   frame_num   (0),
00085   camera_name ("def_camera"),
00086   filter_color("clear")
00087 {}
00088 
00089 //-----------------------------------------------------------------------------
00090 
00091 bool Camera_Image_Properties::
00092 io(FDM_Map map)
00093 {
00094   bool ok = true;
00095   ok &= map.field("brightness",  brightness);
00096   ok &= map.field("contrast",    contrast);
00097   ok &= map.field("exposure",    exposure);
00098   ok &= map.field("iris",        iris);
00099   ok &= map.field("focus",       focus);
00100   ok &= map.field("temperature", temperature);
00101   ok &= map.field("frame_num",   frame_num);
00102   ok &= map.field("camera_name", camera_name);
00103   ok &= map.field("filter_color",filter_color);
00104   return ok;
00105 }
00106 
00107 //-----------------------------------------------------------------------------
00108 
00109 
00110 ostream & 
00111 operator << (ostream & os, const Camera_Image_Properties & rhs)
00112 {
00113   FDM_Parse_Tree::write_object(rhs, os);
00114   return os;
00115 }
00116 
00117 //-----------------------------------------------------------------------------
00118 
00119 istream & 
00120 operator >> (istream & is, Camera_Image_Properties & rhs)
00121 {
00122   FDM_Parse_Tree::read_object(rhs, is);
00123   return is;
00124 }
00125 
00126 //-----------------------------------------------------------------------------
00127 
00128 } // namespace claraty
00129