$search
00001 /* -*- mode: C++ -*- */ 00002 /* $Id: format7.h 37633 2011-07-20 23:35:25Z 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 BayerPattern_((dc1394color_filter_t) DC1394_COLOR_FILTER_NUM) 00075 {}; 00076 ~Format7() {}; 00077 00079 bool active(void) 00080 { 00081 return active_; 00082 } 00083 bool start(dc1394camera_t *camera, dc1394video_mode_t mode, 00084 Config &newconfig); 00085 void stop(void); 00086 void unpackData(sensor_msgs::Image &image, uint8_t *capture_buffer); 00087 bool checkCameraInfo(const sensor_msgs::CameraInfo &cinfo); 00088 void setOperationalParameters(sensor_msgs::CameraInfo &cinfo); 00089 00090 private: 00091 dc1394color_filter_t findBayerPattern(const char* bayer); 00092 00093 bool active_; 00094 dc1394color_coding_t coding_; 00095 uint32_t maxWidth_; 00096 uint32_t maxHeight_; 00097 00099 sensor_msgs::RegionOfInterest roi_; 00100 00102 uint32_t binning_x_; 00103 uint32_t binning_y_; 00104 00106 dc1394color_filter_t BayerPattern_; 00107 }; 00108 00109 #endif // _FORMAT7_H_