# Imaging

This page documents the functionality present in this library that deals with the management and manipulation of images. One thing to note is that there is no explicit image object. Instead, everything deals with array2d objects that contain various kinds of pixels.

Objects
rgb_pixel
rgb_alpha_pixel
hsi_pixel
pixel_traits
png_loader
Global Functions
assign_pixel
assign_pixel_intensity
get_pixel_intensity
load_bmp
draw_line
save_bmp
load_dng
save_dng
assign_image
assign_all_pixels
assign_border_pixels
equalize_histogram
edge_orientation
get_histogram
spatially_filter_image
hysteresis_threshold
sobel_edge_detector
suppress_non_maximum_edges
zero_border_pixels
threshold_image
auto_threshold_image
binary_dilation
binary_erosion
binary_open
binary_close
binary_intersection
binary_union
binary_difference
binary_complement
pixel_traits
dlib/pixel.h
dlib/pixel.h
As the name implies, this is a traits class for pixel types. It allows you to determine what sort of pixel type you are dealing with.
hsi_pixel
dlib/pixel.h
dlib/pixel.h
This is a simple struct that represents an HSI colored graphical pixel. Note that since this is just a struct with no member functions there is only one "implementation" of this object.
rgb_alpha_pixel
dlib/pixel.h
dlib/pixel.h
This is a simple struct that represents an RGB colored graphical pixel with an alpha channel. Note that since this is just a struct with no member functions there is only one "implementation" of this object.
rgb_pixel
dlib/pixel.h
dlib/pixel.h
This is a simple struct that represents an RGB colored graphical pixel. Note that since this is just a struct with no member functions there is only one "implementation" of this object.
assign_pixel
dlib/pixel.h
dlib/pixel.h
assign_pixel() is a templated function that can assign any pixel type to another pixel type. It will perform whatever conversion is necessary to make the assignment work. (E.g. color to grayscale conversion)
assign_pixel_intensity
dlib/pixel.h
dlib/pixel.h
assign_pixel_intensity() is a templated function that can change the intensity of a pixel. So if the pixel in question is a grayscale pixel then it simply assigns that pixel the given value. However, if the pixel is not a grayscale pixel then it converts the pixel to the HSI color space and sets the I channel to the given intensity and then converts this HSI value back to the original pixel's color space.
get_pixel_intensity
dlib/pixel.h
dlib/pixel.h
get_pixel_intensity() is a templated function that returns the grayscale intensity of a pixel. If the pixel isn't a grayscale pixel then it converts the pixel to the HSI color space and returns the obtained intensity value.
png_loader
dlib/image_io.h
dlib/image_loader/png_loader_abstract.h
This object loads a Portable Network Graphics (PNG) image file into an array2d of pixels.

Note that you must define DLIB_PNG_SUPPORT if you want to use this object. You must also set your build environment to link to the libpng library.

load_dng
dlib/image_io.h
dlib/image_loader/image_loader_abstract.h
This global function loads a dlib DNG file (a lossless compressed image format) into an array2d of pixels.
save_dng
dlib/image_io.h
dlib/image_saver/image_saver_abstract.h
This global function writes an image out to an ostream as a dlib DNG file (a lossless compressed image format).
load_bmp
dlib/image_io.h
dlib/image_loader/image_loader_abstract.h
This global function loads a MS Windows BMP file into an array2d of pixels.
image_ex.cpp.html
save_bmp
dlib/image_io.h
dlib/image_saver/image_saver_abstract.h
This global function writes an image out to an ostream as a MS Windows BMP file.
draw_line
dlib/image_transforms.h
dlib/image_transforms/draw_abstract.h
This global function draws a line onto an image.
assign_border_pixels
dlib/image_transforms.h
dlib/image_transforms/assign_image_abstract.h
This global function assigns all the pixels in the border of an image to a specific value.
assign_all_pixels
dlib/image_transforms.h
dlib/image_transforms/assign_image_abstract.h
This global function assigns all the pixels in an image a specific value.
assign_image
dlib/image_transforms.h
dlib/image_transforms/assign_image_abstract.h
This global function copies one image into another and performs any necessary color space conversions to make it work right.
get_histogram
dlib/image_transforms.h
dlib/image_transforms/equalize_histogram_abstract.h
This global function computes an image's histogram and returns it in the form of a column or row matrix object.
edge_orientation
dlib/image_transforms.h
dlib/image_transforms/edge_detector_abstract.h
This global function takes horizontal and vertical gradient magnitude values and returns the orientation of the gradient.
equalize_histogram
dlib/image_transforms.h
dlib/image_transforms/equalize_histogram_abstract.h
This global function performs histogram equalization on an image.
hysteresis_threshold
dlib/image_transforms.h
dlib/image_transforms/thresholding_abstract.h
This global function performs hysteresis thresholding on an image.
sobel_edge_detector
dlib/image_transforms.h
dlib/image_transforms/edge_detector_abstract.h
This global function performs spatial filtering on an image using the sobel edge detection filters.
image_ex.cpp.html
suppress_non_maximum_edges
dlib/image_transforms.h
dlib/image_transforms/edge_detector_abstract.h
This global function performs non-maximum suppression on a gradient image.
image_ex.cpp.html
zero_border_pixels
dlib/image_transforms.h
dlib/image_transforms/assign_image_abstract.h
This global function zeros the pixels on the border of an image.
spatially_filter_image
dlib/image_transforms.h
dlib/image_transforms/spatial_filtering_abstract.h
This global function performs spatial filtering on an image with a user supplied filter.
auto_threshold_image
dlib/image_transforms.h
dlib/image_transforms/thresholding_abstract.h
This global function performs a simple binary thresholding on an image with a user supplied threshold. However, instead of taking a user supplied threshold it computes one from the image using k-means clustering.
threshold_image
dlib/image_transforms.h
dlib/image_transforms/thresholding_abstract.h
This global function performs a simple binary thresholding on an image with a user supplied threshold.
binary_dilation
dlib/image_transforms.h
dlib/image_transforms/morphological_operations_abstract.h
This global function performs the morphological operation of dilation on an image.
binary_erosion
dlib/image_transforms.h
dlib/image_transforms/morphological_operations_abstract.h
This global function performs the morphological operation of erosion on an image.
binary_open
dlib/image_transforms.h
dlib/image_transforms/morphological_operations_abstract.h
This global function performs a morphological opening on an image.
binary_close
dlib/image_transforms.h
dlib/image_transforms/morphological_operations_abstract.h
This global function performs a morphological closing on an image.
binary_intersection
dlib/image_transforms.h
dlib/image_transforms/morphological_operations_abstract.h
This global function computes the intersection of two binary images.
binary_union
dlib/image_transforms.h
dlib/image_transforms/morphological_operations_abstract.h
This global function computes the union of two binary images.
binary_difference
dlib/image_transforms.h
dlib/image_transforms/morphological_operations_abstract.h
This global function computes the difference of two binary images.
binary_complement
dlib/image_transforms.h
dlib/image_transforms/morphological_operations_abstract.h
This global function computes the complement of a binary image.