|
Image | kjb::make_collage (Image const *const *input_images, int num_horizontal, int num_vertical) |
| wrapper for kjb_c::make_image_collage More...
|
|
Image | kjb::make_collage (Image const *input_img_array, int num_horizontal, int num_vertical) |
| also works for an array of Image objects More...
|
|
void | kjb::write_histograms (const std::vector< Color_histogram > &chs, const std::string &file_name) |
|
void | kjb::read_histograms (std::vector< Color_histogram > &chs, const std::string &file_name) |
|
Filter | kjb::gaussian_filter (double sigma, int size) |
| Create a Gaussian filter with given sigma and size. More...
|
|
Filter | kjb::gaussian_filter (double sigma) |
| Create a Gaussian filter with given sigma. More...
|
|
Filter | kjb::laplacian_of_gaussian_filter (int size, double sigma) |
| Create a Laplacian of Gaussian filter. More...
|
|
Image | kjb::operator* (const Image &image, const Filter &kernel) |
| Convolve an image with a filter. More...
|
|
Image | kjb::gauss_sample_image (const Image &in, int resolution, double sigma) |
| this wraps C function kjb_c::gauss_sample_image (q.v.). More...
|
|
Vector | kjb::hsluma_space (const kjb_c::Pixel &p) |
| Compute the spatial coordinates of a pixel in HSY color space. More...
|
|
kjb_c::Pixel | kjb::get_pixel_from_hsluma_space (const Vector &hsy) |
| This clampfully transforms a point in HSY space to RGB. More...
|
|
int | kjb::get_pixel_from_hsluma_space (const Vector &hsy, kjb_c::Pixel *p) |
| This might transform a point in HSY space to RGB. More...
|
|
Image | kjb::scale_image (const Image &i, double factor) |
| Scale image size by factor, i.e., enlarge or shrink. More...
|
|
Image | kjb::get_inverted (const Image &) |
|
Image | kjb::rgb_matrices_to_image (const Matrix &red_channel, const Matrix &green_channel, const Matrix &blue_channel) |
| Contruct an image from three matrices representing red, green, blue channels. More...
|
|
Matrix | kjb::to_grayscale_matrix (const Image &i) |
|
Image | kjb::operator* (const Image &op1, double op2) |
| Scale an image in channel space, yielding a new image. More...
|
|
Image | kjb::operator/ (const Image &op1, double op2) |
| Scale an image in channel space, yielding a new image. More...
|
|
Image | kjb::operator+ (const Image &op1, const Image &op2) |
| Add two images. More...
|
|
Image | kjb::operator- (const Image &im1, const Image &im2) |
| Subtract two images. More...
|
|
void | kjb::enable_transparency (Image &i) |
| set Image flag, to indicate that the 'alpha' channel is meaningful. More...
|
|
void | kjb::disable_transparency (Image &i) |
| clear Image flag, to indicate that the 'alpha' channel is not meaningful. More...
|
|
bool | kjb::is_transparency_enabled (const Image &i) |
| test the Image flag, returning true if the 'alpha' channel is meaningful. More...
|
|
Image | kjb::matrix_to_max_contrast_8bit_bw_image (const kjb::Matrix &m) |
| convert a matrix to a black-and-white image, with enhanced contrast. More...
|
|
Image | kjb::matrix_to_color_image (const kjb::Matrix &m, const kjb::Colormap &map="jet") |
| Converts a matrix to a high-contrast color image, mapping values to colors using a kjb::Colormap. Equivalent to Matlab's imagesc() function. More...
|
|
Image | kjb::imagesc (const kjb::Matrix &data, const kjb::Colormap &map="jet") |
| Ported version of Matlab's "imagesc()" function; alias of matrix_to_color_image. More...
|
|
std::string | kjb::pixel_as_hex_triplet_string (const kjb_c::Pixel *p) |
| express color as HTML-style hex triplet, e.g., "#FFCC00," of pointer More...
|
|
PixelRGBA | kjb::operator* (const PixelRGBA &p, const PixelRGBA &q) |
| Multiply two pixels together. More...
|
|
PixelRGBA | kjb::operator* (const PixelRGBA &p, double k) |
| Scale a pixel by a floating point value on the right. More...
|
|
PixelRGBA | kjb::operator* (double k, const PixelRGBA &p) |
| Scale a pixel by a floating point value on the left. More...
|
|
kjb_c::Pixel | kjb::abs (const kjb_c::Pixel &p) |
| Take the channel-wise absolute value of a kjb_c::Pixel. More...
|
|
std::string | kjb::pixel_as_hex_triplet_string (const kjb_c::Pixel &p) |
| express color as HTML-style hex triplet, e.g., "#FFCC00," reference More...
|
|
template<class InputIterator > |
Vector | kjb::Image::intensity_histogram (InputIterator first, InputIterator last) const |
| Computes the intensity histogram of a region – given by a range of pairs – of this image. More...
|
|
int kjb::get_pixel_from_hsluma_space |
( |
const Vector & |
hsy, |
|
|
kjb_c::Pixel * |
p |
|
) |
| |
This might transform a point in HSY space to RGB.
- Returns
- EXIT_SUCCESS iff the values in hsy are valid coordinates inside the HSY (Y=luma) color polyhedron. Otherwise, EXIT_FAILURE.
Input hsy is a vector of cartesian coordinates where arctan( hsy[1] / hsy[0] ) is hue, sqrt(hsy[0]**2 + hsy[1]**2) is saturation, and hsy[2] is "luma." (Luma is a tweak to brightness to compensate for the differences in perceived brightness betwen red, green, and blue.) Valid HSY values are necessarily inside a cuboid with opposite corners (-1,-1,0) and (1,1,1); but being in this range is not sufficient. The HSY color space is a polyhedron inside that cuboid.
Iff input hsy is outside the polyhedron, the return value is EXIT_FAILURE.
If the input vector is not within the HSY color polyhedron, then pointer p is not touched. Otherwise, and if p is not equal to null, the resulting pixel is stored in *p. If you do not need the pixel, it is safe to pass in a null value, and this function will act like a predicate.
Vector kjb::hsluma_space |
( |
const kjb_c::Pixel & |
p | ) |
|
Compute the spatial coordinates of a pixel in HSY color space.
The space I am using here is described in the Wikipedia article linked above. Please read about the HSL bicone: a bicone shape is like a top generated by revolving a diamond. This forms a 3D shape: picture yourself holding an empty ice cream cone, and on top of that you place an inverted empty ice cream cone. Lightness L runs along the central axis of rotation: the pointy bottom is black, the top tip is white. Hue H runs around the circumference, basically in a cyclical, rainbow order; 0 degrees is for reddish colors, 180 degrees is for cyanic colors. Saturation describes a point's distance from the central axis; at a radius of 0 the colors are only black, white, and grays. Farther from the axis the colors grow more vivid.
Except that I want to use NTSC 601 for lightness, instead of the more conventional I=(max{r,g,b}+min{r,g,b})/2. NTSC 601 defines "luma" Y as an uneven mix of red, green, and blue, in recognition of the fact that perceptually, green seems brighter than red, and both seem dimmer than blue, for typical computer shades of red, green, and blue. This distorts the shape from a bicone. The space remains convex.
In any case, this function returns the cartesian coordinates (not cylindrical!) of color points within this space, in the form of a vector v. If you think of hue H as an angle from 0 to 359, then H is basically arctan(v[1] / v[0]). v[2] is luma; zero luma is black, unity luma is white. Components v[0], v[1] are in the closed interval [-1,1]. Component v[2] is in closed interval [0,1]. Not all points in the unit cube of that space are reachable from the RGB cube!
This is basically an invertible matrix transformation: vector (r,b,g)' times matrix [ [1 -.5 -.5]; [0 .866 -.866]; [.3 .59 .11] ] <===(octave notation). The inverse of this matrix is hard-coded into (overloaded) functions PixelRGBA_from_HSLuma_space().