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

Function width_step

dlib/python/numpy_image.h:322–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320
321 template <typename pixel_type>
322 size_t width_step (const numpy_image<pixel_type>& img)
323 {
324 if (img.size()==0)
325 return 0;
326
327 assert_correct_num_channels_in_image<pixel_type>(img);
328 using basic_pixel_type = typename pixel_traits<pixel_type>::basic_pixel_type;
329 if (img.ndim()==3 && img.strides(2) != sizeof(basic_pixel_type))
330 throw dlib::error("The stride of the 3rd dimension (the channel dimension) of the numpy array must be " + std::to_string(sizeof(basic_pixel_type)));
331 if (img.strides(1) != sizeof(pixel_type))
332 throw dlib::error("The stride of the 2nd dimension (the columns dimension) of the numpy array must be " + std::to_string(sizeof(pixel_type)));
333
334 return img.strides(0);
335 }
336
337 template <typename pixel_type>
338 void swap(numpy_image<pixel_type>& a, numpy_image<pixel_type>& b)

Callers

nothing calls this directly

Calls 4

errorClass · 0.85
stridesMethod · 0.80
sizeMethod · 0.45
ndimMethod · 0.45

Tested by

no test coverage detected