Point Cloud Library (PCL) 1.12.1
libpng_wrapper.h
1/*
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2011, Willow Garage, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of Willow Garage, Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 * Author: Julius Kammerl (julius@kammerl.de)
35 */
36
37#pragma once
38
39#include <cstdint> // uint8_t, uint16_t
40#include <vector>
41#include <pcl/pcl_exports.h> // for PCL_EXPORTS
42
43namespace pcl
44{
45 namespace io
46 {
47 /** \brief Encodes 8-bit mono image to PNG format.
48 * \param[in] image_arg input image data
49 * \param[in] width_arg image width
50 * \param[in] height_arg image height
51 * \param[out] pngData_arg PNG compressed image data
52 * \param[in] png_level_arg zLib compression level (default level: -1)
53 * \ingroup io
54 */
55 PCL_EXPORTS void
56 encodeMonoImageToPNG (std::vector<std::uint8_t>& image_arg,
57 std::size_t width_arg,
58 std::size_t height_arg,
59 std::vector<std::uint8_t>& pngData_arg,
60 int png_level_arg = -1);
61
62 /** \brief Encodes 16-bit mono image to PNG format.
63 * \param[in] image_arg input image data
64 * \param[in] width_arg image width
65 * \param[in] height_arg image height
66 * \param[out] pngData_arg PNG compressed image data
67 * \param[in] png_level_arg zLib compression level (default level: -1)
68 * \ingroup io
69 */
70 PCL_EXPORTS void
71 encodeMonoImageToPNG (std::vector<std::uint16_t>& image_arg,
72 std::size_t width_arg,
73 std::size_t height_arg,
74 std::vector<std::uint8_t>& pngData_arg,
75 int png_level_arg = -1);
76
77 /** \brief Encodes 8-bit RGB image to PNG format.
78 * \param[in] image_arg input image data
79 * \param[in] width_arg image width
80 * \param[in] height_arg image height
81 * \param[out] pngData_arg PNG compressed image data
82 * \param[in] png_level_arg zLib compression level (default level: -1)
83 * \ingroup io
84 */
85 PCL_EXPORTS void
86 encodeRGBImageToPNG (std::vector<std::uint8_t>& image_arg,
87 std::size_t width_arg,
88 std::size_t height_arg,
89 std::vector<std::uint8_t>& pngData_arg,
90 int png_level_arg = -1);
91
92 /** \brief Encodes 16-bit RGB image to PNG format.
93 * \param[in] image_arg input image data
94 * \param[in] width_arg image width
95 * \param[in] height_arg image height
96 * \param[out] pngData_arg PNG compressed image data
97 * \param[in] png_level_arg zLib compression level (default level: -1)
98 * \ingroup io
99 */
100 PCL_EXPORTS void
101 encodeRGBImageToPNG (std::vector<std::uint16_t>& image_arg,
102 std::size_t width_arg,
103 std::size_t height_arg,
104 std::vector<std::uint8_t>& pngData_arg,
105 int png_level_arg = -1);
106
107 /** \brief Decode compressed PNG to 8-bit image
108 * \param[in] pngData_arg PNG compressed input data
109 * \param[in] imageData_arg image output data
110 * \param[out] width_arg image width
111 * \param[out] heigh_argt image height
112 * \param[out] channels_arg number of channels
113 * \ingroup io
114 */
115 PCL_EXPORTS void
116 decodePNGToImage (std::vector<std::uint8_t>& pngData_arg,
117 std::vector<std::uint8_t>& imageData_arg,
118 std::size_t& width_arg,
119 std::size_t& heigh_argt,
120 unsigned int& channels_arg);
121
122 /** \brief Decode compressed PNG to 16-bit image
123 * \param[in] pngData_arg PNG compressed input data
124 * \param[in] imageData_arg image output data
125 * \param[out] width_arg image width
126 * \param[out] height_arg image height
127 * \param[out] channels_arg number of channels
128 * \ingroup io
129 */
130 PCL_EXPORTS void
131 decodePNGToImage (std::vector<std::uint8_t>& pngData_arg,
132 std::vector<std::uint16_t>& imageData_arg,
133 std::size_t& width_arg,
134 std::size_t& height_arg,
135 unsigned int& channels_arg);
136 }
137}
PCL_EXPORTS void decodePNGToImage(std::vector< std::uint8_t > &pngData_arg, std::vector< std::uint8_t > &imageData_arg, std::size_t &width_arg, std::size_t &heigh_argt, unsigned int &channels_arg)
Decode compressed PNG to 8-bit image.
PCL_EXPORTS void encodeRGBImageToPNG(std::vector< std::uint8_t > &image_arg, std::size_t width_arg, std::size_t height_arg, std::vector< std::uint8_t > &pngData_arg, int png_level_arg=-1)
Encodes 8-bit RGB image to PNG format.
PCL_EXPORTS void encodeMonoImageToPNG(std::vector< std::uint8_t > &image_arg, std::size_t width_arg, std::size_t height_arg, std::vector< std::uint8_t > &pngData_arg, int png_level_arg=-1)
Encodes 8-bit mono image to PNG format.
#define PCL_EXPORTS
Definition: pcl_macros.h:323