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

Function convert_image_scaled

tools/python/src/image3.cpp:17–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16template <typename T>
17py::array convert_image_scaled (
18 const numpy_image<T>& img,
19 const string& dtype,
20 const double thresh = 4
21)
22{
23 if (dtype == "uint8") {numpy_image<uint8_t> out; assign_image_scaled(out, img, thresh); return out;}
24 if (dtype == "uint16") {numpy_image<uint16_t> out; assign_image_scaled(out, img, thresh); return out;}
25 if (dtype == "uint32") {numpy_image<uint32_t> out; assign_image_scaled(out, img, thresh); return out;}
26 if (dtype == "uint64") {numpy_image<uint64_t> out; assign_image_scaled(out, img, thresh); return out;}
27 if (dtype == "int8") {numpy_image<int8_t> out; assign_image_scaled(out, img, thresh); return out;}
28 if (dtype == "int16") {numpy_image<int16_t> out; assign_image_scaled(out, img, thresh); return out;}
29 if (dtype == "int32") {numpy_image<int32_t> out; assign_image_scaled(out, img, thresh); return out;}
30 if (dtype == "int64") {numpy_image<int64_t> out; assign_image_scaled(out, img, thresh); return out;}
31 if (dtype == "float32") {numpy_image<float> out; assign_image_scaled(out, img, thresh); return out;}
32 if (dtype == "float64") {numpy_image<double> out; assign_image_scaled(out, img, thresh); return out;}
33 if (dtype == "float") {numpy_image<float> out; assign_image_scaled(out, img, thresh); return out;}
34 if (dtype == "double") {numpy_image<double> out; assign_image_scaled(out, img, thresh); return out;}
35 if (dtype == "rgb_pixel"){numpy_image<rgb_pixel> out; assign_image_scaled(out, img, thresh); return out;}
36
37
38 throw dlib::error("convert_image_scaled() called with invalid dtype, must be one of these strings: \n"
39 "uint8, int8, uint16, int16, uint32, int32, uint64, int64, float32, float, float64, double, or rgb_pixel");
40}
41
42// ----------------------------------------------------------------------------------------
43

Callers

nothing calls this directly

Calls 2

assign_image_scaledFunction · 0.85
errorClass · 0.85

Tested by

no test coverage detected