MCPcopy Create free account
hub / github.com/davisking/dlib / is_binary_image

Function is_binary_image

dlib/image_transforms/morphological_operations.h:19–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17 {
18 template <typename image_type>
19 bool is_binary_image (
20 const image_type& img_
21 )
22 /*!
23 ensures
24 - returns true if img_ contains only on_pixel and off_pixel values.
25 - returns false otherwise
26 !*/
27 {
28 const_image_view<image_type> img(img_);
29 for (long r = 0; r < img.nr(); ++r)
30 {
31 for (long c = 0; c < img.nc(); ++c)
32 {
33 if (img[r][c] != on_pixel && img[r][c] != off_pixel)
34 {
35 return false;
36 }
37 }
38 }
39 return true;
40 }
41
42 template <
43 long M,

Callers 8

binary_dilationFunction · 0.85
binary_erosionFunction · 0.85
binary_openFunction · 0.85
binary_closeFunction · 0.85
binary_intersectionFunction · 0.85
binary_unionFunction · 0.85
binary_differenceFunction · 0.85
binary_complementFunction · 0.85

Calls 2

nrMethod · 0.45
ncMethod · 0.45

Tested by

no test coverage detected