MCPcopy Create free account
hub / github.com/cpvrlab/ImagePlay / processInputData

Method processInputData

IPL/src/processes/IPLAccumulate.cpp:48–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48bool IPLAccumulate::processInputData(IPLData* data , int, bool)
49{
50 IPLImage* image = data->toImage();
51
52 // init result
53 if(!_result)
54 {
55 int width = image->width();
56 int height = image->height();
57
58 _result = new IPLImage(image->type(), width, height);
59 _result->fillColor(0.0);
60 }
61
62 // get properties
63 int method = getProcessPropertyInt("method");
64 double weight = getProcessPropertyDouble("weighted_weight");
65
66 /*std::stringstream s;
67 s << "Window: ";
68 s << window;
69 addInformation(s.str());*/
70
71 notifyProgressEventHandler(-1);
72 cv::Mat input = image->toCvMat();
73 cv::Mat output = _result->toCvMat();
74
75 input.convertTo(input, CV_32FC3);
76 output.convertTo(output, CV_32FC3);
77
78
79 if(method == 0)
80 {
81 cv::accumulate(input, output);
82 output *= 0.5;
83 }
84 else if(method == 1)
85 {
86 cv::accumulateSquare(input, output);
87 }
88 else if(method == 2)
89 {
90 cv::accumulateProduct(input, input, output);
91 }
92 else if(method == 3)
93 {
94 cv::accumulateWeighted(input, output, weight);
95 }
96
97 output.convertTo(output, CV_8UC3);
98
99 delete _result;
100 _result = new IPLImage(output);
101
102 return true;
103}
104
105IPLData* IPLAccumulate::getResultData( int )

Callers

nothing calls this directly

Calls 7

toImageMethod · 0.80
widthMethod · 0.80
heightMethod · 0.80
fillColorMethod · 0.80
toCvMatMethod · 0.80
convertToMethod · 0.80
typeMethod · 0.45

Tested by

no test coverage detected