1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
/*
* Colorspace conversions.
* Copyright (C) 2006 - 2017 René Rebe, ExactCODE GmbH, Germany.
* Copyright (C) 2007 Susanne Klaus, ExactCODE GmbH, Germany.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2. A copy of the GNU General
* Public License can be found in the file LICENSE.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANT-
* ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* Alternatively, commercial licensing options are available from the
* copyright holder ExactCODE GmbH Germany.
*/
#ifndef COLORSPACE_HH
#define COLORSPACE_HH
#include "Image.hh"
#include <vector>
void realignImage(Image& image, uint32_t stride);
void normalize (Image& image, uint8_t low = 0, uint8_t high = 0);
void equalize (Image& image, uint8_t low = 0, uint8_t high = 0);
std::vector<std::vector<unsigned int> > histogram(Image& image, int bins = 256);
void colorspace_rgba8_to_rgb8 (Image& image);
void colorspace_argb8_to_rgb8 (Image& image);
void colorspace_rgb8_to_gray8 (Image& image, const int bytes = 3,
const int wR = 30, const int wG = 59, const int wB = 11);
void colorspace_rgb8_to_rgba8 (Image& image, uint8_t alpha=0xff);
void colorspace_rgba16_to_rgb16 (Image& image);
void colorspace_gray8_threshold (Image& image, uint8_t threshold = 127);
void colorspace_gray8_denoise_neighbours (Image &image, bool gross = false);
void colorspace_gray8_to_gray1 (Image& image, uint8_t threshold = 127);
void colorspace_gray8_to_gray2 (Image& image);
void colorspace_gray8_to_gray4 (Image& image);
void colorspace_gray1_to_gray2 (Image& image);
void colorspace_gray1_to_gray4 (Image& image);
void colorspace_grayX_to_gray8 (Image& image);
void colorspace_gray8_to_rgb8 (Image& image);
void colorspace_grayX_to_rgb8 (Image& image);
void colorspace_16_to_8 (Image& image);
void colorspace_8_to_16 (Image& image);
void colorspace_cmyk_to_rgb (Image& image);
// the threshold is used during conversion to b/w formats
bool colorspace_convert (Image& image, int spp, int bps, uint8_t threshold = 127);
bool colorspace_by_name (Image& image, const std::string& target_colorspace,
uint8_t threshold = 127);
const char* colorspace_name (Image& image);
void brightness_contrast_gamma (Image& image, double b, double c, double g);
void hue_saturation_lightness (Image& image, double h, double s, double v);
void invert (Image& image);
// "internal" helper (for image loading)
void colorspace_de_ieee (Image& image);
void colorspace_de_palette (Image& image, int table_entries,
uint16_t* rmap, uint16_t* gmap, uint16_t* bmap, uint16_t* amap = 0);
void colorspace_pack_line(Image& image, int dstline, int srcline);
#endif
|