29 bool automatic_range_detection) {
31 float minval = HUGE_VAL;
32 float maxval = -HUGE_VAL;
33 if (automatic_range_detection) {
34 for (
int i = 0; i < float_array.
Height(); ++i) {
35 for (
int j = 0; j < float_array.
Width(); ++j) {
36 for (
int k = 0; k < float_array.
Depth(); ++k) {
37 minval = std::min(minval, float_array(i, j, k));
38 maxval = std::max(maxval, float_array(i, j, k));
46 for (
int i = 0; i < float_array.
Height(); ++i) {
47 for (
int j = 0; j < float_array.
Width(); ++j) {
48 for (
int k = 0; k < float_array.
Depth(); ++k) {
49 float unscaled = (float_array(i, j, k) - minval) / (maxval - minval);
50 (*byte_array)(i, j, k) = (
unsigned char)(255 * unscaled);
72 assert(input.Depth() >= 3);
73 channel0->
Resize(input.Height(), input.Width());
74 channel1->
Resize(input.Height(), input.Width());
75 channel2->
Resize(input.Height(), input.Width());
76 for (
int row = 0; row < input.Height(); ++row) {
77 for (
int column = 0; column < input.Width(); ++column) {
78 (*channel0)(row, column) = input(row, column, 0);
79 (*channel1)(row, column) = input(row, column, 1);
80 (*channel2)(row, column) = input(row, column, 2);