Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/imgcodecs/src/grfmt_pam.hpp
16337 views
1
/*M///////////////////////////////////////////////////////////////////////////////////////
2
//
3
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4
//
5
// By downloading, copying, installing or using the software you agree to this license.
6
// If you do not agree to this license, do not download, install,
7
// copy or use the software.
8
//
9
//
10
// License Agreement
11
// For Open Source Computer Vision Library
12
// (3-clause BSD License)
13
//
14
// Copyright (C) 2000-2016, Intel Corporation, all rights reserved.
15
// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
16
// Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved.
17
// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
18
// Copyright (C) 2015-2016, OpenCV Foundation, all rights reserved.
19
// Copyright (C) 2015-2016, Itseez Inc., all rights reserved.
20
// Third party copyrights are property of their respective owners.
21
//
22
// Redistribution and use in source and binary forms, with or without modification,
23
// are permitted provided that the following conditions are met:
24
//
25
// * Redistributions of source code must retain the above copyright notice,
26
// this list of conditions and the following disclaimer.
27
//
28
// * Redistributions in binary form must reproduce the above copyright notice,
29
// this list of conditions and the following disclaimer in the documentation
30
// and/or other materials provided with the distribution.
31
//
32
// * Neither the names of the copyright holders nor the names of the contributors
33
// may be used to endorse or promote products derived from this software
34
// without specific prior written permission.
35
//
36
// This software is provided by the copyright holders and contributors "as is" and
37
// any express or implied warranties, including, but not limited to, the implied
38
// warranties of merchantability and fitness for a particular purpose are disclaimed.
39
// In no event shall copyright holders or contributors be liable for any direct,
40
// indirect, incidental, special, exemplary, or consequential damages
41
// (including, but not limited to, procurement of substitute goods or services;
42
// loss of use, data, or profits; or business interruption) however caused
43
// and on any theory of liability, whether in contract, strict liability,
44
// or tort (including negligence or otherwise) arising in any way out of
45
// the use of this software, even if advised of the possibility of such damage.
46
//
47
//
48
//M*/
49
50
//Based on "imgcodecs/src/grfmt_pxm.hpp"
51
//Written by Dimitrios Katsaros <[email protected]>
52
53
#ifndef _OPENCV_PAM_HPP_
54
#define _OPENCV_PAM_HPP_
55
56
#ifdef HAVE_IMGCODEC_PXM
57
58
#include "grfmt_base.hpp"
59
#include "bitstrm.hpp"
60
61
namespace cv
62
{
63
64
class PAMDecoder CV_FINAL : public BaseImageDecoder
65
{
66
public:
67
68
PAMDecoder();
69
virtual ~PAMDecoder() CV_OVERRIDE;
70
71
bool readData( Mat& img ) CV_OVERRIDE;
72
bool readHeader() CV_OVERRIDE;
73
74
size_t signatureLength() const CV_OVERRIDE;
75
bool checkSignature( const String& signature ) const CV_OVERRIDE;
76
ImageDecoder newDecoder() const CV_OVERRIDE;
77
78
protected:
79
80
RLByteStream m_strm;
81
int m_maxval, m_channels, m_sampledepth, m_offset,
82
selected_fmt;
83
bool bit_mode;
84
};
85
86
87
class PAMEncoder CV_FINAL : public BaseImageEncoder
88
{
89
public:
90
PAMEncoder();
91
virtual ~PAMEncoder() CV_OVERRIDE;
92
93
bool isFormatSupported( int depth ) const CV_OVERRIDE;
94
bool write( const Mat& img, const std::vector<int>& params ) CV_OVERRIDE;
95
96
ImageEncoder newEncoder() const CV_OVERRIDE;
97
};
98
99
}
100
101
#endif
102
103
#endif /* _OPENCV_PAM_HPP_ */
104
105