Path: blob/master/modules/imgcodecs/src/grfmt_pam.hpp
16337 views
/*M///////////////////////////////////////////////////////////////////////////////////////1//2// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.3//4// By downloading, copying, installing or using the software you agree to this license.5// If you do not agree to this license, do not download, install,6// copy or use the software.7//8//9// License Agreement10// For Open Source Computer Vision Library11// (3-clause BSD License)12//13// Copyright (C) 2000-2016, Intel Corporation, all rights reserved.14// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.15// Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved.16// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.17// Copyright (C) 2015-2016, OpenCV Foundation, all rights reserved.18// Copyright (C) 2015-2016, Itseez Inc., all rights reserved.19// Third party copyrights are property of their respective owners.20//21// Redistribution and use in source and binary forms, with or without modification,22// are permitted provided that the following conditions are met:23//24// * Redistributions of source code must retain the above copyright notice,25// this list of conditions and the following disclaimer.26//27// * Redistributions in binary form must reproduce the above copyright notice,28// this list of conditions and the following disclaimer in the documentation29// and/or other materials provided with the distribution.30//31// * Neither the names of the copyright holders nor the names of the contributors32// may be used to endorse or promote products derived from this software33// without specific prior written permission.34//35// This software is provided by the copyright holders and contributors "as is" and36// any express or implied warranties, including, but not limited to, the implied37// warranties of merchantability and fitness for a particular purpose are disclaimed.38// In no event shall copyright holders or contributors be liable for any direct,39// indirect, incidental, special, exemplary, or consequential damages40// (including, but not limited to, procurement of substitute goods or services;41// loss of use, data, or profits; or business interruption) however caused42// and on any theory of liability, whether in contract, strict liability,43// or tort (including negligence or otherwise) arising in any way out of44// the use of this software, even if advised of the possibility of such damage.45//46//47//M*/4849//Based on "imgcodecs/src/grfmt_pxm.hpp"50//Written by Dimitrios Katsaros <[email protected]>5152#ifndef _OPENCV_PAM_HPP_53#define _OPENCV_PAM_HPP_5455#ifdef HAVE_IMGCODEC_PXM5657#include "grfmt_base.hpp"58#include "bitstrm.hpp"5960namespace cv61{6263class PAMDecoder CV_FINAL : public BaseImageDecoder64{65public:6667PAMDecoder();68virtual ~PAMDecoder() CV_OVERRIDE;6970bool readData( Mat& img ) CV_OVERRIDE;71bool readHeader() CV_OVERRIDE;7273size_t signatureLength() const CV_OVERRIDE;74bool checkSignature( const String& signature ) const CV_OVERRIDE;75ImageDecoder newDecoder() const CV_OVERRIDE;7677protected:7879RLByteStream m_strm;80int m_maxval, m_channels, m_sampledepth, m_offset,81selected_fmt;82bool bit_mode;83};848586class PAMEncoder CV_FINAL : public BaseImageEncoder87{88public:89PAMEncoder();90virtual ~PAMEncoder() CV_OVERRIDE;9192bool isFormatSupported( int depth ) const CV_OVERRIDE;93bool write( const Mat& img, const std::vector<int>& params ) CV_OVERRIDE;9495ImageEncoder newEncoder() const CV_OVERRIDE;96};9798}99100#endif101102#endif /* _OPENCV_PAM_HPP_ */103104105