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

Function downsample_image

dlib/test/image.cpp:1579–1599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1577 typename out_image_type
1578 >
1579 void downsample_image (
1580 const unsigned long downsample,
1581 const in_image_type& in_img,
1582 out_image_type& out_img,
1583 bool add_to
1584 )
1585 {
1586 out_img.set_size((in_img.nr()+downsample-1)/downsample,
1587 (in_img.nc()+downsample-1)/downsample);
1588
1589 for (long r = 0; r < out_img.nr(); ++r)
1590 {
1591 for (long c = 0; c < out_img.nc(); ++c)
1592 {
1593 if (add_to)
1594 out_img[r][c] += in_img[r*downsample][c*downsample];
1595 else
1596 out_img[r][c] = in_img[r*downsample][c*downsample];
1597 }
1598 }
1599 }
1600
1601 template <
1602 typename in_image_type,

Calls 3

set_sizeMethod · 0.45
nrMethod · 0.45
ncMethod · 0.45

Tested by

no test coverage detected