00001 /* -*- mode: C++ -*- */ 00002 /* $Id: format7.h 35691 2011-02-02 04:28:58Z joq $ */ 00003 00004 /********************************************************************* 00005 * Software License Agreement (BSD License) 00006 * 00007 * Copyright (c) 2010 Ken Tossell, Jack O'Quin 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 00014 * * Redistributions of source code must retain the above copyright 00015 * notice, this list of conditions and the following disclaimer. 00016 * * Redistributions in binary form must reproduce the above 00017 * copyright notice, this list of conditions and the following 00018 * disclaimer in the documentation and/or other materials provided 00019 * with the distribution. 00020 * * Neither the name of the author nor other contributors may be 00021 * used to endorse or promote products derived from this software 00022 * without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00025 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00026 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00027 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00028 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00029 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00030 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00031 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00033 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00034 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00035 * POSSIBILITY OF SUCH DAMAGE. 00036 *********************************************************************/ 00037 00038 #ifndef _FORMAT7_H_ 00039 #define _FORMAT7_H_ 00040 00041 #include <sensor_msgs/CameraInfo.h> 00042 #include <sensor_msgs/Image.h> 00043 00044 #include <dc1394/dc1394.h> 00045 00046 #include "camera1394/Camera1394Config.h" 00047 typedef camera1394::Camera1394Config Config; 00048 00056 /*** @brief Camera1394 Format7 class 00057 * 00058 * Sets CameraInfo Format7 data from Config updates. Tracks values 00059 * and ranges, modifying configured values to those supported by the 00060 * device. 00061 * 00062 */ 00063 class Format7 00064 { 00065 public: 00066 00067 Format7(): 00068 active_(false), 00069 coding_(DC1394_COLOR_CODING_MONO8), 00070 maxWidth_(0), 00071 maxHeight_(0), 00072 binning_x_(0), 00073 binning_y_(0) 00074 {}; 00075 ~Format7() {}; 00076 00078 bool active(void) 00079 { 00080 return active_; 00081 } 00082 bool start(dc1394camera_t *camera, dc1394video_mode_t mode, 00083 Config &newconfig); 00084 void stop(void); 00085 void unpackData(sensor_msgs::Image &image, uint8_t *capture_buffer); 00086 bool checkCameraInfo(const sensor_msgs::CameraInfo &cinfo); 00087 void setOperationalParameters(sensor_msgs::CameraInfo &cinfo); 00088 00089 private: 00090 00091 bool active_; 00092 dc1394color_coding_t coding_; 00093 uint32_t maxWidth_; 00094 uint32_t maxHeight_; 00095 00097 sensor_msgs::RegionOfInterest roi_; 00098 00100 uint32_t binning_x_; 00101 uint32_t binning_y_; 00102 00104 dc1394color_filter_t BayerPattern_; 00105 }; 00106 00107 #endif // _FORMAT7_H_