astra_video_mode.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2013, Willow Garage, Inc.
00003  * Copyright (c) 2016, Orbbec Ltd.
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions are met:
00008  *
00009  *     * Redistributions of source code must retain the above copyright
00010  *       notice, this list of conditions and the following disclaimer.
00011  *     * Redistributions in binary form must reproduce the above copyright
00012  *       notice, this list of conditions and the following disclaimer in the
00013  *       documentation and/or other materials provided with the distribution.
00014  *     * Neither the name of the Willow Garage, Inc. nor the names of its
00015  *       contributors may be used to endorse or promote products derived from
00016  *       this software without specific prior written permission.
00017  *
00018  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00022  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00028  * POSSIBILITY OF SUCH DAMAGE.
00029  *
00030  *      Author: Tim Liu (liuhua@orbbec.com)
00031  */
00032 
00033 #include "astra_camera/astra_video_mode.h"
00034 
00035 namespace astra_wrapper
00036 {
00037 
00038 
00039 std::ostream& operator << (std::ostream& stream, const AstraVideoMode& video_mode) {
00040   stream << "Resolution: " << (int)video_mode.x_resolution_ << "x" << (int)video_mode.y_resolution_ <<
00041                               "@" << video_mode.frame_rate_ <<
00042                               "Hz Format: ";
00043 
00044   switch (video_mode.pixel_format_)
00045   {
00046     case PIXEL_FORMAT_DEPTH_1_MM:
00047       stream << "Depth 1mm";
00048       break;
00049     case PIXEL_FORMAT_DEPTH_100_UM:
00050       stream << "Depth 100um";
00051       break;
00052     case PIXEL_FORMAT_SHIFT_9_2:
00053       stream << "Shift 9/2";
00054       break;
00055     case PIXEL_FORMAT_SHIFT_9_3:
00056       stream << "Shift 9/3";
00057       break;
00058     case PIXEL_FORMAT_RGB888:
00059       stream << "RGB888";
00060       break;
00061     case PIXEL_FORMAT_YUV422:
00062       stream << "YUV422";
00063       break;
00064     case PIXEL_FORMAT_GRAY8:
00065       stream << "Gray8";
00066       break;
00067     case PIXEL_FORMAT_GRAY16:
00068       stream << "Gray16";
00069       break;
00070     case PIXEL_FORMAT_JPEG:
00071       stream << "JPEG";
00072       break;
00073 
00074     default:
00075       break;
00076   }
00077 
00078   return stream;
00079 }
00080 
00081 bool operator==(const AstraVideoMode& video_mode_a, const AstraVideoMode& video_mode_b)
00082 {
00083   return (video_mode_a.x_resolution_==video_mode_b.x_resolution_) &&
00084          (video_mode_a.y_resolution_==video_mode_b.y_resolution_) &&
00085          (video_mode_a.frame_rate_  ==video_mode_b.frame_rate_)   &&
00086          (video_mode_a.pixel_format_==video_mode_b.pixel_format_);
00087 }
00088 
00089 bool operator!=(const AstraVideoMode& video_mode_a, const AstraVideoMode& video_mode_b)
00090 {
00091   return !(video_mode_a==video_mode_b);
00092 }
00093 
00094 } //namespace openni2_wrapper


astra_camera
Author(s): Tim Liu
autogenerated on Wed Jul 10 2019 03:18:54