libigl v2.5.0
Loading...
Searching...
No Matches
read_image.h
Go to the documentation of this file.
1// This file is part of libigl, a simple c++ geometry processing library.
2//
3// Copyright (C) 2016 Daniele Panozzo <daniele.panozzo@gmail.com>
4//
5// This Source Code Form is subject to the terms of the Mozilla Public License
6// v. 2.0. If a copy of the MPL was not distributed with this file, You can
7// obtain one at http://mozilla.org/MPL/2.0/.
8#ifndef IGL_STB_READ_IMAGE_H
9#define IGL_STB_READ_IMAGE_H
10#include "../igl_inline.h"
11#include <Eigen/Core>
12#include <string>
13
14namespace igl
15{
16 namespace stb
17 {
18 // Read an image from a file into 4 memory buffers
19 //
20 // Supported file formats (based on STB):
21 //
22 // JPEG baseline & progressive (12 bpc/arithmetic not supported, same as stock IJG lib)
23 // PNG 1/2/4/8/16-bit-per-channel
24 // TGA (not sure what subset, if a subset)
25 // BMP non-1bpp, non-RLE
26 // PSD (composited view only, no extra channels, 8/16 bit-per-channel)
27
28 // GIF (*comp always reports as 4-channel)
29 // HDR (radiance rgbE format)
30 // PIC (Softimage PIC)
31 // PNM (PPM and PGM binary only)
32 //
33 // Input:
34 // image_file path to .png file
35 // Output:
36 // R,G,B,A texture channels
37 // Returns true on success, false on failure
38 //
39 IGL_INLINE bool read_image(const std::string image_file,
40 Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& R,
41 Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& G,
42 Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& B,
43 Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& A
44 );
45 }
46}
47
48#ifndef IGL_STATIC_LIBRARY
49# include "read_image.cpp"
50#endif
51
52#endif
#define IGL_INLINE
Definition igl_inline.h:15
bool read_image(const std::string image_file, Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &R, Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &G, Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &B, Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &A)
Definition AABB.h:17