MCPcopy Create free account
hub / github.com/LuminanceHDR/LuminanceHDR / main

Function main

test/InputOutputTest/InputOutputMain.cpp:32–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32int main(int argc, char** argv)
33{
34 try
35 {
36 std::string input;
37 std::string output;
38 bool autoscale;
39
40 getParameters(argc, argv, input, output, autoscale);
41
42 Frame myFrame(0,0);
43
44 msec_timer t;
45 t.start();
46
47 FrameReaderPtr reader = FrameReaderFactory::open(input);
48 reader->read(myFrame, pfs::Params());
49 reader->close();
50
51 t.stop_and_update();
52 std::cout << "Read time: " << t.get_time() << std::endl;
53
54 Channel* red;
55 Channel* green;
56 Channel* blue;
57
58 myFrame.getXYZChannels(red, green, blue);
59 pair<Channel::iterator, Channel::iterator> outRed =
60 boost::minmax_element(red->begin(), red->end());
61 cout << "Red: (" << *outRed.first << ", " << *outRed.second << ")" << endl;
62 pair<Channel::iterator, Channel::iterator> outGreen =
63 boost::minmax_element(green->begin(), green->end());
64 cout << "Green: (" << *outGreen.first << ", " << *outGreen.second << ")" << endl;
65 pair<Channel::iterator, Channel::iterator> outBlue =
66 boost::minmax_element(blue->begin(), blue->end());
67 cout << "Blue: (" << *outBlue.first << ", " << *outBlue.second << ")" << endl;
68
69 t.reset();
70 t.start();
71
72 FrameWriterPtr writer = FrameWriterFactory::open(output, pfs::Params());
73 float minValue = 0.f;
74 float maxValue = 1.f;
75 if (autoscale)
76 {
77 minValue = std::min(*outRed.first, std::min(*outGreen.first,*outBlue.first));
78 maxValue = std::max(*outRed.second, std::max(*outGreen.second,*outBlue.second));
79 }
80 writer->write(myFrame, pfs::Params
81 ("min_luminance", minValue)
82 ("max_luminance", maxValue)
83 );
84
85 t.stop_and_update();
86 std::cout << "Write time: " << t.get_time() << std::endl;
87
88 return 0;
89 }

Callers

nothing calls this directly

Calls 14

ParamsClass · 0.85
stop_and_updateMethod · 0.80
get_timeMethod · 0.80
getXYZChannelsMethod · 0.80
getParametersFunction · 0.70
minFunction · 0.50
maxFunction · 0.50
startMethod · 0.45
readMethod · 0.45
closeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected