Dlib C++ Library

Dlib is principally a C++ library, however, you can use a number of its tools from python applications. This page documents the python API for working with these dlib tools. If you haven’t done so already, you should probably look at the python example programs first before consulting this reference. These example programs are little mini-tutorials for using dlib from python. They are listed on the left of the main dlib web page.

Classes

Functions

Detailed API Listing

dlib.angle_between_lines(a: dlib.line, b: dlib.line) → float
ensures
  • returns the angle, in degrees, between the given lines. This is a number in the range [0 90].
dlib.apply_cca_transform(m: dlib.matrix, v: dlib.sparse_vector) → dlib.vector
requires
  • max_index_plus_one(v) <= m.nr()
ensures
  • returns trans(m)*v (i.e. multiply m by the vector v and return the result)
class dlib.array

This object represents a 1D array of floating point numbers. Moreover, it binds directly to the C++ type std::vector<double>.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.array) -> None
  2. __init__(self: dlib.array, arg0: dlib.array) -> None

Copy constructor

  1. __init__(self: dlib.array, arg0: iterable) -> None
  2. __init__(self: dlib.array, arg0: object) -> None
append(self: dlib.array, x: float) → None

Add an item to the end of the list

clear(self: dlib.array) → None
count(self: dlib.array, x: float) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.array, L: dlib.array) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.array, arg0: list) -> None
insert(self: dlib.array, i: int, x: float) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.array) -> float

Remove and return the last item

  1. pop(self: dlib.array, i: int) -> float

Remove and return the item at index i

remove(self: dlib.array, x: float) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.array, arg0: int) → None
dlib.as_grayscale(img: array) → array

Convert an image to 8bit grayscale. If it’s already a grayscale image do nothing and just return img.

dlib.assignment_cost(cost: dlib.matrix, assignment: list) → float
requires
  • cost.nr() == cost.nc() (i.e. the input must be a square matrix)

  • for all valid i:
    • 0 <= assignment[i] < cost.nr()
ensures
  • Interprets cost as a cost assignment matrix. That is, cost[i][j] represents the cost of assigning i to j.

  • Interprets assignment as a particular set of assignments. That is, i is assigned to assignment[i].

  • returns the cost of the given assignment. That is, returns a number which is:

    sum over i: cost[i][assignment[i]]

dlib.cca(L: dlib.sparse_vectors, R: dlib.sparse_vectors, num_correlations: int, extra_rank: int=5L, q: int=2L, regularization: float=0L) → dlib.cca_outputs
requires
  • num_correlations > 0
  • len(L) > 0
  • len(R) > 0
  • len(L) == len(R)
  • regularization >= 0
  • L and R must be properly sorted sparse vectors. This means they must list their elements in ascending index order and not contain duplicate index values. You can use make_sparse_vector() to ensure this is true.
ensures
  • This function performs a canonical correlation analysis between the vectors in L and R. That is, it finds two transformation matrices, Ltrans and Rtrans, such that row vectors in the transformed matrices L*Ltrans and R*Rtrans are as correlated as possible (note that in this notation we interpret L as a matrix with the input vectors in its rows). Note also that this function tries to find transformations which produce num_correlations dimensional output vectors.

  • Note that you can easily apply the transformation to a vector using apply_cca_transform(). So for example, like this:

    • apply_cca_transform(Ltrans, some_sparse_vector)
  • returns a structure containing the Ltrans and Rtrans transformation matrices as well as the estimated correlations between elements of the transformed vectors.

  • This function assumes the data vectors in L and R have already been centered (i.e. we assume the vectors have zero means). However, in many cases it is fine to use uncentered data with cca(). But if it is important for your problem then you should center your data before passing it to cca().

  • This function works with reduced rank approximations of the L and R matrices. This makes it fast when working with large matrices. In particular, we use the dlib::svd_fast() routine to find reduced rank representations of the input matrices by calling it as follows: svd_fast(L, U,D,V, num_correlations+extra_rank, q) and similarly for R. This means that you can use the extra_rank and q arguments to cca() to influence the accuracy of the reduced rank approximation. However, the default values should work fine for most problems.

  • The dimensions of the output vectors produced by L*#Ltrans or R*#Rtrans are ordered such that the dimensions with the highest correlations come first. That is, after applying the transforms produced by cca() to a set of vectors you will find that dimension 0 has the highest correlation, then dimension 1 has the next highest, and so on. This also means that the list of estimated correlations returned from cca() will always be listed in decreasing order.

  • This function performs the ridge regression version of Canonical Correlation Analysis when regularization is set to a value > 0. In particular, larger values indicate the solution should be more heavily regularized. This can be useful when the dimensionality of the data is larger than the number of samples.

  • A good discussion of CCA can be found in the paper “Canonical Correlation Analysis” by David Weenink. In particular, this function is implemented using equations 29 and 30 from his paper. We also use the idea of doing CCA on a reduced rank approximation of L and R as suggested by Paramveer S. Dhillon in his paper “Two Step CCA: A new spectral method for estimating vector models of words”.

class dlib.cca_outputs
Ltrans
Rtrans
__init__

x.__init__(...) initializes x; see help(type(x)) for signature

correlations
dlib.centered_rect(p: dlib.point, width: int, height: int) → dlib.rectangle
dlib.centered_rects(pts: dlib.points, width: int, height: int) → dlib.rectangles
dlib.chinese_whispers_clustering(descriptors: list, threshold: float) → list

Takes a list of descriptors and returns a list that contains a label for each descriptor. Clustering is done using dlib::chinese_whispers.

class dlib.cnn_face_detection_model_v1

This object detects human faces in an image. The constructor loads the face detection model from a file. You can download a pre-trained model from http://dlib.net/files/mmod_human_face_detector.dat.bz2.

__call__(*args, **kwargs)

Overloaded function.

  1. __call__(self: dlib.cnn_face_detection_model_v1, imgs: list, upsample_num_times: int=0L, batch_size: int=128L) -> std::vector<std::vector<dlib::mmod_rect, std::allocator<dlib::mmod_rect> >, std::allocator<std::vector<dlib::mmod_rect, std::allocator<dlib::mmod_rect> > > >

takes a list of images as input returning a 2d list of mmod rectangles

  1. __call__(self: dlib.cnn_face_detection_model_v1, img: array, upsample_num_times: int=0L) -> std::vector<dlib::mmod_rect, std::allocator<dlib::mmod_rect> >
Find faces in an image using a deep learning model.
  • Upsamples the image upsample_num_times before running the face detector.
__init__(self: dlib.cnn_face_detection_model_v1, filename: unicode) → None
dlib.convert_image(*args, **kwargs)

Overloaded function.

  1. convert_image(img: numpy.ndarray[(rows,cols),uint8], dtype: unicode) -> array
  2. convert_image(img: numpy.ndarray[(rows,cols),uint16], dtype: unicode) -> array
  3. convert_image(img: numpy.ndarray[(rows,cols),uint32], dtype: unicode) -> array
  4. convert_image(img: numpy.ndarray[(rows,cols),uint64], dtype: unicode) -> array
  5. convert_image(img: numpy.ndarray[(rows,cols),int8], dtype: unicode) -> array
  6. convert_image(img: numpy.ndarray[(rows,cols),int16], dtype: unicode) -> array
  7. convert_image(img: numpy.ndarray[(rows,cols),int32], dtype: unicode) -> array
  8. convert_image(img: numpy.ndarray[(rows,cols),int64], dtype: unicode) -> array
  9. convert_image(img: numpy.ndarray[(rows,cols),float32], dtype: unicode) -> array
  10. convert_image(img: numpy.ndarray[(rows,cols),float64], dtype: unicode) -> array
  11. convert_image(img: numpy.ndarray[(rows,cols,3),uint8], dtype: unicode) -> array
Converts an image to a target pixel type. dtype must be a string containing one of the following:
uint8, int8, uint16, int16, uint32, int32, uint64, int64, float32, float, float64, double, or rgb_pixel

When converting from a color space with more than 255 values the pixel intensity is saturated at the minimum and maximum pixel values of the target pixel type. For example, if you convert a float valued image to uint8 then float values will be truncated to integers and values larger than 255 are converted to 255 while values less than 0 are converted to 0.

dlib.convert_image_scaled(*args, **kwargs)

Overloaded function.

  1. convert_image_scaled(img: numpy.ndarray[(rows,cols),uint8], dtype: unicode, thresh: float=4L) -> array
  2. convert_image_scaled(img: numpy.ndarray[(rows,cols),uint16], dtype: unicode, thresh: float=4L) -> array
  3. convert_image_scaled(img: numpy.ndarray[(rows,cols),uint32], dtype: unicode, thresh: float=4L) -> array
  4. convert_image_scaled(img: numpy.ndarray[(rows,cols),uint64], dtype: unicode, thresh: float=4L) -> array
  5. convert_image_scaled(img: numpy.ndarray[(rows,cols),int8], dtype: unicode, thresh: float=4L) -> array
  6. convert_image_scaled(img: numpy.ndarray[(rows,cols),int16], dtype: unicode, thresh: float=4L) -> array
  7. convert_image_scaled(img: numpy.ndarray[(rows,cols),int32], dtype: unicode, thresh: float=4L) -> array
  8. convert_image_scaled(img: numpy.ndarray[(rows,cols),int64], dtype: unicode, thresh: float=4L) -> array
  9. convert_image_scaled(img: numpy.ndarray[(rows,cols),float32], dtype: unicode, thresh: float=4L) -> array
  10. convert_image_scaled(img: numpy.ndarray[(rows,cols),float64], dtype: unicode, thresh: float=4L) -> array
  11. convert_image_scaled(img: numpy.ndarray[(rows,cols,3),uint8], dtype: unicode, thresh: float=4L) -> array
requires
  • thresh > 0
ensures
  • Converts an image to a target pixel type. dtype must be a string containing one of the following: uint8, int8, uint16, int16, uint32, int32, uint64, int64, float32, float, float64, double, or rgb_pixel

    The contents of img will be scaled to fit the dynamic range of the target pixel type. The thresh parameter is used to filter source pixel values which are outliers. These outliers will saturate at the edge of the destination image’s dynamic range.

  • Specifically, for all valid r and c:
    • We scale img[r][c] into the dynamic range of the target pixel type. This is done using the mean and standard deviation of img. Call the mean M and the standard deviation D. Then the scaling from source to destination is performed using the following mapping:

      let SRC_UPPER = min(M + thresh*D, max(img)) let SRC_LOWER = max(M - thresh*D, min(img)) let DEST_UPPER = max value possible for the selected dtype. let DEST_LOWER = min value possible for the selected dtype.

      MAPPING: [SRC_LOWER, SRC_UPPER] -> [DEST_LOWER, DEST_UPPER]

      Where this mapping is a linear mapping of values from the left range into the right range of values. Source pixel values outside the left range are modified to be at the appropriate end of the range.

class dlib.correlation_tracker

This is a tool for tracking moving objects in a video stream. You give it the bounding box of an object in the first frame and it attempts to track the object in the box from frame to frame. This tool is an implementation of the method described in the following paper:

Danelljan, Martin, et al. ‘Accurate scale estimation for robust visual tracking.’ Proceedings of the British Machine Vision Conference BMVC. 2014.
__init__(self: dlib.correlation_tracker) → None
get_position(self: dlib.correlation_tracker) → dlib.drectangle

returns the predicted position of the object under track.

start_track(*args, **kwargs)

Overloaded function.

  1. start_track(self: dlib.correlation_tracker, image: array, bounding_box: dlib.drectangle) -> None

    requires
    • image is a numpy ndarray containing either an 8bit grayscale or RGB image.
    • bounding_box.is_empty() == false
    ensures
    • This object will start tracking the thing inside the bounding box in the given image. That is, if you call update() with subsequent video frames then it will try to keep track of the position of the object inside bounding_box.
    • #get_position() == bounding_box
  2. start_track(self: dlib.correlation_tracker, image: array, bounding_box: dlib.rectangle) -> None

    requires
    • image is a numpy ndarray containing either an 8bit grayscale or RGB image.
    • bounding_box.is_empty() == false
    ensures
    • This object will start tracking the thing inside the bounding box in the given image. That is, if you call update() with subsequent video frames then it will try to keep track of the position of the object inside bounding_box.
    • #get_position() == bounding_box
update(*args, **kwargs)

Overloaded function.

  1. update(self: dlib.correlation_tracker, image: array) -> float

    requires
    • image is a numpy ndarray containing either an 8bit grayscale or RGB image.
    • get_position().is_empty() == false (i.e. you must have started tracking by calling start_track())
    ensures
    • performs: return update(img, get_position())
  2. update(self: dlib.correlation_tracker, image: array, guess: dlib.drectangle) -> float

    requires
    • image is a numpy ndarray containing either an 8bit grayscale or RGB image.
    • get_position().is_empty() == false (i.e. you must have started tracking by calling start_track())
    ensures
    • When searching for the object in img, we search in the area around the provided guess.
    • #get_position() == the new predicted location of the object in img. This location will be a copy of guess that has been translated and scaled appropriately based on the content of img so that it, hopefully, bounds the object in img.
    • Returns the peak to side-lobe ratio. This is a number that measures how confident the tracker is that the object is inside #get_position(). Larger values indicate higher confidence.
  3. update(self: dlib.correlation_tracker, image: array, guess: dlib.rectangle) -> float

    requires
    • image is a numpy ndarray containing either an 8bit grayscale or RGB image.
    • get_position().is_empty() == false (i.e. you must have started tracking by calling start_track())
    ensures
    • When searching for the object in img, we search in the area around the provided guess.
    • #get_position() == the new predicted location of the object in img. This location will be a copy of guess that has been translated and scaled appropriately based on the content of img so that it, hopefully, bounds the object in img.
    • Returns the peak to side-lobe ratio. This is a number that measures how confident the tracker is that the object is inside #get_position(). Larger values indicate higher confidence.
dlib.count_points_between_lines(*args, **kwargs)

Overloaded function.

  1. count_points_between_lines(l1: dlib.line, l2: dlib.line, reference_point: dlib.dpoint, pts: dlib.points) -> float
  2. count_points_between_lines(l1: dlib.line, l2: dlib.line, reference_point: dlib.dpoint, pts: dlib.dpoints) -> float
ensures
  • Counts and returns the number of points in pts that are between lines l1 and l2. Since a pair of lines will, in the general case, divide the plane into 4 regions, we identify the region of interest as the one that contains the reference_point. Therefore, this function counts the number of points in pts that appear in the same region as reference_point.
dlib.count_points_on_side_of_line(*args, **kwargs)

Overloaded function.

  1. count_points_on_side_of_line(l: dlib.line, reference_point: dlib.dpoint, pts: dlib.points, dist_thresh: float) -> int
  2. count_points_on_side_of_line(l: dlib.line, reference_point: dlib.dpoint, pts: dlib.dpoints, dist_thresh: float) -> int
ensures
  • Returns a count of how many points in pts are on the same side of l as reference_point, but also no more than dist_thresh distance from the line.
dlib.count_steps_without_decrease(time_series: object, probability_of_decrease: float=0.51) → int
requires
  • time_series must be a one dimensional array of real numbers.
  • 0.5 < probability_of_decrease < 1
ensures
  • If you think of the contents of time_series as a potentially noisy time series, then this function returns a count of how long the time series has gone without noticeably decreasing in value. It does this by scanning along the elements, starting from the end (i.e. time_series[-1]) to the beginning, and checking how many elements you need to examine before you are confident that the series has been decreasing in value. Here, “confident of decrease” means the probability of decrease is >= probability_of_decrease.
  • Setting probability_of_decrease to 0.51 means we count until we see even a small hint of decrease, whereas a larger value of 0.99 would return a larger count since it keeps going until it is nearly certain the time series is decreasing.
  • The max possible output from this function is len(time_series).
  • The implementation of this function is done using the dlib::running_gradient object, which is a tool that finds the least squares fit of a line to the time series and the confidence interval around the slope of that line. That can then be used in a simple statistical test to determine if the slope is positive or negative.
dlib.count_steps_without_decrease_robust(time_series: object, probability_of_decrease: float=0.51, quantile_discard: float=0.1) → int
requires
  • time_series must be a one dimensional array of real numbers.
  • 0.5 < probability_of_decrease < 1
  • 0 <= quantile_discard <= 1
ensures
  • This function behaves just like count_steps_without_decrease(time_series,probability_of_decrease) except that it ignores values in the time series that are in the upper quantile_discard quantile. So for example, if the quantile discard is 0.1 then the 10% largest values in the time series are ignored.
dlib.cross_validate_ranking_trainer(*args, **kwargs)

Overloaded function.

  1. cross_validate_ranking_trainer(trainer: dlib.svm_rank_trainer, samples: dlib.ranking_pairs, folds: int) -> ranking_test
  2. cross_validate_ranking_trainer(trainer: dlib.svm_rank_trainer_sparse, samples: dlib.sparse_ranking_pairs, folds: int) -> ranking_test
dlib.cross_validate_sequence_segmenter(*args, **kwargs)

Overloaded function.

  1. cross_validate_sequence_segmenter(samples: dlib.vectorss, segments: dlib.rangess, folds: int, params: dlib.segmenter_params=<BIO,highFeats,signed,win=5,threads=4,eps=0.1,cache=40,non-verbose,C=100>) -> dlib.segmenter_test
  2. cross_validate_sequence_segmenter(samples: dlib.sparse_vectorss, segments: dlib.rangess, folds: int, params: dlib.segmenter_params=<BIO,highFeats,signed,win=5,threads=4,eps=0.1,cache=40,non-verbose,C=100>) -> dlib.segmenter_test
dlib.cross_validate_trainer(*args, **kwargs)

Overloaded function.

  1. cross_validate_trainer(trainer: dlib.svm_c_trainer_radial_basis, x: dlib.vectors, y: dlib.array, folds: int) -> dlib._binary_test
  2. cross_validate_trainer(trainer: dlib.svm_c_trainer_sparse_radial_basis, x: dlib.sparse_vectors, y: dlib.array, folds: int) -> dlib._binary_test
  3. cross_validate_trainer(trainer: dlib.svm_c_trainer_histogram_intersection, x: dlib.vectors, y: dlib.array, folds: int) -> dlib._binary_test
  4. cross_validate_trainer(trainer: dlib.svm_c_trainer_sparse_histogram_intersection, x: dlib.sparse_vectors, y: dlib.array, folds: int) -> dlib._binary_test
  5. cross_validate_trainer(trainer: dlib.svm_c_trainer_linear, x: dlib.vectors, y: dlib.array, folds: int) -> dlib._binary_test
  6. cross_validate_trainer(trainer: dlib.svm_c_trainer_sparse_linear, x: dlib.sparse_vectors, y: dlib.array, folds: int) -> dlib._binary_test
  7. cross_validate_trainer(trainer: dlib.rvm_trainer_radial_basis, x: dlib.vectors, y: dlib.array, folds: int) -> dlib._binary_test
  8. cross_validate_trainer(trainer: dlib.rvm_trainer_sparse_radial_basis, x: dlib.sparse_vectors, y: dlib.array, folds: int) -> dlib._binary_test
  9. cross_validate_trainer(trainer: dlib.rvm_trainer_histogram_intersection, x: dlib.vectors, y: dlib.array, folds: int) -> dlib._binary_test
  10. cross_validate_trainer(trainer: dlib.rvm_trainer_sparse_histogram_intersection, x: dlib.sparse_vectors, y: dlib.array, folds: int) -> dlib._binary_test
  11. cross_validate_trainer(trainer: dlib.rvm_trainer_linear, x: dlib.vectors, y: dlib.array, folds: int) -> dlib._binary_test
  12. cross_validate_trainer(trainer: dlib.rvm_trainer_sparse_linear, x: dlib.sparse_vectors, y: dlib.array, folds: int) -> dlib._binary_test
dlib.cross_validate_trainer_threaded(*args, **kwargs)

Overloaded function.

  1. cross_validate_trainer_threaded(trainer: dlib.svm_c_trainer_radial_basis, x: dlib.vectors, y: dlib.array, folds: int, num_threads: int) -> dlib._binary_test
  2. cross_validate_trainer_threaded(trainer: dlib.svm_c_trainer_sparse_radial_basis, x: dlib.sparse_vectors, y: dlib.array, folds: int, num_threads: int) -> dlib._binary_test
  3. cross_validate_trainer_threaded(trainer: dlib.svm_c_trainer_histogram_intersection, x: dlib.vectors, y: dlib.array, folds: int, num_threads: int) -> dlib._binary_test
  4. cross_validate_trainer_threaded(trainer: dlib.svm_c_trainer_sparse_histogram_intersection, x: dlib.sparse_vectors, y: dlib.array, folds: int, num_threads: int) -> dlib._binary_test
  5. cross_validate_trainer_threaded(trainer: dlib.svm_c_trainer_linear, x: dlib.vectors, y: dlib.array, folds: int, num_threads: int) -> dlib._binary_test
  6. cross_validate_trainer_threaded(trainer: dlib.svm_c_trainer_sparse_linear, x: dlib.sparse_vectors, y: dlib.array, folds: int, num_threads: int) -> dlib._binary_test
  7. cross_validate_trainer_threaded(trainer: dlib.rvm_trainer_radial_basis, x: dlib.vectors, y: dlib.array, folds: int, num_threads: int) -> dlib._binary_test
  8. cross_validate_trainer_threaded(trainer: dlib.rvm_trainer_sparse_radial_basis, x: dlib.sparse_vectors, y: dlib.array, folds: int, num_threads: int) -> dlib._binary_test
  9. cross_validate_trainer_threaded(trainer: dlib.rvm_trainer_histogram_intersection, x: dlib.vectors, y: dlib.array, folds: int, num_threads: int) -> dlib._binary_test
  10. cross_validate_trainer_threaded(trainer: dlib.rvm_trainer_sparse_histogram_intersection, x: dlib.sparse_vectors, y: dlib.array, folds: int, num_threads: int) -> dlib._binary_test
  11. cross_validate_trainer_threaded(trainer: dlib.rvm_trainer_linear, x: dlib.vectors, y: dlib.array, folds: int, num_threads: int) -> dlib._binary_test
  12. cross_validate_trainer_threaded(trainer: dlib.rvm_trainer_sparse_linear, x: dlib.sparse_vectors, y: dlib.array, folds: int, num_threads: int) -> dlib._binary_test
dlib.distance_to_line(*args, **kwargs)

Overloaded function.

  1. distance_to_line(l: dlib.line, p: dlib.point) -> float
  2. distance_to_line(l: dlib.line, p: dlib.dpoint) -> float

returns abs(signed_distance_to_line(l,p))

dlib.dot(*args, **kwargs)

Overloaded function.

  1. dot(arg0: dlib.vector, arg1: dlib.vector) -> float

Compute the dot product between two dense column vectors.

  1. dot(a: dlib.point, b: dlib.point) -> int

Returns the dot product of the points a and b.

  1. dot(a: dlib.dpoint, b: dlib.dpoint) -> float

Returns the dot product of the points a and b.

class dlib.dpoint

This object represents a single point of floating point coordinates that maps directly to a dlib::dpoint.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.dpoint, x: float, y: float) -> None
  2. __init__(self: dlib.dpoint, p: dlib.point) -> None
  3. __init__(self: dlib.dpoint, v: numpy.ndarray[int64]) -> None
  4. __init__(self: dlib.dpoint, v: numpy.ndarray[float32]) -> None
  5. __init__(self: dlib.dpoint, v: numpy.ndarray[float64]) -> None
normalize(self: dlib.dpoint) → dlib.dpoint

Returns a unit normalized copy of this vector.

x

The x-coordinate of the dpoint.

y

The y-coordinate of the dpoint.

class dlib.dpoints

An array of dpoint objects.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.dpoints) -> None
  2. __init__(self: dlib.dpoints, arg0: dlib.dpoints) -> None

Copy constructor

  1. __init__(self: dlib.dpoints, arg0: iterable) -> None
append(self: dlib.dpoints, x: dlib.dpoint) → None

Add an item to the end of the list

clear(self: dlib.dpoints) → None
count(self: dlib.dpoints, x: dlib.dpoint) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.dpoints, L: dlib.dpoints) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.dpoints, arg0: list) -> None
insert(self: dlib.dpoints, i: int, x: dlib.dpoint) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.dpoints) -> dlib.dpoint

Remove and return the last item

  1. pop(self: dlib.dpoints, i: int) -> dlib.dpoint

Remove and return the item at index i

remove(self: dlib.dpoints, x: dlib.dpoint) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.dpoints, arg0: int) → None
class dlib.drectangle

This object represents a rectangular area of an image with floating point coordinates.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.drectangle, left: float, top: float, right: float, bottom: float) -> None
  2. __init__(self: dlib.drectangle, rect: dlib.rectangle) -> None
  3. __init__(self: dlib.drectangle, rect: dlib.drectangle) -> None
  4. __init__(self: dlib.drectangle) -> None
area(self: dlib.drectangle) → float
bl_corner(self: dlib.drectangle) → dlib.dpoint

Returns the bottom left corner of the rectangle.

bottom(self: dlib.drectangle) → float
br_corner(self: dlib.drectangle) → dlib.dpoint

Returns the bottom right corner of the rectangle.

center(self: dlib.drectangle) → dlib.point
contains(*args, **kwargs)

Overloaded function.

  1. contains(self: dlib.drectangle, point: dlib.point) -> bool
  2. contains(self: dlib.drectangle, x: int, y: int) -> bool
  3. contains(self: dlib.drectangle, rectangle: dlib.drectangle) -> bool
dcenter(self: dlib.drectangle) → dlib.point
height(self: dlib.drectangle) → float
intersect(self: dlib.drectangle, rectangle: dlib.drectangle) → dlib.drectangle
is_empty(self: dlib.drectangle) → bool
left(self: dlib.drectangle) → float
right(self: dlib.drectangle) → float
tl_corner(self: dlib.drectangle) → dlib.dpoint

Returns the top left corner of the rectangle.

top(self: dlib.drectangle) → float
tr_corner(self: dlib.drectangle) → dlib.dpoint

Returns the top right corner of the rectangle.

width(self: dlib.drectangle) → float
dlib.equalize_histogram(*args, **kwargs)

Overloaded function.

  1. equalize_histogram(img: numpy.ndarray[(rows,cols),uint8]) -> numpy.ndarray[(rows,cols),uint8]
  2. equalize_histogram(img: numpy.ndarray[(rows,cols),uint16]) -> numpy.ndarray[(rows,cols),uint16]

Returns a histogram equalized version of img.

dlib.extract_image_4points(*args, **kwargs)

Overloaded function.

  1. extract_image_4points(img: numpy.ndarray[(rows,cols),uint8], corners: list, rows: int, columns: int) -> numpy.ndarray[(rows,cols),uint8]
  2. extract_image_4points(img: numpy.ndarray[(rows,cols),uint16], corners: list, rows: int, columns: int) -> numpy.ndarray[(rows,cols),uint16]
  3. extract_image_4points(img: numpy.ndarray[(rows,cols),uint32], corners: list, rows: int, columns: int) -> numpy.ndarray[(rows,cols),uint32]
  4. extract_image_4points(img: numpy.ndarray[(rows,cols),uint64], corners: list, rows: int, columns: int) -> numpy.ndarray[(rows,cols),uint64]
  5. extract_image_4points(img: numpy.ndarray[(rows,cols),int8], corners: list, rows: int, columns: int) -> numpy.ndarray[(rows,cols),int8]
  6. extract_image_4points(img: numpy.ndarray[(rows,cols),int16], corners: list, rows: int, columns: int) -> numpy.ndarray[(rows,cols),int16]
  7. extract_image_4points(img: numpy.ndarray[(rows,cols),int32], corners: list, rows: int, columns: int) -> numpy.ndarray[(rows,cols),int32]
  8. extract_image_4points(img: numpy.ndarray[(rows,cols),int64], corners: list, rows: int, columns: int) -> numpy.ndarray[(rows,cols),int64]
  9. extract_image_4points(img: numpy.ndarray[(rows,cols),float32], corners: list, rows: int, columns: int) -> numpy.ndarray[(rows,cols),float32]
  10. extract_image_4points(img: numpy.ndarray[(rows,cols),float64], corners: list, rows: int, columns: int) -> numpy.ndarray[(rows,cols),float64]
  11. extract_image_4points(img: numpy.ndarray[(rows,cols,3),uint8], corners: list, rows: int, columns: int) -> numpy.ndarray[(rows,cols,3),uint8]
requires
  • corners is a list of dpoint or line objects.
  • len(corners) == 4
  • rows >= 0
  • columns >= 0
ensures
  • The returned image has the given number of rows and columns.

  • if (corners contains dpoints) then
    • The 4 points in corners define a convex quadrilateral and this function extracts that part of the input image img and returns it. Therefore, each corner of the quadrilateral is associated to a corner of the extracted image and bilinear interpolation and a projective mapping is used to transform the pixels in the quadrilateral into the output image. To determine which corners of the quadrilateral map to which corners of the returned image we fit the tightest possible rectangle to the quadrilateral and map its vertices to their nearest rectangle corners. These corners are then trivially mapped to the output image (i.e. upper left corner to upper left corner, upper right corner to upper right corner, etc.).
  • else
    • This routine finds the 4 intersecting points of the given lines which form a convex quadrilateral and uses them as described above to extract an image. i.e. It just then calls: extract_image_4points(img, intersections_between_lines, rows, columns).
    • If no convex quadrilateral can be made from the given lines then this routine throws no_convex_quadrilateral.
class dlib.face_recognition_model_v1

This object maps human faces into 128D vectors where pictures of the same person are mapped near to each other and pictures of different people are mapped far apart. The constructor loads the face recognition model from a file. The model file is available here: http://dlib.net/files/dlib_face_recognition_resnet_model_v1.dat.bz2

__init__(self: dlib.face_recognition_model_v1, arg0: unicode) → None
compute_face_descriptor(*args, **kwargs)

Overloaded function.

  1. compute_face_descriptor(self: dlib.face_recognition_model_v1, img: numpy.ndarray[(rows,cols,3),uint8], face: dlib.full_object_detection, num_jitters: int=0L) -> dlib.vector

Takes an image and a full_object_detection that references a face in that image and converts it into a 128D face descriptor. If num_jitters>1 then each face will be randomly jittered slightly num_jitters times, each run through the 128D projection, and the average used as the face descriptor.

  1. compute_face_descriptor(self: dlib.face_recognition_model_v1, img: numpy.ndarray[(rows,cols,3),uint8], faces: std::vector<dlib::full_object_detection, std::allocator<dlib::full_object_detection> >, num_jitters: int=0L) -> dlib.vectors

Takes an image and an array of full_object_detections that reference faces in that image and converts them into 128D face descriptors. If num_jitters>1 then each face will be randomly jittered slightly num_jitters times, each run through the 128D projection, and the average used as the face descriptor.

class dlib.fhog_object_detector

This object represents a sliding window histogram-of-oriented-gradients based object detector.

__call__(self: dlib.fhog_object_detector, image: array, upsample_num_times: int=0L) → dlib.rectangles
requires
  • image is a numpy ndarray containing either an 8bit grayscale or RGB image.
  • upsample_num_times >= 0
ensures
  • This function runs the object detector on the input image and returns a list of detections.
  • Upsamples the image upsample_num_times before running the basic detector.
__init__(self: dlib.fhog_object_detector, arg0: unicode) → None

Loads an object detector from a file that contains the output of the train_simple_object_detector() routine or a serialized C++ object of type object_detector<scan_fhog_pyramid<pyramid_down<6>>>.

run(self: dlib.fhog_object_detector, image: array, upsample_num_times: int=0L, adjust_threshold: float=0.0) → tuple
requires
  • image is a numpy ndarray containing either an 8bit grayscale or RGB image.
  • upsample_num_times >= 0
ensures
  • This function runs the object detector on the input image and returns a tuple of (list of detections, list of scores, list of weight_indices).
  • Upsamples the image upsample_num_times before running the basic detector.
run_multiple(detectors: list, image: array, upsample_num_times: int=0L, adjust_threshold: float=0.0) → tuple
requires
  • detectors is a list of detectors.
  • image is a numpy ndarray containing either an 8bit grayscale or RGB image.
  • upsample_num_times >= 0
ensures
  • This function runs the list of object detectors at once on the input image and returns a tuple of (list of detections, list of scores, list of weight_indices).
  • Upsamples the image upsample_num_times before running the basic detector.
save(self: dlib.fhog_object_detector, detector_output_filename: unicode) → None

Save a simple_object_detector to the provided path.

dlib.find_bright_keypoints(xx: numpy.ndarray[(rows,cols),float32], xy: numpy.ndarray[(rows,cols),float32], yy: numpy.ndarray[(rows,cols),float32]) → numpy.ndarray[(rows,cols),float32]
requires
  • xx, xy, and yy all have the same dimensions.
ensures
  • This routine finds bright “keypoints” in an image. In general, these are bright/white localized blobs. It does this by computing the determinant of the image Hessian at each location and storing this value into the returned image if both eigenvalues of the Hessian are negative. If either eigenvalue is positive then the output value for that pixel is 0. I.e.

    • Let OUT denote the returned image.

    • for all valid r,c:
      • OUT[r][c] == a number >= 0 and larger values indicate the presence of a keypoint at this pixel location.
  • We assume that xx, xy, and yy are the 3 second order gradients of the image in question. You can obtain these gradients using the image_gradients class.

  • The output image will have the same dimensions as the input images.

dlib.find_bright_lines(xx: numpy.ndarray[(rows,cols),float32], xy: numpy.ndarray[(rows,cols),float32], yy: numpy.ndarray[(rows,cols),float32]) → tuple
requires
  • xx, xy, and yy all have the same dimensions.
ensures
  • This routine is similar to sobel_edge_detector(), except instead of finding an edge it finds a bright/white line. For example, the border between a black piece of paper and a white table is an edge, but a curve drawn with a pencil on a piece of paper makes a line. Therefore, the output of this routine is a vector field encoded in the horz and vert images, which are returned in a tuple where the first element is horz and the second is vert.

    The vector obtains a large magnitude when centered on a bright line in an image and the direction of the vector is perpendicular to the line. To be very precise, each vector points in the direction of greatest change in second derivative and the magnitude of the vector encodes the derivative magnitude in that direction. Moreover, if the second derivative is positive then the output vector is zero. This zeroing if positive gradients causes the output to be sensitive only to bright lines surrounded by darker pixels.

  • We assume that xx, xy, and yy are the 3 second order gradients of the image in question. You can obtain these gradients using the image_gradients class.

  • The output images will have the same dimensions as the input images.

dlib.find_candidate_object_locations(image: array, rects: list, kvals: tuple=(50L, 200L, 3L), min_size: int=20L, max_merging_iterations: int=50L) → None

Returns found candidate objects requires

  • image == an image object which is a numpy ndarray
  • len(kvals) == 3
  • kvals should be a tuple that specifies the range of k values to use. In particular, it should take the form (start, end, num) where num > 0.
ensures
  • This function takes an input image and generates a set of candidate rectangles which are expected to bound any objects in the image. It does this by running a version of the segment_image() routine on the image and then reports rectangles containing each of the segments as well as rectangles containing unions of adjacent segments. The basic idea is described in the paper:

    Segmentation as Selective Search for Object Recognition by Koen E. A. van de Sande, et al.

    Note that this function deviates from what is described in the paper slightly. See the code for details.

  • The basic segmentation is performed kvals[2] times, each time with the k parameter (see segment_image() and the Felzenszwalb paper for details on k) set to a different value from the range of numbers linearly spaced between kvals[0] to kvals[1].

  • When doing the basic segmentations prior to any box merging, we discard all rectangles that have an area < min_size. Therefore, all outputs and subsequent merged rectangles are built out of rectangles that contain at least min_size pixels. Note that setting min_size to a smaller value than you might otherwise be interested in using can be useful since it allows a larger number of possible merged boxes to be created.

  • There are max_merging_iterations rounds of neighboring blob merging. Therefore, this parameter has some effect on the number of output rectangles you get, with larger values of the parameter giving more output rectangles.

  • This function appends the output rectangles into #rects. This means that any rectangles in rects before this function was called will still be in there after it terminates. Note further that #rects will not contain any duplicate rectangles. That is, for all valid i and j where i != j it will be true that:

    • #rects[i] != rects[j]
dlib.find_dark_keypoints(xx: numpy.ndarray[(rows,cols),float32], xy: numpy.ndarray[(rows,cols),float32], yy: numpy.ndarray[(rows,cols),float32]) → numpy.ndarray[(rows,cols),float32]
requires
  • xx, xy, and yy all have the same dimensions.
ensures
  • This routine finds dark “keypoints” in an image. In general, these are dark localized blobs. It does this by computing the determinant of the image Hessian at each location and storing this value into the returned image if both eigenvalues of the Hessian are negative. If either eigenvalue is negative then the output value for that pixel is 0. I.e.

    • Let OUT denote the returned image.

    • for all valid r,c:
      • OUT[r][c] == a number >= 0 and larger values indicate the presence of a keypoint at this pixel location.
  • We assume that xx, xy, and yy are the 3 second order gradients of the image in question. You can obtain these gradients using the image_gradients class.

  • The output image will have the same dimensions as the input images.

dlib.find_dark_lines(xx: numpy.ndarray[(rows,cols),float32], xy: numpy.ndarray[(rows,cols),float32], yy: numpy.ndarray[(rows,cols),float32]) → tuple
requires
  • xx, xy, and yy all have the same dimensions.
ensures
  • This routine is similar to sobel_edge_detector(), except instead of finding an edge it finds a dark line. For example, the border between a black piece of paper and a white table is an edge, but a curve drawn with a pencil on a piece of paper makes a line. Therefore, the output of this routine is a vector field encoded in the horz and vert images, which are returned in a tuple where the first element is horz and the second is vert.

    The vector obtains a large magnitude when centered on a dark line in an image and the direction of the vector is perpendicular to the line. To be very precise, each vector points in the direction of greatest change in second derivative and the magnitude of the vector encodes the derivative magnitude in that direction. Moreover, if the second derivative is negative then the output vector is zero. This zeroing if negative gradients causes the output to be sensitive only to dark lines surrounded by darker pixels.

  • We assume that xx, xy, and yy are the 3 second order gradients of the image in question. You can obtain these gradients using the image_gradients class.

  • The output images will have the same dimensions as the input images.

dlib.find_line_endpoints(img: numpy.ndarray[(rows,cols),uint8]) → dlib.points
requires
  • all pixels in img are set to either 255 or 0. (i.e. it must be a binary image)
ensures
  • This routine finds endpoints of lines in a thinned binary image. For example, if the image was produced by skeleton() or something like a Canny edge detector then you can use find_line_endpoints() to find the pixels sitting on the ends of lines.
dlib.find_max_global(*args, **kwargs)

Overloaded function.

  1. find_max_global(f: object, bound1: list, bound2: list, is_integer_variable: list, num_function_calls: int, solver_epsilon: float=0L) -> tuple
requires
  • len(bound1) == len(bound2) == len(is_integer_variable)
  • for all valid i: bound1[i] != bound2[i]
  • solver_epsilon >= 0
  • f() is a real valued multi-variate function. It must take scalar real numbers as its arguments and the number of arguments must be len(bound1).
ensures
  • This function performs global optimization on the given f() function. The goal is to maximize the following objective function:

    f(x)

    subject to the constraints:

    min(bound1[i],bound2[i]) <= x[i] <= max(bound1[i],bound2[i]) if (is_integer_variable[i]) then x[i] is an integer.

  • find_max_global() runs until it has called f() num_function_calls times. Then it returns the best x it has found along with the corresponding output of f(). That is, it returns (best_x_seen,f(best_x_seen)). Here best_x_seen is a list containing the best arguments to f() this function has found.

  • find_max_global() uses a global optimization method based on a combination of non-parametric global function modeling and quadratic trust region modeling to efficiently find a global maximizer. It usually does a good job with a relatively small number of calls to f(). For more information on how it works read the documentation for dlib’s global_function_search object. However, one notable element is the solver epsilon, which you can adjust.

    The search procedure will only attempt to find a global maximizer to at most solver_epsilon accuracy. Once a local maximizer is found to that accuracy the search will focus entirely on finding other maxima elsewhere rather than on further improving the current local optima found so far. That is, once a local maxima is identified to about solver_epsilon accuracy, the algorithm will spend all its time exploring the function to find other local maxima to investigate. An epsilon of 0 means it will keep solving until it reaches full floating point precision. Larger values will cause it to switch to pure global exploration sooner and therefore might be more effective if your objective function has many local maxima and you don’t care about a super high precision solution.

  • Any variables that satisfy the following conditions are optimized on a log-scale:
    • The lower bound on the variable is > 0
    • The ratio of the upper bound to lower bound is > 1000
    • The variable is not an integer variable

    We do this because it’s common to optimize machine learning models that have parameters with bounds in a range such as [1e-5 to 1e10] (e.g. the SVM C parameter) and it’s much more appropriate to optimize these kinds of variables on a log scale. So we transform them by applying log() to them and then undo the transform via exp() before invoking the function being optimized. Therefore, this transformation is invisible to the user supplied functions. In most cases, it improves the efficiency of the optimizer.

  1. find_max_global(f: object, bound1: list, bound2: list, num_function_calls: int, solver_epsilon: float=0L) -> tuple

This function simply calls the other version of find_max_global() with is_integer_variable set to False for all variables.

dlib.find_min_global(*args, **kwargs)

Overloaded function.

  1. find_min_global(f: object, bound1: list, bound2: list, is_integer_variable: list, num_function_calls: int, solver_epsilon: float=0L) -> tuple

This function is just like find_max_global(), except it performs minimization rather than maximization.

  1. find_min_global(f: object, bound1: list, bound2: list, num_function_calls: int, solver_epsilon: float=0L) -> tuple

This function simply calls the other version of find_min_global() with is_integer_variable set to False for all variables.

dlib.find_optimal_rect_filter(rects: std::vector<dlib::rectangle, std::allocator<dlib::rectangle> >, smoothness: float=1L) → dlib.rect_filter
requires
  • rects.size() > 4
  • smoothness >= 0
ensures
  • This function finds the “optimal” settings of a rect_filter based on recorded measurement data stored in rects. Here we assume that rects is a complete track history of some object’s measured positions. Essentially, what we do is find the rect_filter that minimizes the following objective function:

    sum of abs(predicted_location[i] - measured_location[i]) + smoothness*abs(filtered_location[i]-filtered_location[i-1]) Where i is a time index.

    The sum runs over all the data in rects. So what we do is find the filter settings that produce smooth filtered trajectories but also produce filtered outputs that are as close to the measured positions as possible. The larger the value of smoothness the less jittery the filter outputs will be, but they might become biased or laggy if smoothness is set really high.

dlib.find_peaks(*args, **kwargs)

Overloaded function.

  1. find_peaks(img: numpy.ndarray[(rows,cols),float32], non_max_suppression_radius: float, thresh: float) -> dlib.points
  2. find_peaks(img: numpy.ndarray[(rows,cols),float64], non_max_suppression_radius: float, thresh: float) -> dlib.points
  3. find_peaks(img: numpy.ndarray[(rows,cols),uint8], non_max_suppression_radius: float, thresh: int) -> dlib.points
  4. find_peaks(img: numpy.ndarray[(rows,cols),uint16], non_max_suppression_radius: float, thresh: int) -> dlib.points
  5. find_peaks(img: numpy.ndarray[(rows,cols),uint32], non_max_suppression_radius: float, thresh: int) -> dlib.points
  6. find_peaks(img: numpy.ndarray[(rows,cols),uint64], non_max_suppression_radius: float, thresh: int) -> dlib.points
  7. find_peaks(img: numpy.ndarray[(rows,cols),int8], non_max_suppression_radius: float, thresh: int) -> dlib.points
  8. find_peaks(img: numpy.ndarray[(rows,cols),int16], non_max_suppression_radius: float, thresh: int) -> dlib.points
  9. find_peaks(img: numpy.ndarray[(rows,cols),int32], non_max_suppression_radius: float, thresh: int) -> dlib.points
  10. find_peaks(img: numpy.ndarray[(rows,cols),int64], non_max_suppression_radius: float, thresh: int) -> dlib.points
requires
  • non_max_suppression_radius >= 0
ensures
  • Scans the given image and finds all pixels with values >= thresh that are also local maximums within their 8-connected neighborhood of the image. Such pixels are collected, sorted in decreasing order of their pixel values, and then non-maximum suppression is applied to this list of points using the given non_max_suppression_radius. The final list of peaks is then returned.

    Therefore, the returned list, V, will have these properties:
    • len(V) == the number of peaks found in the image.
    • When measured in image coordinates, no elements of V are within non_max_suppression_radius distance of each other. That is, for all valid i!=j it is true that length(V[i]-V[j]) > non_max_suppression_radius.
    • For each element of V, that element has the maximum pixel value of all pixels in the ball centered on that pixel with radius non_max_suppression_radius.
  1. find_peaks(img: numpy.ndarray[(rows,cols),float32], non_max_suppression_radius: float=0L) -> dlib.points
  2. find_peaks(img: numpy.ndarray[(rows,cols),float64], non_max_suppression_radius: float=0L) -> dlib.points
  3. find_peaks(img: numpy.ndarray[(rows,cols),uint8], non_max_suppression_radius: float=0L) -> dlib.points
  4. find_peaks(img: numpy.ndarray[(rows,cols),uint16], non_max_suppression_radius: float=0L) -> dlib.points
  5. find_peaks(img: numpy.ndarray[(rows,cols),uint32], non_max_suppression_radius: float=0L) -> dlib.points
  6. find_peaks(img: numpy.ndarray[(rows,cols),uint64], non_max_suppression_radius: float=0L) -> dlib.points
  7. find_peaks(img: numpy.ndarray[(rows,cols),int8], non_max_suppression_radius: float=0L) -> dlib.points
  8. find_peaks(img: numpy.ndarray[(rows,cols),int16], non_max_suppression_radius: float=0L) -> dlib.points
  9. find_peaks(img: numpy.ndarray[(rows,cols),int32], non_max_suppression_radius: float=0L) -> dlib.points
  10. find_peaks(img: numpy.ndarray[(rows,cols),int64], non_max_suppression_radius: float=0L) -> dlib.points

performs: return find_peaks(img, non_max_suppression_radius, partition_pixels(img))

dlib.find_projective_transform(*args, **kwargs)

Overloaded function.

  1. find_projective_transform(from_points: dlib.dpoints, to_points: dlib.dpoints) -> dlib.point_transform_projective
requires
  • len(from_points) == len(to_points)
  • len(from_points) >= 4
ensures
  • returns a point_transform_projective object, T, such that for all valid i:

    length(T(from_points[i]) - to_points[i])

    is minimized as often as possible. That is, this function finds the projective transform that maps points in from_points to points in to_points. If no projective transform exists which performs this mapping exactly then the one which minimizes the mean squared error is selected.

  1. find_projective_transform(from_points: numpy.ndarray[(rows,cols),float32], to_points: numpy.ndarray[(rows,cols),float32]) -> dlib.point_transform_projective
requires
  • from_points and to_points have two columns and the same number of rows. Moreover, they have at least 4 rows.
ensures
  • returns a point_transform_projective object, T, such that for all valid i:

    length(T(dpoint(from_points[i])) - dpoint(to_points[i]))

    is minimized as often as possible. That is, this function finds the projective transform that maps points in from_points to points in to_points. If no projective transform exists which performs this mapping exactly then the one which minimizes the mean squared error is selected.

  1. find_projective_transform(from_points: numpy.ndarray[(rows,cols),float64], to_points: numpy.ndarray[(rows,cols),float64]) -> dlib.point_transform_projective
requires
  • from_points and to_points have two columns and the same number of rows. Moreover, they have at least 4 rows.
ensures
  • returns a point_transform_projective object, T, such that for all valid i:

    length(T(dpoint(from_points[i])) - dpoint(to_points[i]))

    is minimized as often as possible. That is, this function finds the projective transform that maps points in from_points to points in to_points. If no projective transform exists which performs this mapping exactly then the one which minimizes the mean squared error is selected.

class dlib.full_object_detection

This object represents the location of an object in an image along with the positions of each of its constituent parts.

__init__(self: dlib.full_object_detection, arg0: dlib.rectangle, arg1: list) → None
requires
  • rect: dlib rectangle
  • parts: list of dlib points
num_parts

The number of parts of the object.

part(self: dlib.full_object_detection, idx: int) → dlib.point

A single part of the object as a dlib point.

parts(self: dlib.full_object_detection) → dlib.points

A vector of dlib points representing all of the parts.

rect

Bounding box from the underlying detector. Parts can be outside box if appropriate.

class dlib.full_object_detections

An array of full_object_detection objects.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.full_object_detections) -> None
  2. __init__(self: dlib.full_object_detections, arg0: dlib.full_object_detections) -> None

Copy constructor

  1. __init__(self: dlib.full_object_detections, arg0: iterable) -> None
append(self: dlib.full_object_detections, x: dlib.full_object_detection) → None

Add an item to the end of the list

clear(self: dlib.full_object_detections) → None
count(self: dlib.full_object_detections, x: dlib.full_object_detection) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.full_object_detections, L: dlib.full_object_detections) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.full_object_detections, arg0: list) -> None
insert(self: dlib.full_object_detections, i: int, x: dlib.full_object_detection) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.full_object_detections) -> dlib.full_object_detection

Remove and return the last item

  1. pop(self: dlib.full_object_detections, i: int) -> dlib.full_object_detection

Remove and return the item at index i

remove(self: dlib.full_object_detections, x: dlib.full_object_detection) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.full_object_detections, arg0: int) → None
class dlib.function_evaluation

This object records the output of a real valued function in response to some input.

In particular, if you have a function F(x) then the function_evaluation is simply a struct that records x and the scalar value F(x).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.function_evaluation, x: dlib.vector, y: float) -> None
  2. __init__(self: dlib.function_evaluation, x: list, y: float) -> None
x
y
class dlib.function_evaluation_request

See: http://dlib.net/dlib/global_optimization/global_function_search_abstract.h.html

__init__

x.__init__(...) initializes x; see help(type(x)) for signature

function_idx
has_been_evaluated
set(self: dlib.function_evaluation_request, arg0: float) → None
x
class dlib.function_spec

See: http://dlib.net/dlib/global_optimization/global_function_search_abstract.h.html

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.function_spec, bound1: dlib.vector, bound2: dlib.vector) -> None
  2. __init__(self: dlib.function_spec, bound1: dlib.vector, bound2: dlib.vector, is_integer: List[bool]) -> None
  3. __init__(self: dlib.function_spec, bound1: list, bound2: list) -> None
  4. __init__(self: dlib.function_spec, bound1: list, bound2: list, is_integer: list) -> None
is_integer_variable
lower
upper
dlib.gaussian_blur(*args, **kwargs)

Overloaded function.

  1. gaussian_blur(img: numpy.ndarray[(rows,cols,3),uint8], sigma: float, max_size: int=1000L) -> tuple
  2. gaussian_blur(img: numpy.ndarray[(rows,cols),uint8], sigma: float, max_size: int=1000L) -> tuple
  3. gaussian_blur(img: numpy.ndarray[(rows,cols),uint16], sigma: float, max_size: int=1000L) -> tuple
  4. gaussian_blur(img: numpy.ndarray[(rows,cols),uint32], sigma: float, max_size: int=1000L) -> tuple
  5. gaussian_blur(img: numpy.ndarray[(rows,cols),float32], sigma: float, max_size: int=1000L) -> tuple
  6. gaussian_blur(img: numpy.ndarray[(rows,cols),float64], sigma: float, max_size: int=1000L) -> tuple
requires
  • sigma > 0
  • max_size > 0
  • max_size is an odd number
ensures
  • Filters img with a Gaussian filter of sigma width. The actual spatial filter will be applied to pixel blocks that are at most max_size wide and max_size tall (note that this function will automatically select a smaller block size as appropriate). The results are returned. We also return a rectangle which indicates what pixels in the returned image are considered non-border pixels and therefore contain output from the filter. E.g.

    • filtered_img,rect = gaussian_blur(img)

    would give you the filtered image and the rectangle in question.

  • The filter is applied to each color channel independently.

  • Pixels close enough to the edge of img to not have the filter still fit inside the image are set to zero.

  • The returned image has the same dimensions as the input image.

dlib.get_face_chip(img: numpy.ndarray[(rows,cols,3),uint8], face: dlib.full_object_detection, size: int=150L, padding: float=0.25) → numpy.ndarray[(rows,cols,3),uint8]

Takes an image and a full_object_detection that references a face in that image and returns the face as a Numpy array representing the image. The face will be rotated upright and scaled to 150x150 pixels or with the optional specified size and padding.

dlib.get_face_chips(img: numpy.ndarray[(rows,cols,3),uint8], faces: dlib.full_object_detections, size: int=150L, padding: float=0.25) → list

Takes an image and a full_object_detections object that reference faces in that image and returns the faces as a list of Numpy arrays representing the image. The faces will be rotated upright and scaled to 150x150 pixels or with the optional specified size and padding.

dlib.get_frontal_face_detector() → dlib::object_detector<dlib::scan_fhog_pyramid<dlib::pyramid_down<6u>, dlib::default_fhog_feature_extractor> >

Returns the default face detector

dlib.get_rect(img: array) → dlib.rectangle

returns a rectangle(0,0,img.shape(1)-1,img.shape(0)-1). Therefore, it is the rectangle that bounds the image.

See: http://dlib.net/dlib/global_optimization/global_function_search_abstract.h.html

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.global_function_search, function: dlib.function_spec) -> None
  2. __init__(self: dlib.global_function_search, functions: list) -> None
  3. __init__(self: dlib.global_function_search, functions: list, initial_function_evals: list, relative_noise_magnitude: float) -> None
get_best_function_eval(self: dlib.global_function_search) → tuple
get_function_evaluations(self: dlib.global_function_search) → tuple
get_monte_carlo_upper_bound_sample_num(self: dlib.global_function_search) → int
get_next_x(self: dlib.global_function_search) → dlib.function_evaluation_request
get_pure_random_search_probability(self: dlib.global_function_search) → float
get_relative_noise_magnitude(self: dlib.global_function_search) → float
get_solver_epsilon(self: dlib.global_function_search) → float
num_functions(self: dlib.global_function_search) → int
set_monte_carlo_upper_bound_sample_num(self: dlib.global_function_search, num: int) → None
set_pure_random_search_probability(self: dlib.global_function_search, prob: float) → None
set_relative_noise_magnitude(self: dlib.global_function_search, value: float) → None
set_seed(self: dlib.global_function_search, seed: int) → None
set_solver_epsilon(self: dlib.global_function_search, eps: float) → None
dlib.grow_rect(rect: dlib.rectangle, num: int) → dlib.rectangle
  • return shrink_rect(rect, -num) (i.e. grows the given rectangle by expanding its border by num)
dlib.hit_enter_to_continue() → None

Asks the user to hit enter to continue and pauses until they do so.

class dlib.hough_transform

This object is a tool for computing the line finding version of the Hough transform given some kind of edge detection image as input. It also allows the edge pixels to be weighted such that higher weighted edge pixels contribute correspondingly more to the output of the Hough transform, allowing stronger edges to create correspondingly stronger line detections in the final Hough transform.

__call__(*args, **kwargs)

Overloaded function.

  1. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint8], box: dlib.rectangle) -> numpy.ndarray[(rows,cols),float32]
  2. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint16], box: dlib.rectangle) -> numpy.ndarray[(rows,cols),float32]
  3. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint32], box: dlib.rectangle) -> numpy.ndarray[(rows,cols),float32]
  4. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint64], box: dlib.rectangle) -> numpy.ndarray[(rows,cols),float32]
  5. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int8], box: dlib.rectangle) -> numpy.ndarray[(rows,cols),float32]
  6. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int16], box: dlib.rectangle) -> numpy.ndarray[(rows,cols),float32]
  7. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int32], box: dlib.rectangle) -> numpy.ndarray[(rows,cols),float32]
  8. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int64], box: dlib.rectangle) -> numpy.ndarray[(rows,cols),float32]
  9. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),float32], box: dlib.rectangle) -> numpy.ndarray[(rows,cols),float32]
  10. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),float64], box: dlib.rectangle) -> numpy.ndarray[(rows,cols),float32]
requires
  • box.width() == size()
  • box.height() == size()
ensures
  • Computes the Hough transform of the part of img contained within box. In particular, we do a grayscale version of the Hough transform where any non-zero pixel in img is treated as a potential component of a line and accumulated into the returned Hough accumulator image. However, rather than adding 1 to each relevant accumulator bin we add the value of the pixel in img to each Hough accumulator bin. This means that, if all the pixels in img are 0 or 1 then this routine performs a normal Hough transform. However, if some pixels have larger values then they will be weighted correspondingly more in the resulting Hough transform.
  • The returned hough transform image will be size() rows by size() columns.
  • The returned image is the Hough transform of the part of img contained in box. Each point in the Hough image corresponds to a line in the input box. In particular, the line for hough_image[y][x] is given by get_line(point(x,y)). Also, when viewing the Hough image, the x-axis gives the angle of the line and the y-axis the distance of the line from the center of the box. The conversion between Hough coordinates and angle and pixel distance can be obtained by calling get_line_properties().
  1. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint8]) -> numpy.ndarray[(rows,cols),float32]

  2. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint16]) -> numpy.ndarray[(rows,cols),float32]

  3. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint32]) -> numpy.ndarray[(rows,cols),float32]

  4. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint64]) -> numpy.ndarray[(rows,cols),float32]

  5. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int8]) -> numpy.ndarray[(rows,cols),float32]

  6. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int16]) -> numpy.ndarray[(rows,cols),float32]

  7. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int32]) -> numpy.ndarray[(rows,cols),float32]

  8. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int64]) -> numpy.ndarray[(rows,cols),float32]

  9. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),float32]) -> numpy.ndarray[(rows,cols),float32]

  10. __call__(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),float64]) -> numpy.ndarray[(rows,cols),float32]

    simply performs: return self(img, get_rect(img)). That is, just runs the hough transform on the whole input image.

__init__(self: dlib.hough_transform, size_: int) → None
requires
ensures
  • This object will compute Hough transforms that are size_ by size_ pixels. This is in terms of both the Hough accumulator array size as well as the input image size.
  • size() == size_
find_pixels_voting_for_lines(*args, **kwargs)

Overloaded function.

  1. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint8], box: dlib.rectangle, hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list
  2. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint16], box: dlib.rectangle, hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list
  3. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint32], box: dlib.rectangle, hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list
  4. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint64], box: dlib.rectangle, hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list
  5. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int8], box: dlib.rectangle, hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list
  6. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int16], box: dlib.rectangle, hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list
  7. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int32], box: dlib.rectangle, hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list
  8. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int64], box: dlib.rectangle, hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list
  9. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),float32], box: dlib.rectangle, hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list
  10. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),float64], box: dlib.rectangle, hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list
requires
  • box.width() == size()

  • box.height() == size()

  • for all valid i:
    • rectangle(0,0,size()-1,size()-1).contains(hough_points[i]) == true (i.e. hough_points must contain points in the output Hough transform space generated by this object.)
  • angle_window_size >= 1

  • radius_window_size >= 1

ensures
  • This function computes the Hough transform of the part of img contained within box. It does the same computation as __call__() defined above, except instead of accumulating into an image we create an explicit list of all the points in img that contributed to each line (i.e each point in the Hough image). To do this we take a list of Hough points as input and only record hits on these specifically identified Hough points. A typical use of find_pixels_voting_for_lines() is to first run the normal Hough transform using __call__(), then find the lines you are interested in, and then call find_pixels_voting_for_lines() to determine which pixels in the input image belong to those lines.

  • This routine returns a vector, CONSTITUENT_POINTS, with the following properties:

    • CONSTITUENT_POINTS.size() == hough_points.size()

    • for all valid i:
      • Let HP[i] = centered_rect(hough_points[i], angle_window_size, radius_window_size)
      • Any point in img with a non-zero value that lies on a line corresponding to one of the Hough points in HP[i] is added to CONSTITUENT_POINTS[i]. Therefore, when this routine finishes, #CONSTITUENT_POINTS[i] will contain all the points in img that voted for the lines associated with the Hough accumulator bins in HP[i].
      • #CONSTITUENT_POINTS[i].size() == the number of points in img that voted for any of the lines HP[i] in Hough space. Note, however, that if angle_window_size or radius_window_size are made so large that HP[i] overlaps HP[j] for i!=j then the overlapping regions of Hough space are assign to HP[i] or HP[j] arbitrarily. Therefore, all points in CONSTITUENT_POINTS are unique, that is, there is no overlap in points between any two elements of CONSTITUENT_POINTS.
  1. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint8], hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list

  2. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint16], hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list

  3. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint32], hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list

  4. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),uint64], hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list

  5. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int8], hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list

  6. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int16], hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list

  7. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int32], hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list

  8. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),int64], hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list

  9. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),float32], hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list

  10. find_pixels_voting_for_lines(self: dlib.hough_transform, img: numpy.ndarray[(rows,cols),float64], hough_points: dlib.points, angle_window_size: int=1L, radius_window_size: int=1L) -> list

    performs: return find_pixels_voting_for_lines(img, get_rect(img), hough_points, angle_window_size, radius_window_size);

That is, just runs the routine on the whole input image.

find_strong_hough_points(self: dlib.hough_transform, himg: numpy.ndarray[(rows,cols),float32], hough_count_threshold: float, angle_nms_thresh: float, radius_nms_thresh: float) → dlib.points
requires
  • himg has size() rows and columns.
  • angle_nms_thresh >= 0
  • radius_nms_thresh >= 0
ensures
  • This routine finds strong lines in a Hough transform and performs non-maximum suppression on the detected lines. Recall that each point in Hough space is associated with a line. Therefore, this routine finds all the pixels in himg (a Hough transform image) with values >= hough_count_threshold and performs non-maximum suppression on the identified list of pixels. It does this by discarding lines that are within angle_nms_thresh degrees of a stronger line or within radius_nms_thresh distance (in terms of radius as defined by get_line_properties()) to a stronger Hough point.
  • The identified lines are returned as a list of coordinates in himg.
get_best_hough_point(self: dlib.hough_transform, p: dlib.point, himg: numpy.ndarray[(rows,cols),float32]) → dlib.point
requires
  • himg has size() rows and columns.
  • rectangle(0,0,size()-1,size()-1).contains(p) == true
ensures
  • This function interprets himg as a Hough image and p as a point in the original image space. Given this, it finds the maximum scoring line that passes though p. That is, it checks all the Hough accumulator bins in himg corresponding to lines though p and returns the location with the largest score.
  • returns a point X such that get_rect(himg).contains(X) == true
get_line(self: dlib.hough_transform, p: dlib.point) → dlib.line
requires
  • rectangle(0,0,size()-1,size()-1).contains(p) == true (i.e. p must be a point inside the Hough accumulator array)
ensures
  • returns the line segment in the original image space corresponding to Hough transform point p.
  • The returned points are inside rectangle(0,0,size()-1,size()-1).
get_line_angle_in_degrees(self: dlib.hough_transform, p: dlib.point) → float
requires
  • rectangle(0,0,size()-1,size()-1).contains(p) == true (i.e. p must be a point inside the Hough accumulator array)
ensures
  • returns the angle, in degrees, of the line corresponding to the Hough transform point p.
get_line_properties(self: dlib.hough_transform, p: dlib.point) → tuple
requires
  • rectangle(0,0,size()-1,size()-1).contains(p) == true (i.e. p must be a point inside the Hough accumulator array)
ensures
  • Converts a point in the Hough transform space into an angle, in degrees, and a radius, measured in pixels from the center of the input image.
  • let ANGLE_IN_DEGREES == the angle of the line corresponding to the Hough transform point p. Moreover: -90 <= ANGLE_IN_DEGREES < 90.
  • RADIUS == the distance from the center of the input image, measured in pixels, and the line corresponding to the Hough transform point p. Moreover: -sqrt(size()*size()/2) <= RADIUS <= sqrt(size()*size()/2)
  • returns a tuple of (ANGLE_IN_DEGREES, RADIUS)
size(self: dlib.hough_transform) → int

returns the size of the Hough transforms generated by this object. In particular, this object creates Hough transform images that are size() by size() pixels in size.

dlib.hysteresis_threshold(*args, **kwargs)

Overloaded function.

  1. hysteresis_threshold(img: numpy.ndarray[(rows,cols),uint8], lower_thresh: int, upper_thresh: int) -> numpy.ndarray[(rows,cols),uint8]
  2. hysteresis_threshold(img: numpy.ndarray[(rows,cols),uint16], lower_thresh: int, upper_thresh: int) -> numpy.ndarray[(rows,cols),uint16]
  3. hysteresis_threshold(img: numpy.ndarray[(rows,cols),uint32], lower_thresh: int, upper_thresh: int) -> numpy.ndarray[(rows,cols),uint32]
  4. hysteresis_threshold(img: numpy.ndarray[(rows,cols),uint64], lower_thresh: int, upper_thresh: int) -> numpy.ndarray[(rows,cols),uint64]
  5. hysteresis_threshold(img: numpy.ndarray[(rows,cols),int8], lower_thresh: int, upper_thresh: int) -> numpy.ndarray[(rows,cols),int8]
  6. hysteresis_threshold(img: numpy.ndarray[(rows,cols),int16], lower_thresh: int, upper_thresh: int) -> numpy.ndarray[(rows,cols),int16]
  7. hysteresis_threshold(img: numpy.ndarray[(rows,cols),int32], lower_thresh: int, upper_thresh: int) -> numpy.ndarray[(rows,cols),int32]
  8. hysteresis_threshold(img: numpy.ndarray[(rows,cols),int64], lower_thresh: int, upper_thresh: int) -> numpy.ndarray[(rows,cols),int64]
  9. hysteresis_threshold(img: numpy.ndarray[(rows,cols),float32], lower_thresh: float, upper_thresh: float) -> numpy.ndarray[(rows,cols),float32]
  10. hysteresis_threshold(img: numpy.ndarray[(rows,cols),float64], lower_thresh: float, upper_thresh: float) -> numpy.ndarray[(rows,cols),float64]

Applies hysteresis thresholding to img and returns the results. In particular, pixels in img with values >= upper_thresh have an output value of 255 and all others have a value of 0 unless they are >= lower_thresh and are connected to a pixel with a value >= upper_thresh, in which case they have a value of 255. Here pixels are connected if there is a path between them composed of pixels that would receive an output of 255.

  1. hysteresis_threshold(img: numpy.ndarray[(rows,cols),uint8]) -> numpy.ndarray[(rows,cols),uint8]
  2. hysteresis_threshold(img: numpy.ndarray[(rows,cols),uint16]) -> numpy.ndarray[(rows,cols),uint16]
  3. hysteresis_threshold(img: numpy.ndarray[(rows,cols),uint32]) -> numpy.ndarray[(rows,cols),uint32]
  4. hysteresis_threshold(img: numpy.ndarray[(rows,cols),uint64]) -> numpy.ndarray[(rows,cols),uint64]
  5. hysteresis_threshold(img: numpy.ndarray[(rows,cols),int8]) -> numpy.ndarray[(rows,cols),int8]
  6. hysteresis_threshold(img: numpy.ndarray[(rows,cols),int16]) -> numpy.ndarray[(rows,cols),int16]
  7. hysteresis_threshold(img: numpy.ndarray[(rows,cols),int32]) -> numpy.ndarray[(rows,cols),int32]
  8. hysteresis_threshold(img: numpy.ndarray[(rows,cols),int64]) -> numpy.ndarray[(rows,cols),int64]
  9. hysteresis_threshold(img: numpy.ndarray[(rows,cols),float32]) -> numpy.ndarray[(rows,cols),float32]
  10. hysteresis_threshold(img: numpy.ndarray[(rows,cols),float64]) -> numpy.ndarray[(rows,cols),float64]

performs: return hysteresis_threshold(img, t1, t2) where the thresholds are first obtained by calling [t1, t2]=partition_pixels(img).

class dlib.image_gradients

This class is a tool for computing first and second derivatives of an image. It does this by fitting a quadratic surface around each pixel and then computing the gradients of that quadratic surface. For the details see the paper:

Quadratic models for curved line detection in SAR CCD by Davis E. King and Rhonda D. Phillips

This technique gives very accurate gradient estimates and is also very fast since the entire gradient estimation procedure, for each type of gradient, is accomplished by cross-correlating the image with a single separable filter. This means you can compute gradients at very large scales (e.g. by fitting the quadratic to a large window, like a 99x99 window) and it still runs very quickly.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.image_gradients, scale: int) -> None

Creates this class with the provided scale. i.e. get_scale()==scale. scale must be >= 1.

  1. __init__(self: dlib.image_gradients) -> None

Creates this class with a scale of 1. i.e. get_scale()==1

get_scale(self: dlib.image_gradients) → int

When we estimate a gradient we do so by fitting a quadratic filter so a window of size get_scale()*2+1 centered on each pixel. Therefore, the scale parameter controls the size of gradients we will find. For example, a very large scale will cause the gradient_xx() to be insensitive to high frequency noise in the image while smaller scales would be more sensitive to such fluctuations in the image.

get_x_filter(self: dlib.image_gradients) → numpy.ndarray[(rows,cols),float32]
  • Returns the filter used by the indicated derivative to compute the image gradient. That is, the output gradients are found by cross correlating the returned filter with the input image.
  • The returned filter has get_scale()*2+1 rows and columns.
get_xx_filter(self: dlib.image_gradients) → numpy.ndarray[(rows,cols),float32]
  • Returns the filter used by the indicated derivative to compute the image gradient. That is, the output gradients are found by cross correlating the returned filter with the input image.
  • The returned filter has get_scale()*2+1 rows and columns.
get_xy_filter(self: dlib.image_gradients) → numpy.ndarray[(rows,cols),float32]
  • Returns the filter used by the indicated derivative to compute the image gradient. That is, the output gradients are found by cross correlating the returned filter with the input image.
  • The returned filter has get_scale()*2+1 rows and columns.
get_y_filter(self: dlib.image_gradients) → numpy.ndarray[(rows,cols),float32]
  • Returns the filter used by the indicated derivative to compute the image gradient. That is, the output gradients are found by cross correlating the returned filter with the input image.
  • The returned filter has get_scale()*2+1 rows and columns.
get_yy_filter(self: dlib.image_gradients) → numpy.ndarray[(rows,cols),float32]
  • Returns the filter used by the indicated derivative to compute the image gradient. That is, the output gradients are found by cross correlating the returned filter with the input image.
  • The returned filter has get_scale()*2+1 rows and columns.
gradient_x(*args, **kwargs)

Overloaded function.

  1. gradient_x(self: dlib.image_gradients, img: numpy.ndarray[(rows,cols),uint8]) -> tuple
  2. gradient_x(self: dlib.image_gradients, img: numpy.ndarray[(rows,cols),float32]) -> tuple
  • Let VALID_AREA = shrink_rect(get_rect(img),get_scale()).
  • This routine computes the requested gradient of img at each location in VALID_AREA. The gradients are returned in a new image of the same dimensions as img. All pixels outside VALID_AREA are set to 0. VALID_AREA is also returned. I.e. we return a tuple where the first element is the gradient image and the second is VALID_AREA.
gradient_xx(*args, **kwargs)

Overloaded function.

  1. gradient_xx(self: dlib.image_gradients, img: numpy.ndarray[(rows,cols),uint8]) -> tuple
  2. gradient_xx(self: dlib.image_gradients, img: numpy.ndarray[(rows,cols),float32]) -> tuple
  • Let VALID_AREA = shrink_rect(get_rect(img),get_scale()).
  • This routine computes the requested gradient of img at each location in VALID_AREA. The gradients are returned in a new image of the same dimensions as img. All pixels outside VALID_AREA are set to 0. VALID_AREA is also returned. I.e. we return a tuple where the first element is the gradient image and the second is VALID_AREA.
gradient_xy(*args, **kwargs)

Overloaded function.

  1. gradient_xy(self: dlib.image_gradients, img: numpy.ndarray[(rows,cols),uint8]) -> tuple
  2. gradient_xy(self: dlib.image_gradients, img: numpy.ndarray[(rows,cols),float32]) -> tuple
  • Let VALID_AREA = shrink_rect(get_rect(img),get_scale()).
  • This routine computes the requested gradient of img at each location in VALID_AREA. The gradients are returned in a new image of the same dimensions as img. All pixels outside VALID_AREA are set to 0. VALID_AREA is also returned. I.e. we return a tuple where the first element is the gradient image and the second is VALID_AREA.
gradient_y(*args, **kwargs)

Overloaded function.

  1. gradient_y(self: dlib.image_gradients, img: numpy.ndarray[(rows,cols),uint8]) -> tuple
  2. gradient_y(self: dlib.image_gradients, img: numpy.ndarray[(rows,cols),float32]) -> tuple
  • Let VALID_AREA = shrink_rect(get_rect(img),get_scale()).
  • This routine computes the requested gradient of img at each location in VALID_AREA. The gradients are returned in a new image of the same dimensions as img. All pixels outside VALID_AREA are set to 0. VALID_AREA is also returned. I.e. we return a tuple where the first element is the gradient image and the second is VALID_AREA.
gradient_yy(*args, **kwargs)

Overloaded function.

  1. gradient_yy(self: dlib.image_gradients, img: numpy.ndarray[(rows,cols),uint8]) -> tuple
  2. gradient_yy(self: dlib.image_gradients, img: numpy.ndarray[(rows,cols),float32]) -> tuple
  • Let VALID_AREA = shrink_rect(get_rect(img),get_scale()).
  • This routine computes the requested gradient of img at each location in VALID_AREA. The gradients are returned in a new image of the same dimensions as img. All pixels outside VALID_AREA are set to 0. VALID_AREA is also returned. I.e. we return a tuple where the first element is the gradient image and the second is VALID_AREA.
class dlib.image_window

This is a GUI window capable of showing images on the screen.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.image_window) -> None
  2. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),uint8]) -> None
  3. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),uint16]) -> None
  4. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),uint32]) -> None
  5. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),uint64]) -> None
  6. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),int8]) -> None
  7. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),int16]) -> None
  8. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),int32]) -> None
  9. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),int64]) -> None
  10. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),float32]) -> None
  11. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),float64]) -> None
  12. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols,3),uint8]) -> None

Create an image window that displays the given numpy image.

  1. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),uint8], arg1: unicode) -> None
  2. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),uint16], arg1: unicode) -> None
  3. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),uint32], arg1: unicode) -> None
  4. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),uint64], arg1: unicode) -> None
  5. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),int8], arg1: unicode) -> None
  6. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),int16], arg1: unicode) -> None
  7. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),int32], arg1: unicode) -> None
  8. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),int64], arg1: unicode) -> None
  9. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),float32], arg1: unicode) -> None
  10. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols),float64], arg1: unicode) -> None
  11. __init__(self: dlib.image_window, arg0: numpy.ndarray[(rows,cols,3),uint8], arg1: unicode) -> None

Create an image window that displays the given numpy image and also has the given title.

add_overlay(*args, **kwargs)

Overloaded function.

  1. add_overlay(self: dlib.image_window, rectangles: dlib.rectangles, color: dlib.rgb_pixel=rgb_pixel(255,0,0)) -> None

Add a list of rectangles to the image_window. They will be displayed as red boxes by default, but the color can be passed.

  1. add_overlay(self: dlib.image_window, rectangle: dlib.rectangle, color: dlib.rgb_pixel=rgb_pixel(255,0,0)) -> None

Add a rectangle to the image_window. It will be displayed as a red box by default, but the color can be passed.

  1. add_overlay(self: dlib.image_window, rectangle: dlib.drectangle, color: dlib.rgb_pixel=rgb_pixel(255,0,0)) -> None

Add a rectangle to the image_window. It will be displayed as a red box by default, but the color can be passed.

  1. add_overlay(self: dlib.image_window, detection: dlib.full_object_detection, color: dlib.rgb_pixel=rgb_pixel(0,0,255)) -> None

Add full_object_detection parts to the image window. They will be displayed as blue lines by default, but the color can be passed.

  1. add_overlay(self: dlib.image_window, line: dlib.line, color: dlib.rgb_pixel=rgb_pixel(255,0,0)) -> None

Add line to the image window.

add_overlay_circle(*args, **kwargs)

Overloaded function.

  1. add_overlay_circle(self: dlib.image_window, center: dlib.point, radius: float, color: dlib.rgb_pixel=rgb_pixel(255,0,0)) -> None

Add circle to the image window.

  1. add_overlay_circle(self: dlib.image_window, center: dlib.dpoint, radius: float, color: dlib.rgb_pixel=rgb_pixel(255,0,0)) -> None

Add circle to the image window.

clear_overlay(self: dlib.image_window) → None

Remove all overlays from the image_window.

set_image(*args, **kwargs)

Overloaded function.

  1. set_image(self: dlib.image_window, detector: dlib.simple_object_detector) -> None

Make the image_window display the given HOG detector’s filters.

  1. set_image(self: dlib.image_window, detector: dlib.fhog_object_detector) -> None

Make the image_window display the given HOG detector’s filters.

  1. set_image(self: dlib.image_window, image: numpy.ndarray[(rows,cols),uint8]) -> None
  2. set_image(self: dlib.image_window, image: numpy.ndarray[(rows,cols),uint16]) -> None
  3. set_image(self: dlib.image_window, image: numpy.ndarray[(rows,cols),uint32]) -> None
  4. set_image(self: dlib.image_window, image: numpy.ndarray[(rows,cols),uint64]) -> None
  5. set_image(self: dlib.image_window, image: numpy.ndarray[(rows,cols),int8]) -> None
  6. set_image(self: dlib.image_window, image: numpy.ndarray[(rows,cols),int16]) -> None
  7. set_image(self: dlib.image_window, image: numpy.ndarray[(rows,cols),int32]) -> None
  8. set_image(self: dlib.image_window, image: numpy.ndarray[(rows,cols),int64]) -> None
  9. set_image(self: dlib.image_window, image: numpy.ndarray[(rows,cols),float32]) -> None
  10. set_image(self: dlib.image_window, image: numpy.ndarray[(rows,cols),float64]) -> None
  11. set_image(self: dlib.image_window, image: numpy.ndarray[(rows,cols,3),uint8]) -> None

Make the image_window display the given image.

set_title(self: dlib.image_window, title: unicode) → None

Set the title of the window to the given value.

wait_until_closed(self: dlib.image_window) → None

This function blocks until the window is closed.

dlib.intersect(a: dlib.line, b: dlib.line) → dlib.dpoint
ensures
  • returns the point of intersection between lines a and b. If no such point exists then this function returns a point with Inf values in it.
dlib.inv(trans: dlib.point_transform_projective) → dlib.point_transform_projective
ensures
  • If trans is an invertible transformation then this function returns a new transformation that is the inverse of trans.
dlib.jet(*args, **kwargs)

Overloaded function.

  1. jet(img: numpy.ndarray[(rows,cols),uint8]) -> numpy.ndarray[(rows,cols,3),uint8]
  2. jet(img: numpy.ndarray[(rows,cols),uint16]) -> numpy.ndarray[(rows,cols,3),uint8]
  3. jet(img: numpy.ndarray[(rows,cols),uint32]) -> numpy.ndarray[(rows,cols,3),uint8]
  4. jet(img: numpy.ndarray[(rows,cols),float32]) -> numpy.ndarray[(rows,cols,3),uint8]
  5. jet(img: numpy.ndarray[(rows,cols),float64]) -> numpy.ndarray[(rows,cols,3),uint8]

Converts a grayscale image into a jet colored image. This is an image where dark pixels are dark blue and larger values become light blue, then yellow, and then finally red as they approach the maximum pixel values.

dlib.jitter_image(img: numpy.ndarray[(rows,cols,3),uint8], num_jitters: int=1L, disturb_colors: bool=False) → list

Takes an image and returns a list of jittered images.The returned list contains num_jitters images (default is 1).If disturb_colors is set to True, the colors of the image are disturbed (default is False)

dlib.label_connected_blobs(*args, **kwargs)

Overloaded function.

  1. label_connected_blobs(img: numpy.ndarray[(rows,cols),uint8], zero_pixels_are_background: bool=True, neighborhood_connectivity: int=8L, connected_if_both_not_zero: bool=False) -> tuple
  2. label_connected_blobs(img: numpy.ndarray[(rows,cols),uint16], zero_pixels_are_background: bool=True, neighborhood_connectivity: int=8L, connected_if_both_not_zero: bool=False) -> tuple
  3. label_connected_blobs(img: numpy.ndarray[(rows,cols),uint32], zero_pixels_are_background: bool=True, neighborhood_connectivity: int=8L, connected_if_both_not_zero: bool=False) -> tuple
requires
  • neighborhood_connectivity == 4, 8, or 24
ensures
  • This function labels each of the connected blobs in img with a unique integer label.

  • An image can be thought of as a graph where pixels A and B are connected if they are close to each other and satisfy some criterion like having the same value or both being non-zero. Then this function can be understood as labeling all the connected components of this pixel graph such that all pixels in a component get the same label while pixels in different components get different labels.

  • If zero_pixels_are_background==true then there is a special background component and all pixels with value 0 are assigned to it. Moreover, all such background pixels will always get a blob id of 0 regardless of any other considerations.

  • This function returns a label image and a count of the number of blobs found. I.e., if you ran this function like:

    label_img, num_blobs = label_connected_blobs(img)

    You would obtain the noted label image and number of blobs.

  • The output label_img has the same dimensions as the input image.

  • for all valid r and c:
    • label_img[r][c] == the blob label number for pixel img[r][c].

    • label_img[r][c] >= 0

    • if (img[r][c]==0) then
      • label_img[r][c] == 0
    • else
      • label_img[r][c] != 0
  • if (len(img) != 0) then
    • The returned num_blobs will be == label_img.max()+1 (i.e. returns a number one greater than the maximum blob id number, this is the number of blobs found.)
  • else
    • num_blobs will be 0.
  • blob labels are contiguous, therefore, the number returned by this function is the number of blobs in the image (including the background blob).

dlib.label_connected_blobs_watershed(*args, **kwargs)

Overloaded function.

  1. label_connected_blobs_watershed(img: numpy.ndarray[(rows,cols),uint8], background_thresh: int, smoothing: float=0L) -> tuple
  2. label_connected_blobs_watershed(img: numpy.ndarray[(rows,cols),uint16], background_thresh: int, smoothing: float=0L) -> tuple
  3. label_connected_blobs_watershed(img: numpy.ndarray[(rows,cols),uint32], background_thresh: int, smoothing: float=0L) -> tuple
  4. label_connected_blobs_watershed(img: numpy.ndarray[(rows,cols),float32], background_thresh: float, smoothing: float=0L) -> tuple
  5. label_connected_blobs_watershed(img: numpy.ndarray[(rows,cols),float64], background_thresh: float, smoothing: float=0L) -> tuple
requires
  • smoothing >= 0
ensures
  • This routine performs a watershed segmentation of the given input image and labels each resulting flooding region with a unique integer label. It does this by marking the brightest pixels as sources of flooding and then flood fills the image outward from those sources. Each flooded area is labeled with the identity of the source pixel and flooding stops when another flooded area is reached or pixels with values < background_thresh are encountered.

  • The flooding will also overrun a source pixel if that source pixel has yet to label any neighboring pixels. This behavior helps to mitigate spurious splits of objects due to noise. You can further control this behavior by setting the smoothing parameter. The flooding will take place on an image that has been Gaussian blurred with a sigma==smoothing. So setting smoothing to a larger number will in general cause more regions to be merged together. Note that the smoothing parameter has no effect on the interpretation of background_thresh since the decision of “background or not background” is always made relative to the unsmoothed input image.

  • This function returns a tuple of the labeled image and number of blobs found. i.e. you can call it like this:

    label_img, num_blobs = label_connected_blobs_watershed(img,background_thresh,smoothing)

  • The returned label_img will have the same dimensions as img.

  • for all valid r and c:
    • if (img[r][c] < background_thresh) then
      • label_img[r][c] == 0, (i.e. the pixel is labeled as background)
    • else
      • label_img[r][c] == an integer value indicating the identity of the segment containing the pixel img[r][c].
  • The returned num_blobs is the number of labeled segments, including the background segment. Therefore, the returned number is 1+(the max value in label_img).

  1. label_connected_blobs_watershed(img: numpy.ndarray[(rows,cols),uint8]) -> tuple
  2. label_connected_blobs_watershed(img: numpy.ndarray[(rows,cols),uint16]) -> tuple
  3. label_connected_blobs_watershed(img: numpy.ndarray[(rows,cols),uint32]) -> tuple
  4. label_connected_blobs_watershed(img: numpy.ndarray[(rows,cols),float32]) -> tuple
  5. label_connected_blobs_watershed(img: numpy.ndarray[(rows,cols),float64]) -> tuple
This version of label_connected_blobs_watershed simple invokes:
return label_connected_blobs_watershed(img, partition_pixels(img))
dlib.length(*args, **kwargs)

Overloaded function.

  1. length(p: dlib.point) -> float

returns the distance from p to the origin, i.e. the L2 norm of p.

  1. length(p: dlib.dpoint) -> float

returns the distance from p to the origin, i.e. the L2 norm of p.

class dlib.line

This object represents a line in the 2D plane. The line is defined by two points running through it, p1 and p2. This object also includes a unit normal vector that is perpendicular to the line.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.line) -> None

p1, p2, and normal are all the 0 vector.

  1. __init__(self: dlib.line, a: dlib.dpoint, b: dlib.dpoint) -> None
ensures
  • #p1 == a
  • #p2 == b
  • #normal == A vector normal to the line passing through points a and b. Therefore, the normal vector is the vector (a-b) but unit normalized and rotated clockwise 90 degrees.
  1. __init__(self: dlib.line, a: dlib.point, b: dlib.point) -> None
ensures
  • #p1 == a
  • #p2 == b
  • #normal == A vector normal to the line passing through points a and b. Therefore, the normal vector is the vector (a-b) but unit normalized and rotated clockwise 90 degrees.
normal

returns a unit vector that is normal to the line passing through p1 and p2.

p1

returns the first endpoint of the line.

p2

returns the second endpoint of the line.

dlib.load_grayscale_image(filename: unicode) → numpy.ndarray[(rows,cols),uint8]

Takes a path and returns a numpy array containing the image, as an 8bit grayscale image.

dlib.load_libsvm_formatted_data(file_name: unicode) → tuple
ensures
  • Attempts to read a file of the given name that should contain libsvm formatted data. The data is returned as a tuple where the first tuple element is an array of sparse vectors and the second element is an array of labels.
dlib.load_rgb_image(filename: unicode) → numpy.ndarray[(rows,cols,3),uint8]

Takes a path and returns a numpy array (RGB) containing the image

dlib.make_bounding_box_regression_training_data(truth: dlib.image_dataset_metadata.dataset, detections: object) → dlib.image_dataset_metadata.dataset
requires
  • len(truth.images) == len(detections)
  • detections == A dlib.rectangless object or a list of dlib.rectangles.
ensures
  • Suppose you have an object detector that can roughly locate objects in an image. This means your detector draws boxes around objects, but these are rough boxes in the sense that they aren’t positioned super accurately. For instance, HOG based detectors usually have a stride of 8 pixels. So the positional accuracy is going to be, at best, +/-8 pixels.

    If you want to get better positional accuracy one easy thing to do is train a shape_predictor to give you the corners of the object. The make_bounding_box_regression_training_data() routine helps you do this by creating an appropriate training dataset. It does this by taking the dataset you used to train your detector (the truth object), and combining that with the output of your detector on each image in the training dataset (the detections object). In particular, it will create a new annotated dataset where each object box is one of the rectangles from detections and that object has 4 part annotations, the corners of the truth rectangle corresponding to that detection rectangle. You can then take the returned dataset and train a shape_predictor on it. The resulting shape_predictor can then be used to do bounding box regression.

  • We assume that detections[i] contains object detections corresponding to the image truth.images[i].

dlib.make_sparse_vector(*args, **kwargs)

Overloaded function.

  1. make_sparse_vector(arg0: dlib.sparse_vector) -> None

This function modifies its argument so that it is a properly sorted sparse vector. This means that the elements of the sparse vector will be ordered so that pairs with smaller indices come first. Additionally, there won’t be any pairs with identical indices. If such pairs were present in the input sparse vector then their values will be added together and only one pair with their index will be present in the output.

  1. make_sparse_vector(arg0: dlib.sparse_vectors) -> None

This function modifies a sparse_vectors object so that all elements it contains are properly sorted sparse vectors.

class dlib.matrix

This object represents a dense 2D matrix of floating point numbers.Moreover, it binds directly to the C++ type dlib::matrix<double>.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.matrix) -> None
  2. __init__(self: dlib.matrix, arg0: list) -> None
  3. __init__(self: dlib.matrix, arg0: object) -> None
  4. __init__(self: dlib.matrix, arg0: int, arg1: int) -> None
nc(self: dlib.matrix) → int

Return the number of columns in the matrix.

nr(self: dlib.matrix) → int

Return the number of rows in the matrix.

set_size(self: dlib.matrix, rows: int, cols: int) → None

Set the size of the matrix to the given number of rows and columns.

shape
dlib.max_cost_assignment(cost: dlib.matrix) → list
requires
  • cost.nr() == cost.nc() (i.e. the input must be a square matrix)
ensures
  • Finds and returns the solution to the following optimization problem:

    Maximize: f(A) == assignment_cost(cost, A) Subject to the following constraints:

    • The elements of A are unique. That is, there aren’t any elements of A which are equal.
    • len(A) == cost.nr()
  • Note that this function converts the input cost matrix into a 64bit fixed point representation. Therefore, you should make sure that the values in your cost matrix can be accurately represented by 64bit fixed point values. If this is not the case then the solution my become inaccurate due to rounding error. In general, this function will work properly when the ratio of the largest to the smallest value in cost is no more than about 1e16.

dlib.max_index_plus_one(v: dlib.sparse_vector) → int
ensures
  • returns the dimensionality of the given sparse vector. That is, returns a number one larger than the maximum index value in the vector. If the vector is empty then returns 0.
dlib.min_barrier_distance(*args, **kwargs)

Overloaded function.

  1. min_barrier_distance(img: numpy.ndarray[(rows,cols),uint8], iterations: int=10L, do_left_right_scans: bool=True) -> numpy.ndarray[(rows,cols),uint8]
  2. min_barrier_distance(img: numpy.ndarray[(rows,cols),uint16], iterations: int=10L, do_left_right_scans: bool=True) -> numpy.ndarray[(rows,cols),uint16]
  3. min_barrier_distance(img: numpy.ndarray[(rows,cols),uint32], iterations: int=10L, do_left_right_scans: bool=True) -> numpy.ndarray[(rows,cols),uint32]
  4. min_barrier_distance(img: numpy.ndarray[(rows,cols),uint64], iterations: int=10L, do_left_right_scans: bool=True) -> numpy.ndarray[(rows,cols),uint64]
  5. min_barrier_distance(img: numpy.ndarray[(rows,cols),int8], iterations: int=10L, do_left_right_scans: bool=True) -> numpy.ndarray[(rows,cols),int8]
  6. min_barrier_distance(img: numpy.ndarray[(rows,cols),int16], iterations: int=10L, do_left_right_scans: bool=True) -> numpy.ndarray[(rows,cols),int16]
  7. min_barrier_distance(img: numpy.ndarray[(rows,cols),int32], iterations: int=10L, do_left_right_scans: bool=True) -> numpy.ndarray[(rows,cols),int32]
  8. min_barrier_distance(img: numpy.ndarray[(rows,cols),int64], iterations: int=10L, do_left_right_scans: bool=True) -> numpy.ndarray[(rows,cols),int64]
  9. min_barrier_distance(img: numpy.ndarray[(rows,cols),float32], iterations: int=10L, do_left_right_scans: bool=True) -> numpy.ndarray[(rows,cols),float32]
  10. min_barrier_distance(img: numpy.ndarray[(rows,cols),float64], iterations: int=10L, do_left_right_scans: bool=True) -> numpy.ndarray[(rows,cols),float64]
  11. min_barrier_distance(img: numpy.ndarray[(rows,cols,3),uint8], iterations: int=10L, do_left_right_scans: bool=True) -> numpy.ndarray[(rows,cols),uint8]
requires
  • iterations > 0
ensures
  • This function implements the salient object detection method described in the paper:

    “Minimum barrier salient object detection at 80 fps” by Zhang, Jianming, et al.

    In particular, we compute the minimum barrier distance between the borders of the image and all the other pixels. The resulting image is returned. Note that the paper talks about a bunch of other things you could do beyond computing the minimum barrier distance, but this function doesn’t do any of that. It’s just the vanilla MBD.

  • We will perform iterations iterations of MBD passes over the image. Larger values might give better results but run slower.

  • During each MBD iteration we make raster scans over the image. These pass from top->bottom, bottom->top, left->right, and right->left. If do_left_right_scans==false then the left/right passes are not executed. Skipping them makes the algorithm about 2x faster but might reduce the quality of the output.

class dlib.mmod_rectangle

Wrapper around a rectangle object and a detection confidence score.

__init__

x.__init__(...) initializes x; see help(type(x)) for signature

confidence
rect
class dlib.mmod_rectangles

An array of mmod rectangle objects.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.mmod_rectangles) -> None
  2. __init__(self: dlib.mmod_rectangles, arg0: dlib.mmod_rectangles) -> None

Copy constructor

  1. __init__(self: dlib.mmod_rectangles, arg0: iterable) -> None
append(self: dlib.mmod_rectangles, x: dlib.mmod_rectangle) → None

Add an item to the end of the list

count(self: dlib.mmod_rectangles, x: dlib.mmod_rectangle) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.mmod_rectangles, L: dlib.mmod_rectangles) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.mmod_rectangles, arg0: list) -> None
insert(self: dlib.mmod_rectangles, i: int, x: dlib.mmod_rectangle) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.mmod_rectangles) -> dlib.mmod_rectangle

Remove and return the last item

  1. pop(self: dlib.mmod_rectangles, i: int) -> dlib.mmod_rectangle

Remove and return the item at index i

remove(self: dlib.mmod_rectangles, x: dlib.mmod_rectangle) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

class dlib.mmod_rectangless

A 2D array of mmod rectangle objects.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.mmod_rectangless) -> None
  2. __init__(self: dlib.mmod_rectangless, arg0: dlib.mmod_rectangless) -> None

Copy constructor

  1. __init__(self: dlib.mmod_rectangless, arg0: iterable) -> None
append(self: dlib.mmod_rectangless, x: dlib.mmod_rectangles) → None

Add an item to the end of the list

count(self: dlib.mmod_rectangless, x: dlib.mmod_rectangles) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.mmod_rectangless, L: dlib.mmod_rectangless) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.mmod_rectangless, arg0: list) -> None
insert(self: dlib.mmod_rectangless, i: int, x: dlib.mmod_rectangles) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.mmod_rectangless) -> dlib.mmod_rectangles

Remove and return the last item

  1. pop(self: dlib.mmod_rectangless, i: int) -> dlib.mmod_rectangles

Remove and return the item at index i

remove(self: dlib.mmod_rectangless, x: dlib.mmod_rectangles) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

exception dlib.no_convex_quadrilateral
dlib.normalize_image_gradients(*args, **kwargs)

Overloaded function.

  1. normalize_image_gradients(img1: numpy.ndarray[(rows,cols),float64], img2: numpy.ndarray[(rows,cols),float64]) -> None
  2. normalize_image_gradients(img1: numpy.ndarray[(rows,cols),float32], img2: numpy.ndarray[(rows,cols),float32]) -> None
requires
  • img1 and img2 have the same dimensions.
ensures
  • This function assumes img1 and img2 are the two gradient images produced by a function like sobel_edge_detector(). It then unit normalizes the gradient vectors. That is, for all valid r and c, this function ensures that:

    • img1[r][c]*img1[r][c] + img2[r][c]*img2[r][c] == 1 unless both img1[r][c] and img2[r][c] were 0 initially, then they stay zero.
class dlib.pair

This object is used to represent the elements of a sparse_vector.

__init__(self: dlib.pair, arg0: int, arg1: float) → None
first

This field represents the index/dimension number.

second

This field contains the value in a vector at dimension specified by the first field.

dlib.partition_pixels(*args, **kwargs)

Overloaded function.

  1. partition_pixels(img: numpy.ndarray[(rows,cols,3),uint8]) -> int
  2. partition_pixels(img: numpy.ndarray[(rows,cols),uint8]) -> int
  3. partition_pixels(img: numpy.ndarray[(rows,cols),uint16]) -> int
  4. partition_pixels(img: numpy.ndarray[(rows,cols),uint32]) -> int
  5. partition_pixels(img: numpy.ndarray[(rows,cols),float32]) -> float
  6. partition_pixels(img: numpy.ndarray[(rows,cols),float64]) -> float

Finds a threshold value that would be reasonable to use with threshold_image(img, threshold). It does this by finding the threshold that partitions the pixels in img into two groups such that the sum of absolute deviations between each pixel and the mean of its group is minimized.

  1. partition_pixels(img: numpy.ndarray[(rows,cols,3),uint8], num_thresholds: int) -> tuple
  2. partition_pixels(img: numpy.ndarray[(rows,cols),uint8], num_thresholds: int) -> tuple
  3. partition_pixels(img: numpy.ndarray[(rows,cols),uint16], num_thresholds: int) -> tuple
  4. partition_pixels(img: numpy.ndarray[(rows,cols),uint32], num_thresholds: int) -> tuple
  5. partition_pixels(img: numpy.ndarray[(rows,cols),float32], num_thresholds: int) -> tuple
  6. partition_pixels(img: numpy.ndarray[(rows,cols),float64], num_thresholds: int) -> tuple

This version of partition_pixels() finds multiple partitions rather than just one partition. It does this by first partitioning the pixels just as the above partition_pixels(img) does. Then it forms a new image with only pixels >= that first partition value and recursively partitions this new image. However, the recursion is implemented in an efficient way which is faster than explicitly forming these images and calling partition_pixels(), but the output is the same as if you did. For example, suppose you called [t1,t2,t2] = partition_pixels(img,3). Then we would have:

  • t1 == partition_pixels(img)
  • t2 == partition_pixels(an image with only pixels with values >= t1 in it)
  • t3 == partition_pixels(an image with only pixels with values >= t2 in it)
class dlib.point

This object represents a single point of integer coordinates that maps directly to a dlib::point.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.point, x: int, y: int) -> None
  2. __init__(self: dlib.point, p: dlib::vector<double, 2l>) -> None
  3. __init__(self: dlib.point, v: numpy.ndarray[int64]) -> None
  4. __init__(self: dlib.point, v: numpy.ndarray[float32]) -> None
  5. __init__(self: dlib.point, v: numpy.ndarray[float64]) -> None
normalize(self: dlib.point) → dlib::vector<double, 2l>

Returns a unit normalized copy of this vector.

x

The x-coordinate of the point.

y

The y-coordinate of the point.

class dlib.point_transform_projective

This is an object that takes 2D points and applies a projective transformation to them.

__call__(self: dlib.point_transform_projective, p: dlib.dpoint) → dlib.dpoint
ensures
  • Applies the projective transformation defined by this object’s constructor to p and returns the result. To define this precisely:

    • let p_h == the point p in homogeneous coordinates. That is:
      • p_h.x == p.x
      • p_h.y == p.y
      • p_h.z == 1
    • let x == m*p_h

    • Then this function returns the value x/x.z

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.point_transform_projective) -> None
ensures
  • This object will perform the identity transform. That is, given a point as input it will return the same point as output. Therefore, self.m == a 3x3 identity matrix.
  1. __init__(self: dlib.point_transform_projective, m: numpy.ndarray[(rows,cols),float64]) -> None
ensures
  • self.m == m
m

m is the 3x3 matrix that defines the projective transformation.

class dlib.points

An array of point objects.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.points) -> None
  2. __init__(self: dlib.points, arg0: dlib.points) -> None

Copy constructor

  1. __init__(self: dlib.points, arg0: iterable) -> None
append(self: dlib.points, x: dlib.point) → None

Add an item to the end of the list

clear(self: dlib.points) → None
count(self: dlib.points, x: dlib.point) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.points, L: dlib.points) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.points, arg0: list) -> None
insert(self: dlib.points, i: int, x: dlib.point) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.points) -> dlib.point

Remove and return the last item

  1. pop(self: dlib.points, i: int) -> dlib.point

Remove and return the item at index i

remove(self: dlib.points, x: dlib.point) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.points, arg0: int) → None
dlib.probability_that_sequence_is_increasing(time_series: object) → float

returns the probability that the given sequence of real numbers is increasing in value over time.

class dlib.pyramid_down

This is a simple object to help create image pyramids. In particular, it downsamples images at a ratio of N to N-1.

Note that setting N to 1 means that this object functions like pyramid_disable (defined at the bottom of this file).

WARNING, when mapping rectangles from one layer of a pyramid to another you might end up with rectangles which extend slightly outside your images. This is because points on the border of an image at a higher pyramid layer might correspond to points outside images at lower layers. So just keep this in mind. Note also that it’s easy to deal with. Just say something like this:

rect = rect.intersect(get_rect(my_image)); # keep rect inside my_image
__call__(*args, **kwargs)

Overloaded function.

  1. __call__(self: dlib.pyramid_down, img: numpy.ndarray[(rows,cols),uint8]) -> numpy.ndarray[(rows,cols),uint8]
  2. __call__(self: dlib.pyramid_down, img: numpy.ndarray[(rows,cols),uint16]) -> numpy.ndarray[(rows,cols),uint16]
  3. __call__(self: dlib.pyramid_down, img: numpy.ndarray[(rows,cols),uint32]) -> numpy.ndarray[(rows,cols),uint32]
  4. __call__(self: dlib.pyramid_down, img: numpy.ndarray[(rows,cols),uint64]) -> numpy.ndarray[(rows,cols),uint64]
  5. __call__(self: dlib.pyramid_down, img: numpy.ndarray[(rows,cols),int8]) -> numpy.ndarray[(rows,cols),int8]
  6. __call__(self: dlib.pyramid_down, img: numpy.ndarray[(rows,cols),int16]) -> numpy.ndarray[(rows,cols),int16]
  7. __call__(self: dlib.pyramid_down, img: numpy.ndarray[(rows,cols),int32]) -> numpy.ndarray[(rows,cols),int32]
  8. __call__(self: dlib.pyramid_down, img: numpy.ndarray[(rows,cols),int64]) -> numpy.ndarray[(rows,cols),int64]
  9. __call__(self: dlib.pyramid_down, img: numpy.ndarray[(rows,cols),float32]) -> numpy.ndarray[(rows,cols),float32]
  10. __call__(self: dlib.pyramid_down, img: numpy.ndarray[(rows,cols),float64]) -> numpy.ndarray[(rows,cols),float64]
  11. __call__(self: dlib.pyramid_down, img: numpy.ndarray[(rows,cols,3),uint8]) -> numpy.ndarray[(rows,cols,3),uint8]
  • Downsamples img to make a new image that is roughly (pyramid_downsampling_rate()-1)/pyramid_downsampling_rate() times the size of the original image.
  • The location of a point P in original image will show up at point point_down(P) in the downsampled image.
  • Note that some points on the border of the original image might correspond to points outside the downsampled image.
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.pyramid_down, N: int) -> None

Creates this class with the provided downsampling rate. i.e. pyramid_downsampling_rate()==N. N must be in the range 1 to 20.

  1. __init__(self: dlib.pyramid_down) -> None

Creates this class with pyramid_downsampling_rate()==2

point_down(*args, **kwargs)

Overloaded function.

  1. point_down(self: dlib.pyramid_down, p: dlib.point) -> dlib.dpoint
  2. point_down(self: dlib.pyramid_down, p: dlib.dpoint) -> dlib.dpoint

Maps from pixels in a source image to the corresponding pixels in the downsampled image.

  1. point_down(self: dlib.pyramid_down, p: dlib.point, levels: int) -> dlib.dpoint
  2. point_down(self: dlib.pyramid_down, p: dlib.dpoint, levels: int) -> dlib.dpoint

Applies point_down() to p levels times and returns the result.

point_up(*args, **kwargs)

Overloaded function.

  1. point_up(self: dlib.pyramid_down, p: dlib.point) -> dlib.dpoint
  2. point_up(self: dlib.pyramid_down, p: dlib.dpoint) -> dlib.dpoint

Maps from pixels in a downsampled image to pixels in the original image.

  1. point_up(self: dlib.pyramid_down, p: dlib.point, levels: int) -> dlib.dpoint
  2. point_up(self: dlib.pyramid_down, p: dlib.dpoint, levels: int) -> dlib.dpoint

Applies point_up() to p levels times and returns the result.

pyramid_downsampling_rate(self: dlib.pyramid_down) → int

Returns a number N that defines the downsampling rate. In particular, images are downsampled by a factor of N to N-1.

rect_down(*args, **kwargs)

Overloaded function.

  1. rect_down(self: dlib.pyramid_down, rect: dlib.rectangle) -> dlib.rectangle
  2. rect_down(self: dlib.pyramid_down, rect: dlib.drectangle) -> dlib.drectangle
returns drectangle(point_down(rect.tl_corner()), point_down(rect.br_corner()));
(i.e. maps rect into a downsampled)
  1. rect_down(self: dlib.pyramid_down, rect: dlib.rectangle, levels: int) -> dlib.rectangle
  2. rect_down(self: dlib.pyramid_down, rect: dlib.drectangle, levels: int) -> dlib.drectangle

Applies rect_down() to rect levels times and returns the result.

rect_up(*args, **kwargs)

Overloaded function.

  1. rect_up(self: dlib.pyramid_down, rect: dlib.rectangle) -> dlib.rectangle
  2. rect_up(self: dlib.pyramid_down, rect: dlib.drectangle) -> dlib.drectangle
returns drectangle(point_up(rect.tl_corner()), point_up(rect.br_corner()));
(i.e. maps rect into a parent image)
  1. rect_up(self: dlib.pyramid_down, rect: dlib.rectangle, levels: int) -> dlib.rectangle
  2. rect_up(self: dlib.pyramid_down, p: dlib.drectangle, levels: int) -> dlib.drectangle

Applies rect_up() to rect levels times and returns the result.

dlib.randomly_color_image(*args, **kwargs)

Overloaded function.

  1. randomly_color_image(img: numpy.ndarray[(rows,cols),uint8]) -> numpy.ndarray[(rows,cols,3),uint8]
  2. randomly_color_image(img: numpy.ndarray[(rows,cols),uint16]) -> numpy.ndarray[(rows,cols,3),uint8]
  3. randomly_color_image(img: numpy.ndarray[(rows,cols),uint32]) -> numpy.ndarray[(rows,cols,3),uint8]
  • randomly generates a mapping from gray level pixel values to the RGB pixel space and then uses this mapping to create a colored version of img. Returns an image which represents this colored version of img.
  • black pixels in img will remain black in the output image.
class dlib.range

This object is used to represent a range of elements in an array.

__init__(self: dlib.range, arg0: int, arg1: int) → None
begin

The index of the first element in the range. This is represented using an unsigned integer.

end

One past the index of the last element in the range. This is represented using an unsigned integer.

class dlib.ranges

This object is an array of range objects.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.ranges) -> None
  2. __init__(self: dlib.ranges, arg0: dlib.ranges) -> None

Copy constructor

  1. __init__(self: dlib.ranges, arg0: iterable) -> None
append(self: dlib.ranges, x: dlib.range) → None

Add an item to the end of the list

clear(self: dlib.ranges) → None
count(self: dlib.ranges, x: dlib.range) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.ranges, L: dlib.ranges) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.ranges, arg0: list) -> None
insert(self: dlib.ranges, i: int, x: dlib.range) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.ranges) -> dlib.range

Remove and return the last item

  1. pop(self: dlib.ranges, i: int) -> dlib.range

Remove and return the item at index i

remove(self: dlib.ranges, x: dlib.range) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.ranges, arg0: int) → None
class dlib.rangess

This object is an array of arrays of range objects.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.rangess) -> None
  2. __init__(self: dlib.rangess, arg0: dlib.rangess) -> None

Copy constructor

  1. __init__(self: dlib.rangess, arg0: iterable) -> None
append(self: dlib.rangess, x: dlib.ranges) → None

Add an item to the end of the list

clear(self: dlib.rangess) → None
count(self: dlib.rangess, x: dlib.ranges) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.rangess, L: dlib.rangess) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.rangess, arg0: list) -> None
insert(self: dlib.rangess, i: int, x: dlib.ranges) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.rangess) -> dlib.ranges

Remove and return the last item

  1. pop(self: dlib.rangess, i: int) -> dlib.ranges

Remove and return the item at index i

remove(self: dlib.rangess, x: dlib.ranges) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.rangess, arg0: int) → None
class dlib.ranking_pair
__init__(self: dlib.ranking_pair) → None
nonrelevant
relevant
class dlib.ranking_pairs
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.ranking_pairs) -> None
  2. __init__(self: dlib.ranking_pairs, arg0: dlib.ranking_pairs) -> None

Copy constructor

  1. __init__(self: dlib.ranking_pairs, arg0: iterable) -> None
append(self: dlib.ranking_pairs, x: dlib.ranking_pair) → None

Add an item to the end of the list

clear(self: dlib.ranking_pairs) → None
count(self: dlib.ranking_pairs, x: dlib.ranking_pair) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.ranking_pairs, L: dlib.ranking_pairs) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.ranking_pairs, arg0: list) -> None
insert(self: dlib.ranking_pairs, i: int, x: dlib.ranking_pair) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.ranking_pairs) -> dlib.ranking_pair

Remove and return the last item

  1. pop(self: dlib.ranking_pairs, i: int) -> dlib.ranking_pair

Remove and return the item at index i

remove(self: dlib.ranking_pairs, x: dlib.ranking_pair) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.ranking_pairs, arg0: int) → None
class dlib.rect_filter

This object is a simple tool for filtering a rectangle that measures the location of a moving object that has some non-trivial momentum. Importantly, the measurements are noisy and the object can experience sudden unpredictable accelerations. To accomplish this filtering we use a simple Kalman filter with a state transition model of:

position_{i+1} = position_{i} + velocity_{i} velocity_{i+1} = velocity_{i} + some_unpredictable_acceleration

and a measurement model of:

measured_position_{i} = position_{i} + measurement_noise

Where some_unpredictable_acceleration and measurement_noise are 0 mean Gaussian noise sources with standard deviations of typical_acceleration and measurement_noise respectively.

To allow for really sudden and large but infrequent accelerations, at each step we check if the current measured position deviates from the predicted filtered position by more than max_measurement_deviation*measurement_noise and if so we adjust the filter’s state to keep it within these bounds. This allows the moving object to undergo large unmodeled accelerations, far in excess of what would be suggested by typical_acceleration, without then experiencing a long lag time where the Kalman filter has to “catches up” to the new position.

__call__(self: dlib.rect_filter, rect: dlib.rectangle) → dlib.rectangle
__init__(self: dlib.rect_filter, measurement_noise: float, typical_acceleration: float, max_measurement_deviation: float) → None
max_measurement_deviation(self: dlib.rect_filter) → float
measurement_noise(self: dlib.rect_filter) → float
typical_acceleration(self: dlib.rect_filter) → float
class dlib.rectangle

This object represents a rectangular area of an image.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.rectangle, left: int, top: int, right: int, bottom: int) -> None
  2. __init__(self: dlib.rectangle, rect: dlib::drectangle) -> None
  3. __init__(self: dlib.rectangle, rect: dlib.rectangle) -> None
  4. __init__(self: dlib.rectangle) -> None
area(self: dlib.rectangle) → int
bl_corner(self: dlib.rectangle) → dlib.point

Returns the bottom left corner of the rectangle.

bottom(self: dlib.rectangle) → int
br_corner(self: dlib.rectangle) → dlib.point

Returns the bottom right corner of the rectangle.

center(self: dlib.rectangle) → dlib.point
contains(*args, **kwargs)

Overloaded function.

  1. contains(self: dlib.rectangle, point: dlib.point) -> bool
  2. contains(self: dlib.rectangle, x: int, y: int) -> bool
  3. contains(self: dlib.rectangle, rectangle: dlib.rectangle) -> bool
dcenter(self: dlib.rectangle) → dlib.point
height(self: dlib.rectangle) → int
intersect(self: dlib.rectangle, rectangle: dlib.rectangle) → dlib.rectangle
is_empty(self: dlib.rectangle) → bool
left(self: dlib.rectangle) → int
right(self: dlib.rectangle) → int
tl_corner(self: dlib.rectangle) → dlib.point

Returns the top left corner of the rectangle.

top(self: dlib.rectangle) → int
tr_corner(self: dlib.rectangle) → dlib.point

Returns the top right corner of the rectangle.

width(self: dlib.rectangle) → int
class dlib.rectangles

An array of rectangle objects.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.rectangles) -> None
  2. __init__(self: dlib.rectangles, arg0: dlib.rectangles) -> None

Copy constructor

  1. __init__(self: dlib.rectangles, arg0: iterable) -> None
append(self: dlib.rectangles, x: dlib.rectangle) → None

Add an item to the end of the list

clear(self: dlib.rectangles) → None
count(self: dlib.rectangles, x: dlib.rectangle) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.rectangles, L: dlib.rectangles) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.rectangles, arg0: list) -> None
insert(self: dlib.rectangles, i: int, x: dlib.rectangle) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.rectangles) -> dlib.rectangle

Remove and return the last item

  1. pop(self: dlib.rectangles, i: int) -> dlib.rectangle

Remove and return the item at index i

remove(self: dlib.rectangles, x: dlib.rectangle) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.rectangles, arg0: int) → None
class dlib.rectangless

An array of arrays of rectangle objects.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.rectangless) -> None
  2. __init__(self: dlib.rectangless, arg0: dlib.rectangless) -> None

Copy constructor

  1. __init__(self: dlib.rectangless, arg0: iterable) -> None
append(self: dlib.rectangless, x: dlib.rectangles) → None

Add an item to the end of the list

clear(self: dlib.rectangless) → None
count(self: dlib.rectangless, x: dlib.rectangles) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.rectangless, L: dlib.rectangless) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.rectangles, arg0: list) -> None
insert(self: dlib.rectangless, i: int, x: dlib.rectangles) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.rectangless) -> dlib.rectangles

Remove and return the last item

  1. pop(self: dlib.rectangless, i: int) -> dlib.rectangles

Remove and return the item at index i

remove(self: dlib.rectangless, x: dlib.rectangles) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.rectangless, arg0: int) → None
dlib.remove_incoherent_edge_pixels(line: dlib.points, horz_gradient: numpy.ndarray[(rows,cols),float32], vert_gradient: numpy.ndarray[(rows,cols),float32], angle_thresh: float) → dlib.points
requires
  • horz_gradient and vert_gradient have the same dimensions.

  • horz_gradient and vert_gradient represent unit normalized vectors. That is, you should have called normalize_image_gradients(horz_gradient,vert_gradient) or otherwise caused all the gradients to have unit norm.

  • for all valid i:

    get_rect(horz_gradient).contains(line[i])

ensures
  • This routine looks at all the points in the given line and discards the ones that have outlying gradient directions. To be specific, this routine returns a set of points PTS such that:

    • for all valid i,j:
      • The difference in angle between the gradients for PTS[i] and PTS[j] is less than angle_threshold degrees.
    • len(PTS) <= len(line)

    • PTS is just line with some elements removed.

dlib.resize_image(*args, **kwargs)

Overloaded function.

  1. resize_image(img: numpy.ndarray[(rows,cols),uint8], rows: int, cols: int) -> numpy.ndarray[(rows,cols),uint8]
  2. resize_image(img: numpy.ndarray[(rows,cols),uint16], rows: int, cols: int) -> numpy.ndarray[(rows,cols),uint16]
  3. resize_image(img: numpy.ndarray[(rows,cols),uint32], rows: int, cols: int) -> numpy.ndarray[(rows,cols),uint32]
  4. resize_image(img: numpy.ndarray[(rows,cols),uint64], rows: int, cols: int) -> numpy.ndarray[(rows,cols),uint64]
  5. resize_image(img: numpy.ndarray[(rows,cols),int8], rows: int, cols: int) -> numpy.ndarray[(rows,cols),int8]
  6. resize_image(img: numpy.ndarray[(rows,cols),int16], rows: int, cols: int) -> numpy.ndarray[(rows,cols),int16]
  7. resize_image(img: numpy.ndarray[(rows,cols),int32], rows: int, cols: int) -> numpy.ndarray[(rows,cols),int32]
  8. resize_image(img: numpy.ndarray[(rows,cols),int64], rows: int, cols: int) -> numpy.ndarray[(rows,cols),int64]
  9. resize_image(img: numpy.ndarray[(rows,cols),float32], rows: int, cols: int) -> numpy.ndarray[(rows,cols),float32]
  10. resize_image(img: numpy.ndarray[(rows,cols),float64], rows: int, cols: int) -> numpy.ndarray[(rows,cols),float64]

Resizes img, using bilinear interpolation, to have the indicated number of rows and columns.

  1. resize_image(img: numpy.ndarray[(rows,cols,3),uint8], rows: int, cols: int) -> numpy.ndarray[(rows,cols,3),uint8]

Resizes img, using bilinear interpolation, to have the indicated number of rows and columns.

dlib.reverse(l: dlib.line) → dlib.line
ensures
  • returns line(l.p2, l.p1) (i.e. returns a line object that represents the same line as l but with the endpoints, and therefore, the normal vector flipped. This means that the signed distance of operator() is also flipped).
class dlib.rgb_pixel
__init__(self: dlib.rgb_pixel, red: int, green: int, blue: int) → None
blue
green
red
class dlib.rvm_trainer_histogram_intersection
__init__(self: dlib.rvm_trainer_histogram_intersection) → None
epsilon
train(self: dlib.rvm_trainer_histogram_intersection, arg0: dlib.vectors, arg1: dlib.array) → dlib._decision_function_histogram_intersection
class dlib.rvm_trainer_linear
__init__(self: dlib.rvm_trainer_linear) → None
epsilon
train(self: dlib.rvm_trainer_linear, arg0: dlib.vectors, arg1: dlib.array) → dlib._decision_function_linear
class dlib.rvm_trainer_radial_basis
__init__(self: dlib.rvm_trainer_radial_basis) → None
epsilon
gamma
train(self: dlib.rvm_trainer_radial_basis, arg0: dlib.vectors, arg1: dlib.array) → dlib._decision_function_radial_basis
class dlib.rvm_trainer_sparse_histogram_intersection
__init__(self: dlib.rvm_trainer_sparse_histogram_intersection) → None
epsilon
train(self: dlib.rvm_trainer_sparse_histogram_intersection, arg0: dlib.sparse_vectors, arg1: dlib.array) → dlib._decision_function_sparse_histogram_intersection
class dlib.rvm_trainer_sparse_linear
__init__(self: dlib.rvm_trainer_sparse_linear) → None
epsilon
train(self: dlib.rvm_trainer_sparse_linear, arg0: dlib.sparse_vectors, arg1: dlib.array) → dlib._decision_function_sparse_linear
class dlib.rvm_trainer_sparse_radial_basis
__init__(self: dlib.rvm_trainer_sparse_radial_basis) → None
epsilon
gamma
train(self: dlib.rvm_trainer_sparse_radial_basis, arg0: dlib.sparse_vectors, arg1: dlib.array) → dlib._decision_function_sparse_radial_basis
dlib.save_face_chip(img: numpy.ndarray[(rows,cols,3),uint8], face: dlib.full_object_detection, chip_filename: unicode, size: int=150L, padding: float=0.25) → None

Takes an image and a full_object_detection that references a face in that image and saves the face with the specified file name prefix. The face will be rotated upright and scaled to 150x150 pixels or with the optional specified size and padding.

dlib.save_face_chips(img: numpy.ndarray[(rows,cols,3),uint8], faces: std::vector<dlib::full_object_detection, std::allocator<dlib::full_object_detection> >, chip_filename: unicode, size: int=150L, padding: float=0.25) → None

Takes an image and a full_object_detections object that reference faces in that image and saves the faces with the specified file name prefix. The faces will be rotated upright and scaled to 150x150 pixels or with the optional specified size and padding.

dlib.save_image(*args, **kwargs)

Overloaded function.

  1. save_image(img: numpy.ndarray[(rows,cols,3),uint8], filename: unicode) -> None

Saves the given image to the specified path. Determines the file type from the file extension specified in the path

  1. save_image(img: numpy.ndarray[(rows,cols),uint8], filename: unicode) -> None

Saves the given image to the specified path. Determines the file type from the file extension specified in the path

dlib.save_libsvm_formatted_data(file_name: unicode, samples: dlib.sparse_vectors, labels: dlib.array) → None
requires
  • len(samples) == len(labels)
ensures
  • saves the data to the given file in libsvm format
class dlib.segmenter_params

This class is used to define all the optional parameters to the train_sequence_segmenter() and cross_validate_sequence_segmenter() routines.

C

SVM C parameter

__init__(self: dlib.segmenter_params) → None
allow_negative_weights
be_verbose
epsilon
max_cache_size
num_threads
use_BIO_model
use_high_order_features
window_size
class dlib.segmenter_test

This object is the output of the dlib.test_sequence_segmenter() and dlib.cross_validate_sequence_segmenter() routines.

__init__

x.__init__(...) initializes x; see help(type(x)) for signature

f1
precision
recall
class dlib.segmenter_type

This object represents a sequence segmenter and is the type of object returned by the dlib.train_sequence_segmenter() routine.

__call__(*args, **kwargs)

Overloaded function.

  1. __call__(self: dlib.segmenter_type, arg0: dlib.vectors) -> dlib.ranges
  2. __call__(self: dlib.segmenter_type, arg0: dlib.sparse_vectors) -> dlib.ranges
__init__

x.__init__(...) initializes x; see help(type(x)) for signature

weights
dlib.set_dnn_prefer_smallest_algorithms() → None

Tells cuDNN to use slower algorithms that use less RAM.

class dlib.shape_predictor

This object is a tool that takes in an image region containing some object and outputs a set of point locations that define the pose of the object. The classic example of this is human face pose prediction, where you take an image of a human face as input and are expected to identify the locations of important facial landmarks such as the corners of the mouth and eyes, tip of the nose, and so forth.

__call__(self: dlib.shape_predictor, image: array, box: dlib.rectangle) → dlib.full_object_detection
requires
  • image is a numpy ndarray containing either an 8bit grayscale or RGB image.
  • box is the bounding box to begin the shape prediction inside.
ensures
  • This function runs the shape predictor on the input image and returns a single full_object_detection.
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.shape_predictor) -> None
  2. __init__(self: dlib.shape_predictor, arg0: unicode) -> None

Loads a shape_predictor from a file that contains the output of the train_shape_predictor() routine.

save(self: dlib.shape_predictor, predictor_output_filename: unicode) → None

Save a shape_predictor to the provided path.

class dlib.shape_predictor_training_options

This object is a container for the options to the train_shape_predictor() routine.

__init__(self: dlib.shape_predictor_training_options) → None
be_verbose

If true, train_shape_predictor() will print out a lot of information to stdout while training.

cascade_depth

The number of cascades created to train the model with.

feature_pool_region_padding

Size of region within which to sample features for the feature pool, e.g a padding of 0.5 would cause the algorithm to sample pixels from a box that was 2x2 pixels

feature_pool_size

Number of pixels used to generate features for the random trees.

lambda_param

Controls how tight the feature sampling should be. Lower values enforce closer features.

nu

The regularization parameter. Larger values of this parameter will cause the algorithm to fit the training data better but may also cause overfitting. The value must be in the range (0, 1].

num_test_splits

Number of split features at each node to sample. The one that gives the best split is chosen.

num_threads

Use this many threads/CPU cores for training.

num_trees_per_cascade_level

The number of trees created for each cascade.

oversampling_amount

The number of randomly selected initial starting points sampled for each training example

random_seed

The random seed used by the internal random number generator

tree_depth

The depth of the trees used in each cascade. There are pow(2, get_tree_depth()) leaves in each tree

dlib.shrink_rect(rect: dlib.rectangle, num: int) → dlib.rectangle
returns rectangle(rect.left()+num, rect.top()+num, rect.right()-num, rect.bottom()-num)
(i.e. shrinks the given rectangle by shrinking its border by num)
dlib.signed_distance_to_line(*args, **kwargs)

Overloaded function.

  1. signed_distance_to_line(l: dlib.line, p: dlib.point) -> float
  2. signed_distance_to_line(l: dlib.line, p: dlib.dpoint) -> float
ensures
  • returns how far p is from the line l. This is a signed distance. The sign indicates which side of the line the point is on and the magnitude is the distance. Moreover, the direction of positive sign is pointed to by the vector l.normal.
  • To be specific, this routine returns dot(p-l.p1, l.normal)
class dlib.simple_object_detector

This object represents a sliding window histogram-of-oriented-gradients based object detector.

__call__(*args, **kwargs)

Overloaded function.

  1. __call__(self: dlib.simple_object_detector, image: array, upsample_num_times: int) -> dlib.rectangles
requires
  • image is a numpy ndarray containing either an 8bit grayscale or RGB image.
  • upsample_num_times >= 0
ensures
  • This function runs the object detector on the input image and returns a list of detections.
  • Upsamples the image upsample_num_times before running the basic detector. If you don’t know how many times you want to upsample then don’t provide a value for upsample_num_times and an appropriate default will be used.
  1. __call__(self: dlib.simple_object_detector, image: array) -> dlib.rectangles
requires
  • image is a numpy ndarray containing either an 8bit grayscale or RGB image.
ensures
  • This function runs the object detector on the input image and returns a list of detections.
__init__(self: dlib.simple_object_detector, arg0: unicode) → None

Loads a simple_object_detector from a file that contains the output of the train_simple_object_detector() routine.

save(self: dlib.simple_object_detector, detector_output_filename: unicode) → None

Save a simple_object_detector to the provided path.

class dlib.simple_object_detector_training_options

This object is a container for the options to the train_simple_object_detector() routine.

C

C is the usual SVM C regularization parameter. So it is passed to structural_object_detection_trainer::set_c(). Larger values of C will encourage the trainer to fit the data better but might lead to overfitting. Therefore, you must determine the proper setting of this parameter experimentally.

__init__(self: dlib.simple_object_detector_training_options) → None
add_left_right_image_flips

if true, train_simple_object_detector() will assume the objects are left/right symmetric and add in left right flips of the training images. This doubles the size of the training dataset.

be_verbose

If true, train_simple_object_detector() will print out a lot of information to the screen while training.

detection_window_size

The sliding window used will have about this many pixels inside it.

epsilon

epsilon is the stopping epsilon. Smaller values make the trainer’s solver more accurate but might take longer to train.

num_threads

train_simple_object_detector() will use this many threads of execution. Set this to the number of CPU cores on your machine to obtain the fastest training speed.

upsample_limit

train_simple_object_detector() will upsample images if needed no more than upsample_limit times. Value 0 will forbid trainer to upsample any images. If trainer is unable to fit all boxes with required upsample_limit, exception will be thrown. Higher values of upsample_limit exponentially increases memory requiremens. Values higher than 2 (default) are not recommended.

class dlib.simple_test_results
__init__

x.__init__(...) initializes x; see help(type(x)) for signature

average_precision
precision
recall
dlib.skeleton(img: numpy.ndarray[(rows,cols),uint8]) → numpy.ndarray[(rows,cols),uint8]
requires
  • all pixels in img are set to either 255 or 0.
ensures
  • This function computes the skeletonization of img and stores the result in #img. That is, given a binary image, we progressively thin the binary blobs (composed of on_pixel values) until only a single pixel wide skeleton of the original blobs remains.
  • Doesn’t change the shape or size of img.
dlib.sobel_edge_detector(*args, **kwargs)

Overloaded function.

  1. sobel_edge_detector(img: numpy.ndarray[(rows,cols),uint8]) -> tuple
  2. sobel_edge_detector(img: numpy.ndarray[(rows,cols),uint16]) -> tuple
  3. sobel_edge_detector(img: numpy.ndarray[(rows,cols),uint32]) -> tuple
  4. sobel_edge_detector(img: numpy.ndarray[(rows,cols),uint64]) -> tuple
  5. sobel_edge_detector(img: numpy.ndarray[(rows,cols),int8]) -> tuple
  6. sobel_edge_detector(img: numpy.ndarray[(rows,cols),int16]) -> tuple
  7. sobel_edge_detector(img: numpy.ndarray[(rows,cols),int32]) -> tuple
  8. sobel_edge_detector(img: numpy.ndarray[(rows,cols),int64]) -> tuple
  9. sobel_edge_detector(img: numpy.ndarray[(rows,cols),float32]) -> tuple
  10. sobel_edge_detector(img: numpy.ndarray[(rows,cols),float64]) -> tuple

Applies the sobel edge detector to the given input image and returns two gradient images in a tuple. The first contains the x gradients and the second contains the y gradients of the image.

dlib.solve_structural_svm_problem(problem: object) → dlib.vector

This function solves a structural SVM problem and returns the weight vector that defines the solution. See the example program python_examples/svm_struct.py for documentation about how to create a proper problem object.

class dlib.sparse_ranking_pair
__init__(self: dlib.sparse_ranking_pair) → None
nonrelevant
relevant
class dlib.sparse_ranking_pairs
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.sparse_ranking_pairs) -> None
  2. __init__(self: dlib.sparse_ranking_pairs, arg0: dlib.sparse_ranking_pairs) -> None

Copy constructor

  1. __init__(self: dlib.sparse_ranking_pairs, arg0: iterable) -> None
append(self: dlib.sparse_ranking_pairs, x: dlib.sparse_ranking_pair) → None

Add an item to the end of the list

clear(self: dlib.sparse_ranking_pairs) → None
count(self: dlib.sparse_ranking_pairs, x: dlib.sparse_ranking_pair) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.sparse_ranking_pairs, L: dlib.sparse_ranking_pairs) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.sparse_ranking_pairs, arg0: list) -> None
insert(self: dlib.sparse_ranking_pairs, i: int, x: dlib.sparse_ranking_pair) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.sparse_ranking_pairs) -> dlib.sparse_ranking_pair

Remove and return the last item

  1. pop(self: dlib.sparse_ranking_pairs, i: int) -> dlib.sparse_ranking_pair

Remove and return the item at index i

remove(self: dlib.sparse_ranking_pairs, x: dlib.sparse_ranking_pair) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.sparse_ranking_pairs, arg0: int) → None
class dlib.sparse_vector

This object represents the mathematical idea of a sparse column vector. It is simply an array of dlib.pair objects, each representing an index/value pair in the vector. Any elements of the vector which are missing are implicitly set to zero.

Unless otherwise noted, any routines taking a sparse_vector assume the sparse vector is sorted and has unique elements. That is, the index values of the pairs in a sparse_vector should be listed in increasing order and there should not be duplicates. However, some functions work with “unsorted” sparse vectors. These are dlib.sparse_vector objects that have either duplicate entries or non-sorted index values. Note further that you can convert an “unsorted” sparse_vector into a properly sorted sparse vector by calling dlib.make_sparse_vector() on it.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.sparse_vector) -> None
  2. __init__(self: dlib.sparse_vector, arg0: dlib.sparse_vector) -> None

Copy constructor

  1. __init__(self: dlib.sparse_vector, arg0: iterable) -> None
append(self: dlib.sparse_vector, x: dlib.pair) → None

Add an item to the end of the list

clear(self: dlib.sparse_vector) → None
count(self: dlib.sparse_vector, x: dlib.pair) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.sparse_vector, L: dlib.sparse_vector) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.sparse_vector, arg0: list) -> None
insert(self: dlib.sparse_vector, i: int, x: dlib.pair) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.sparse_vector) -> dlib.pair

Remove and return the last item

  1. pop(self: dlib.sparse_vector, i: int) -> dlib.pair

Remove and return the item at index i

remove(self: dlib.sparse_vector, x: dlib.pair) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.sparse_vector, arg0: int) → None
class dlib.sparse_vectors

This object is an array of sparse_vector objects.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.sparse_vectors) -> None
  2. __init__(self: dlib.sparse_vectors, arg0: dlib.sparse_vectors) -> None

Copy constructor

  1. __init__(self: dlib.sparse_vectors, arg0: iterable) -> None
append(self: dlib.sparse_vectors, x: dlib.sparse_vector) → None

Add an item to the end of the list

clear(self: dlib.sparse_vectors) → None
count(self: dlib.sparse_vectors, x: dlib.sparse_vector) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.sparse_vectors, L: dlib.sparse_vectors) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.sparse_vectors, arg0: list) -> None
insert(self: dlib.sparse_vectors, i: int, x: dlib.sparse_vector) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.sparse_vectors) -> dlib.sparse_vector

Remove and return the last item

  1. pop(self: dlib.sparse_vectors, i: int) -> dlib.sparse_vector

Remove and return the item at index i

remove(self: dlib.sparse_vectors, x: dlib.sparse_vector) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.sparse_vectors, arg0: int) → None
class dlib.sparse_vectorss

This object is an array of arrays of sparse_vector objects.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.sparse_vectorss) -> None
  2. __init__(self: dlib.sparse_vectorss, arg0: dlib.sparse_vectorss) -> None

Copy constructor

  1. __init__(self: dlib.sparse_vectorss, arg0: iterable) -> None
append(self: dlib.sparse_vectorss, x: dlib.sparse_vectors) → None

Add an item to the end of the list

clear(self: dlib.sparse_vectorss) → None
count(self: dlib.sparse_vectorss, x: dlib.sparse_vectors) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.sparse_vectorss, L: dlib.sparse_vectorss) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.sparse_vectorss, arg0: list) -> None
insert(self: dlib.sparse_vectorss, i: int, x: dlib.sparse_vectors) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.sparse_vectorss) -> dlib.sparse_vectors

Remove and return the last item

  1. pop(self: dlib.sparse_vectorss, i: int) -> dlib.sparse_vectors

Remove and return the item at index i

remove(self: dlib.sparse_vectorss, x: dlib.sparse_vectors) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.sparse_vectorss, arg0: int) → None
dlib.suppress_non_maximum_edges(*args, **kwargs)

Overloaded function.

  1. suppress_non_maximum_edges(horz: numpy.ndarray[(rows,cols),float32], vert: numpy.ndarray[(rows,cols),float32]) -> numpy.ndarray[(rows,cols),float32]
requires
  • The two input images have the same dimensions.
ensures
  • Returns an image, of the same dimensions as the input. Each element in this image holds the edge strength at that location. Moreover, edge pixels that are not local maximizers have been set to 0.

  • let edge_strength(r,c) == sqrt(pow(horz[r][c],2) + pow(vert[r][c],2)) (i.e. The Euclidean norm of the gradient)

  • let OUT denote the returned image.

  • for all valid r and c:
    • if (edge_strength(r,c) is at a maximum with respect to its 2 neighboring pixels along the line indicated by the image gradient vector (horz[r][c],vert[r][c])) then

      • OUT[r][c] == edge_strength(r,c)
    • else
      • OUT[r][c] == 0
  1. suppress_non_maximum_edges(horz_and_vert_gradients: tuple) -> numpy.ndarray[(rows,cols),float32]

Performs: return suppress_non_maximum_edges(horz_and_vert_gradients[0], horz_and_vert_gradients[1])

class dlib.svm_c_trainer_histogram_intersection
__init__(self: dlib.svm_c_trainer_histogram_intersection) → None
c_class1
c_class2
cache_size
epsilon
set_c(self: dlib.svm_c_trainer_histogram_intersection, arg0: float) → None
train(self: dlib.svm_c_trainer_histogram_intersection, arg0: dlib.vectors, arg1: dlib.array) → dlib._decision_function_histogram_intersection
class dlib.svm_c_trainer_linear
__init__(self: dlib.svm_c_trainer_linear) → None
be_quiet(self: dlib.svm_c_trainer_linear) → None
be_verbose(self: dlib.svm_c_trainer_linear) → None
c_class1
c_class2
epsilon
force_last_weight_to_1
has_prior
learns_nonnegative_weights
max_iterations
set_c(self: dlib.svm_c_trainer_linear, arg0: float) → None
set_prior(self: dlib.svm_c_trainer_linear, arg0: dlib._decision_function_linear) → None
train(self: dlib.svm_c_trainer_linear, arg0: dlib.vectors, arg1: dlib.array) → dlib._decision_function_linear
class dlib.svm_c_trainer_radial_basis
__init__(self: dlib.svm_c_trainer_radial_basis) → None
c_class1
c_class2
cache_size
epsilon
gamma
set_c(self: dlib.svm_c_trainer_radial_basis, arg0: float) → None
train(self: dlib.svm_c_trainer_radial_basis, arg0: dlib.vectors, arg1: dlib.array) → dlib._decision_function_radial_basis
class dlib.svm_c_trainer_sparse_histogram_intersection
__init__(self: dlib.svm_c_trainer_sparse_histogram_intersection) → None
c_class1
c_class2
cache_size
epsilon
set_c(self: dlib.svm_c_trainer_sparse_histogram_intersection, arg0: float) → None
train(self: dlib.svm_c_trainer_sparse_histogram_intersection, arg0: dlib.sparse_vectors, arg1: dlib.array) → dlib._decision_function_sparse_histogram_intersection
class dlib.svm_c_trainer_sparse_linear
__init__(self: dlib.svm_c_trainer_sparse_linear) → None
be_quiet(self: dlib.svm_c_trainer_sparse_linear) → None
be_verbose(self: dlib.svm_c_trainer_sparse_linear) → None
c_class1
c_class2
epsilon
force_last_weight_to_1
has_prior
learns_nonnegative_weights
max_iterations
set_c(self: dlib.svm_c_trainer_sparse_linear, arg0: float) → None
set_prior(self: dlib.svm_c_trainer_sparse_linear, arg0: dlib._decision_function_sparse_linear) → None
train(self: dlib.svm_c_trainer_sparse_linear, arg0: dlib.sparse_vectors, arg1: dlib.array) → dlib._decision_function_sparse_linear
class dlib.svm_c_trainer_sparse_radial_basis
__init__(self: dlib.svm_c_trainer_sparse_radial_basis) → None
c_class1
c_class2
cache_size
epsilon
gamma
set_c(self: dlib.svm_c_trainer_sparse_radial_basis, arg0: float) → None
train(self: dlib.svm_c_trainer_sparse_radial_basis, arg0: dlib.sparse_vectors, arg1: dlib.array) → dlib._decision_function_sparse_radial_basis
class dlib.svm_rank_trainer
__init__(self: dlib.svm_rank_trainer) → None
be_quiet(self: dlib.svm_rank_trainer) → None
be_verbose(self: dlib.svm_rank_trainer) → None
c
epsilon
force_last_weight_to_1
has_prior
learns_nonnegative_weights
max_iterations
set_prior(self: dlib.svm_rank_trainer, arg0: dlib::decision_function<dlib::linear_kernel<dlib::matrix<double, 0l, 1l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout> > >) → None
train(*args, **kwargs)

Overloaded function.

  1. train(self: dlib.svm_rank_trainer, arg0: dlib.ranking_pair) -> dlib::decision_function<dlib::linear_kernel<dlib::matrix<double, 0l, 1l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout> > >
  2. train(self: dlib.svm_rank_trainer, arg0: dlib.ranking_pairs) -> dlib::decision_function<dlib::linear_kernel<dlib::matrix<double, 0l, 1l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout> > >
class dlib.svm_rank_trainer_sparse
__init__(self: dlib.svm_rank_trainer_sparse) → None
be_quiet(self: dlib.svm_rank_trainer_sparse) → None
be_verbose(self: dlib.svm_rank_trainer_sparse) → None
c
epsilon
force_last_weight_to_1
has_prior
learns_nonnegative_weights
max_iterations
set_prior(self: dlib.svm_rank_trainer_sparse, arg0: dlib::decision_function<dlib::sparse_linear_kernel<std::vector<std::pair<unsigned long, double>, std::allocator<std::pair<unsigned long, double> > > > >) → None
train(*args, **kwargs)

Overloaded function.

  1. train(self: dlib.svm_rank_trainer_sparse, arg0: dlib.sparse_ranking_pair) -> dlib::decision_function<dlib::sparse_linear_kernel<std::vector<std::pair<unsigned long, double>, std::allocator<std::pair<unsigned long, double> > > > >
  2. train(self: dlib.svm_rank_trainer_sparse, arg0: dlib.sparse_ranking_pairs) -> dlib::decision_function<dlib::sparse_linear_kernel<std::vector<std::pair<unsigned long, double>, std::allocator<std::pair<unsigned long, double> > > > >
dlib.test_binary_decision_function(*args, **kwargs)

Overloaded function.

  1. test_binary_decision_function(function: dlib._decision_function_linear, samples: dlib.vectors, labels: dlib.array) -> binary_test
  2. test_binary_decision_function(function: dlib._decision_function_sparse_linear, samples: dlib.sparse_vectors, labels: dlib.array) -> binary_test
  3. test_binary_decision_function(function: dlib._decision_function_radial_basis, samples: dlib.vectors, labels: dlib.array) -> binary_test
  4. test_binary_decision_function(function: dlib._decision_function_sparse_radial_basis, samples: dlib.sparse_vectors, labels: dlib.array) -> binary_test
  5. test_binary_decision_function(function: dlib._decision_function_polynomial, samples: dlib.vectors, labels: dlib.array) -> binary_test
  6. test_binary_decision_function(function: dlib._decision_function_sparse_polynomial, samples: dlib.sparse_vectors, labels: dlib.array) -> binary_test
  7. test_binary_decision_function(function: dlib._decision_function_histogram_intersection, samples: dlib.vectors, labels: dlib.array) -> binary_test
  8. test_binary_decision_function(function: dlib._decision_function_sparse_histogram_intersection, samples: dlib.sparse_vectors, labels: dlib.array) -> binary_test
  9. test_binary_decision_function(function: dlib._decision_function_sigmoid, samples: dlib.vectors, labels: dlib.array) -> binary_test
  10. test_binary_decision_function(function: dlib._decision_function_sparse_sigmoid, samples: dlib.sparse_vectors, labels: dlib.array) -> binary_test
dlib.test_ranking_function(*args, **kwargs)

Overloaded function.

  1. test_ranking_function(function: dlib._decision_function_linear, samples: dlib.ranking_pairs) -> ranking_test
  2. test_ranking_function(function: dlib._decision_function_sparse_linear, samples: dlib.sparse_ranking_pairs) -> ranking_test
  3. test_ranking_function(function: dlib._decision_function_linear, sample: dlib.ranking_pair) -> ranking_test
  4. test_ranking_function(function: dlib._decision_function_sparse_linear, sample: dlib.sparse_ranking_pair) -> ranking_test
dlib.test_regression_function(*args, **kwargs)

Overloaded function.

  1. test_regression_function(function: dlib._decision_function_linear, samples: dlib.vectors, targets: dlib.array) -> regression_test
  2. test_regression_function(function: dlib._decision_function_sparse_linear, samples: dlib.sparse_vectors, targets: dlib.array) -> regression_test
  3. test_regression_function(function: dlib._decision_function_radial_basis, samples: dlib.vectors, targets: dlib.array) -> regression_test
  4. test_regression_function(function: dlib._decision_function_sparse_radial_basis, samples: dlib.sparse_vectors, targets: dlib.array) -> regression_test
  5. test_regression_function(function: dlib._decision_function_histogram_intersection, samples: dlib.vectors, targets: dlib.array) -> regression_test
  6. test_regression_function(function: dlib._decision_function_sparse_histogram_intersection, samples: dlib.sparse_vectors, targets: dlib.array) -> regression_test
  7. test_regression_function(function: dlib._decision_function_sigmoid, samples: dlib.vectors, targets: dlib.array) -> regression_test
  8. test_regression_function(function: dlib._decision_function_sparse_sigmoid, samples: dlib.sparse_vectors, targets: dlib.array) -> regression_test
  9. test_regression_function(function: dlib._decision_function_polynomial, samples: dlib.vectors, targets: dlib.array) -> regression_test
  10. test_regression_function(function: dlib._decision_function_sparse_polynomial, samples: dlib.sparse_vectors, targets: dlib.array) -> regression_test
dlib.test_sequence_segmenter(*args, **kwargs)

Overloaded function.

  1. test_sequence_segmenter(arg0: dlib.segmenter_type, arg1: dlib.vectorss, arg2: dlib.rangess) -> dlib.segmenter_test
  2. test_sequence_segmenter(arg0: dlib.segmenter_type, arg1: dlib.sparse_vectorss, arg2: dlib.rangess) -> dlib.segmenter_test
dlib.test_shape_predictor(*args, **kwargs)

Overloaded function.

  1. test_shape_predictor(dataset_filename: unicode, predictor_filename: unicode) -> float
ensures
  • Loads an image dataset from dataset_filename. We assume dataset_filename is a file using the XML format written by save_image_dataset_metadata().
  • Loads a shape_predictor from the file predictor_filename. This means predictor_filename should be a file produced by the train_shape_predictor() routine.
  • This function tests the predictor against the dataset and returns the mean average error of the detector. In fact, The return value of this function is identical to that of dlib’s shape_predictor_trainer() routine. Therefore, see the documentation for shape_predictor_trainer() for a detailed definition of the mean average error.
  1. test_shape_predictor(images: list, detections: list, shape_predictor: dlib.shape_predictor) -> float
requires
  • len(images) == len(object_detections)
  • images should be a list of numpy matrices that represent images, either RGB or grayscale.
  • object_detections should be a list of lists of dlib.full_object_detection objects. Each dlib.full_object_detection contains the bounding box and the lists of points that make up the object parts.
ensures
  • shape_predictor should be a file produced by the train_shape_predictor() routine.
  • This function tests the predictor against the dataset and returns the mean average error of the detector. In fact, The return value of this function is identical to that of dlib’s shape_predictor_trainer() routine. Therefore, see the documentation for shape_predictor_trainer() for a detailed definition of the mean average error.
  1. test_shape_predictor(images: list, detections: list, scales: list, shape_predictor: dlib.shape_predictor) -> float
requires
  • len(images) == len(object_detections)
  • len(object_detections) == len(scales)
  • for every sublist in object_detections: len(object_detections[i]) == len(scales[i])
  • scales is a list of floating point scales that each predicted part location should be divided by. Useful for normalization.
  • images should be a list of numpy matrices that represent images, either RGB or grayscale.
  • object_detections should be a list of lists of dlib.full_object_detection objects. Each dlib.full_object_detection contains the bounding box and the lists of points that make up the object parts.
ensures
  • shape_predictor should be a file produced by the train_shape_predictor() routine.
  • This function tests the predictor against the dataset and returns the mean average error of the detector. In fact, The return value of this function is identical to that of dlib’s shape_predictor_trainer() routine. Therefore, see the documentation for shape_predictor_trainer() for a detailed definition of the mean average error.
dlib.test_simple_object_detector(*args, **kwargs)

Overloaded function.

  1. test_simple_object_detector(dataset_filename: unicode, detector_filename: unicode, upsampling_amount: int=-1L) -> dlib.simple_test_results
requires
  • Optionally, take the number of times to upsample the testing images (upsampling_amount >= 0).
ensures
  • Loads an image dataset from dataset_filename. We assume dataset_filename is a file using the XML format written by save_image_dataset_metadata().
  • Loads a simple_object_detector from the file detector_filename. This means detector_filename should be a file produced by the train_simple_object_detector() routine.
  • This function tests the detector against the dataset and returns the precision, recall, and average precision of the detector. In fact, The return value of this function is identical to that of dlib’s test_object_detection_function() routine. Therefore, see the documentation for test_object_detection_function() for a detailed definition of these metrics.
  1. test_simple_object_detector(images: list, boxes: list, detector: dlib::object_detector<dlib::scan_fhog_pyramid<dlib::pyramid_down<6u>, dlib::default_fhog_feature_extractor> >, upsampling_amount: int=0L) -> dlib.simple_test_results
requires
  • len(images) == len(boxes)
  • images should be a list of numpy matrices that represent images, either RGB or grayscale.
  • boxes should be a list of lists of dlib.rectangle object.
  • Optionally, take the number of times to upsample the testing images (upsampling_amount >= 0).
ensures
  • Loads a simple_object_detector from the file detector_filename. This means detector_filename should be a file produced by the train_simple_object_detector() routine.
  • This function tests the detector against the dataset and returns the precision, recall, and average precision of the detector. In fact, The return value of this function is identical to that of dlib’s test_object_detection_function() routine. Therefore, see the documentation for test_object_detection_function() for a detailed definition of these metrics.
  1. test_simple_object_detector(images: list, boxes: list, detector: dlib::simple_object_detector_py, upsampling_amount: int=-1L) -> dlib.simple_test_results
requires
  • len(images) == len(boxes)
  • images should be a list of numpy matrices that represent images, either RGB or grayscale.
  • boxes should be a list of lists of dlib.rectangle object.
ensures
  • Loads a simple_object_detector from the file detector_filename. This means detector_filename should be a file produced by the train_simple_object_detector() routine.
  • This function tests the detector against the dataset and returns the precision, recall, and average precision of the detector. In fact, The return value of this function is identical to that of dlib’s test_object_detection_function() routine. Therefore, see the documentation for test_object_detection_function() for a detailed definition of these metrics.
dlib.threshold_image(*args, **kwargs)

Overloaded function.

  1. threshold_image(img: numpy.ndarray[(rows,cols),uint8]) -> numpy.ndarray[(rows,cols),uint8]
  2. threshold_image(img: numpy.ndarray[(rows,cols),uint16]) -> numpy.ndarray[(rows,cols),uint8]
  3. threshold_image(img: numpy.ndarray[(rows,cols),uint32]) -> numpy.ndarray[(rows,cols),uint8]
  4. threshold_image(img: numpy.ndarray[(rows,cols),float32]) -> numpy.ndarray[(rows,cols),uint8]
  5. threshold_image(img: numpy.ndarray[(rows,cols),float64]) -> numpy.ndarray[(rows,cols),uint8]
  6. threshold_image(img: numpy.ndarray[(rows,cols,3),uint8]) -> numpy.ndarray[(rows,cols),uint8]

Thresholds img and returns the result. Pixels in img with grayscale values >= partition_pixels(img) have an output value of 255 and all others have a value of 0.

  1. threshold_image(img: numpy.ndarray[(rows,cols),uint8], thresh: int) -> numpy.ndarray[(rows,cols),uint8]
  2. threshold_image(img: numpy.ndarray[(rows,cols),uint16], thresh: int) -> numpy.ndarray[(rows,cols),uint8]
  3. threshold_image(img: numpy.ndarray[(rows,cols),uint32], thresh: int) -> numpy.ndarray[(rows,cols),uint8]
  4. threshold_image(img: numpy.ndarray[(rows,cols),float32], thresh: float) -> numpy.ndarray[(rows,cols),uint8]
  5. threshold_image(img: numpy.ndarray[(rows,cols),float64], thresh: float) -> numpy.ndarray[(rows,cols),uint8]
  6. threshold_image(img: numpy.ndarray[(rows,cols,3),uint8], thresh: int) -> numpy.ndarray[(rows,cols),uint8]

Thresholds img and returns the result. Pixels in img with grayscale values >= thresh have an output value of 255 and all others have a value of 0.

dlib.train_sequence_segmenter(*args, **kwargs)

Overloaded function.

  1. train_sequence_segmenter(samples: dlib.vectorss, segments: dlib.rangess, params: dlib.segmenter_params=<BIO,highFeats,signed,win=5,threads=4,eps=0.1,cache=40,non-verbose,C=100>) -> dlib.segmenter_type
  2. train_sequence_segmenter(samples: dlib.sparse_vectorss, segments: dlib.rangess, params: dlib.segmenter_params=<BIO,highFeats,signed,win=5,threads=4,eps=0.1,cache=40,non-verbose,C=100>) -> dlib.segmenter_type
dlib.train_shape_predictor(*args, **kwargs)

Overloaded function.

  1. train_shape_predictor(images: list, object_detections: list, options: dlib.shape_predictor_training_options) -> dlib.shape_predictor
requires
  • options.lambda_param > 0
  • 0 < options.nu <= 1
  • options.feature_pool_region_padding >= 0
  • len(images) == len(object_detections)
  • images should be a list of numpy matrices that represent images, either RGB or grayscale.
  • object_detections should be a list of lists of dlib.full_object_detection objects. Each dlib.full_object_detection contains the bounding box and the lists of points that make up the object parts.
ensures
  • Uses dlib’s shape_predictor_trainer object to train a shape_predictor based on the provided labeled images, full_object_detections, and options.
  • The trained shape_predictor is returned
  1. train_shape_predictor(dataset_filename: unicode, predictor_output_filename: unicode, options: dlib.shape_predictor_training_options) -> None
requires
  • options.lambda_param > 0
  • 0 < options.nu <= 1
  • options.feature_pool_region_padding >= 0
ensures
  • Uses dlib’s shape_predictor_trainer to train a shape_predictor based on the labeled images in the XML file dataset_filename and the provided options. This function assumes the file dataset_filename is in the XML format produced by dlib’s save_image_dataset_metadata() routine.
  • The trained shape predictor is serialized to the file predictor_output_filename.
dlib.train_simple_object_detector(*args, **kwargs)

Overloaded function.

  1. train_simple_object_detector(dataset_filename: unicode, detector_output_filename: unicode, options: dlib.simple_object_detector_training_options) -> None
requires
  • options.C > 0
ensures
  • Uses the structural_object_detection_trainer to train a simple_object_detector based on the labeled images in the XML file dataset_filename. This function assumes the file dataset_filename is in the XML format produced by dlib’s save_image_dataset_metadata() routine.
  • This function will apply a reasonable set of default parameters and preprocessing techniques to the training procedure for simple_object_detector objects. So the point of this function is to provide you with a very easy way to train a basic object detector.
  • The trained object detector is serialized to the file detector_output_filename.
  1. train_simple_object_detector(images: list, boxes: list, options: dlib.simple_object_detector_training_options) -> dlib::simple_object_detector_py
requires
  • options.C > 0
  • len(images) == len(boxes)
  • images should be a list of numpy matrices that represent images, either RGB or grayscale.
  • boxes should be a list of lists of dlib.rectangle object.
ensures
  • Uses the structural_object_detection_trainer to train a simple_object_detector based on the labeled images and bounding boxes.
  • This function will apply a reasonable set of default parameters and preprocessing techniques to the training procedure for simple_object_detector objects. So the point of this function is to provide you with a very easy way to train a basic object detector.
  • The trained object detector is returned.
dlib.transform_image(*args, **kwargs)

Overloaded function.

  1. transform_image(img: numpy.ndarray[(rows,cols),uint8], map_point: dlib.point_transform_projective, rows: int, columns: int) -> numpy.ndarray[(rows,cols),uint8]
  2. transform_image(img: numpy.ndarray[(rows,cols),uint16], map_point: dlib.point_transform_projective, rows: int, columns: int) -> numpy.ndarray[(rows,cols),uint16]
  3. transform_image(img: numpy.ndarray[(rows,cols),uint32], map_point: dlib.point_transform_projective, rows: int, columns: int) -> numpy.ndarray[(rows,cols),uint32]
  4. transform_image(img: numpy.ndarray[(rows,cols),uint64], map_point: dlib.point_transform_projective, rows: int, columns: int) -> numpy.ndarray[(rows,cols),uint64]
  5. transform_image(img: numpy.ndarray[(rows,cols),int8], map_point: dlib.point_transform_projective, rows: int, columns: int) -> numpy.ndarray[(rows,cols),int8]
  6. transform_image(img: numpy.ndarray[(rows,cols),int16], map_point: dlib.point_transform_projective, rows: int, columns: int) -> numpy.ndarray[(rows,cols),int16]
  7. transform_image(img: numpy.ndarray[(rows,cols),int32], map_point: dlib.point_transform_projective, rows: int, columns: int) -> numpy.ndarray[(rows,cols),int32]
  8. transform_image(img: numpy.ndarray[(rows,cols),int64], map_point: dlib.point_transform_projective, rows: int, columns: int) -> numpy.ndarray[(rows,cols),int64]
  9. transform_image(img: numpy.ndarray[(rows,cols),float32], map_point: dlib.point_transform_projective, rows: int, columns: int) -> numpy.ndarray[(rows,cols),float32]
  10. transform_image(img: numpy.ndarray[(rows,cols),float64], map_point: dlib.point_transform_projective, rows: int, columns: int) -> numpy.ndarray[(rows,cols),float64]
  11. transform_image(img: numpy.ndarray[(rows,cols,3),uint8], map_point: dlib.point_transform_projective, rows: int, columns: int) -> numpy.ndarray[(rows,cols,3),uint8]
requires
  • rows > 0
  • columns > 0
ensures
  • Returns an image that is the given rows by columns in size and contains a transformed part of img. To do this, we interpret map_point as a mapping from pixels in the returned image to pixels in the input img. transform_image() uses this mapping and bilinear interpolation to fill the output image with an interpolated copy of img.
  • Any locations in the output image that map to pixels outside img are set to 0.
class dlib.vector

This object represents the mathematical idea of a column vector.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.vector) -> None
  2. __init__(self: dlib.vector, arg0: object) -> None
resize(self: dlib.vector, arg0: int) → None
set_size(self: dlib.vector, arg0: int) → None
shape
class dlib.vectors

This object is an array of vector objects.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.vectors) -> None
  2. __init__(self: dlib.vectors, arg0: dlib.vectors) -> None

Copy constructor

  1. __init__(self: dlib.vectors, arg0: iterable) -> None
append(self: dlib.vectors, x: dlib.vector) → None

Add an item to the end of the list

clear(self: dlib.vectors) → None
count(self: dlib.vectors, x: dlib.vector) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.vectors, L: dlib.vectors) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.vectors, arg0: list) -> None
insert(self: dlib.vectors, i: int, x: dlib.vector) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.vectors) -> dlib.vector

Remove and return the last item

  1. pop(self: dlib.vectors, i: int) -> dlib.vector

Remove and return the item at index i

remove(self: dlib.vectors, x: dlib.vector) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.vectors, arg0: int) → None
class dlib.vectorss

This object is an array of arrays of vector objects.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.vectorss) -> None
  2. __init__(self: dlib.vectorss, arg0: dlib.vectorss) -> None

Copy constructor

  1. __init__(self: dlib.vectorss, arg0: iterable) -> None
append(self: dlib.vectorss, x: dlib.vectors) → None

Add an item to the end of the list

clear(self: dlib.vectorss) → None
count(self: dlib.vectorss, x: dlib.vectors) → int

Return the number of times x appears in the list

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: dlib.vectorss, L: dlib.vectorss) -> None

Extend the list by appending all the items in the given list

  1. extend(self: dlib.vectorss, arg0: list) -> None
insert(self: dlib.vectorss, i: int, x: dlib.vectors) → None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: dlib.vectorss) -> dlib.vectors

Remove and return the last item

  1. pop(self: dlib.vectorss, i: int) -> dlib.vectors

Remove and return the item at index i

remove(self: dlib.vectorss, x: dlib.vectors) → None

Remove the first item from the list whose value is x. It is an error if there is no such item.

resize(self: dlib.vectorss, arg0: int) → None

Routines for setting CUDA specific properties.

dlib.cuda.get_device() → int

Get the active CUDA device.

dlib.cuda.get_num_devices() → int

Find out how many CUDA devices are available.

dlib.cuda.set_device(device_id: int) → None

Set the active CUDA device. It is required that 0 <= device_id < get_num_devices().

Routines and objects for working with dlib’s image dataset metadata XML files.

class dlib.image_dataset_metadata.box

This object represents an annotated rectangular area of an image. It is typically used to mark the location of an object such as a person, car, etc.

The main variable of interest is rect. It gives the location of the box. All the other variables are optional.

FEMALE = gender_type.FEMALE
MALE = gender_type.MALE
UNKNOWN = gender_type.UNKNOWN
__init__

x.__init__(...) initializes x; see help(type(x)) for signature

age
angle
detection_score
difficult
gender
class gender_type
FEMALE = gender_type.FEMALE
MALE = gender_type.MALE
UNKNOWN = gender_type.UNKNOWN
__init__(self: dlib.image_dataset_metadata.box.gender_type, arg0: int) → None
box.ignore
box.label
box.occluded
box.parts
box.pose
box.rect
box.truncated
class dlib.image_dataset_metadata.dataset

This object represents a labeled set of images. In particular, it contains the filename for each image as well as annotated boxes.

__init__

x.__init__(...) initializes x; see help(type(x)) for signature

comment
images
name
class dlib.image_dataset_metadata.image

This object represents an annotated image.

__init__

x.__init__(...) initializes x; see help(type(x)) for signature

boxes
filename
dlib.image_dataset_metadata.load_image_dataset_metadata(filename: unicode) → dlib.image_dataset_metadata.dataset

Attempts to interpret filename as a file containing XML formatted data as produced by the save_image_dataset_metadata() function. The data is loaded and returned as a dlib.image_dataset_metadata.dataset object.

class dlib.image_dataset_metadata.parts

This object is a dictionary mapping string names to object part locations.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dlib.image_dataset_metadata.parts) -> None
  2. __init__(self: dlib.image_dataset_metadata.parts, arg0: dict) -> None
items(self: dlib.image_dataset_metadata.parts) → iterator
dlib.image_dataset_metadata.save_image_dataset_metadata(data: dlib.image_dataset_metadata.dataset, filename: unicode) → None

Writes the contents of the meta object to a file with the given filename. The file will be in an XML format.