Line 142... |
Line 142... |
142 |
cv::magnitude(F0Secondary[i*2 + 2], F0Secondary[i*2 + 3], magnitude);
|
142 |
cv::magnitude(F0Secondary[i*2 + 2], F0Secondary[i*2 + 3], magnitude);
|
143 |
cv::add(energy0Secondary, magnitude, energy0Secondary, cv::noArray(), CV_32F);
|
143 |
cv::add(energy0Secondary, magnitude, energy0Secondary, cv::noArray(), CV_32F);
|
144 |
}
|
144 |
}
|
145 |
|
145 |
|
146 |
// Threshold on energy at primary frequency
|
146 |
// Threshold on energy at primary frequency
|
147 |
occlusion0 = occlusion0 & (amplitude0 > 5.0*nStepsPrimary);
|
147 |
occlusion0 = occlusion0 & (amplitude0Primary > 5.0*nStepsPrimary);
|
148 |
// Threshold on energy ratios
|
148 |
// Threshold on energy ratios
|
149 |
occlusion0 = occlusion0 & (amplitude0 > 0.85*energy0Primary);
|
149 |
occlusion0 = occlusion0 & (amplitude0Primary > 0.85*energy0Primary);
|
150 |
occlusion0 = occlusion0 & (amplitude0 > 0.85*energy0Secondary);
|
150 |
occlusion0 = occlusion0 & (amplitude0Secondary > 0.85*energy0Secondary);
|
151 |
|
151 |
|
152 |
#ifdef QT_DEBUG
|
152 |
#ifdef SM_DEBUG
|
153 |
cvtools::writeMat(up0Primary, "up0Primary.mat", "up0Primary");
|
153 |
cvtools::writeMat(up0Primary, "up0Primary.mat", "up0Primary");
|
154 |
cvtools::writeMat(up0Secondary, "up0Secondary.mat", "up0Secondary");
|
154 |
cvtools::writeMat(up0Secondary, "up0Secondary.mat", "up0Secondary");
|
155 |
cvtools::writeMat(up0Equivalent, "up0Equivalent.mat", "up0Equivalent");
|
155 |
cvtools::writeMat(up0Equivalent, "up0Equivalent.mat", "up0Equivalent");
|
156 |
cvtools::writeMat(up0, "up0.mat", "up0");
|
156 |
cvtools::writeMat(up0, "up0.mat", "up0");
|
157 |
cvtools::writeMat(amplitude0Primary, "amplitude0Primary.mat", "amplitude0Primary");
|
157 |
cvtools::writeMat(amplitude0Primary, "amplitude0Primary.mat", "amplitude0Primary");
|
Line 216... |
Line 216... |
216 |
cv::magnitude(F1Secondary[i*2 + 2], F1Secondary[i*2 + 3], magnitude);
|
216 |
cv::magnitude(F1Secondary[i*2 + 2], F1Secondary[i*2 + 3], magnitude);
|
217 |
cv::add(energy1Secondary, magnitude, energy1Secondary, cv::noArray(), CV_32F);
|
217 |
cv::add(energy1Secondary, magnitude, energy1Secondary, cv::noArray(), CV_32F);
|
218 |
}
|
218 |
}
|
219 |
|
219 |
|
220 |
// Threshold on energy at primary frequency
|
220 |
// Threshold on energy at primary frequency
|
221 |
occlusion1 = occlusion1 & (amplitude1 > 5.0*nStepsPrimary);
|
221 |
occlusion1 = occlusion1 & (amplitude1Primary > 5.0*nStepsPrimary);
|
222 |
// Threshold on energy ratios
|
222 |
// Threshold on energy ratios
|
223 |
occlusion1 = occlusion1 & (amplitude1 > 0.85*energy1Primary);
|
- |
|
224 |
occlusion1 = occlusion1 & (amplitude1Primary > 0.85*energy1Primary);
|
223 |
occlusion1 = occlusion1 & (amplitude1Primary > 0.85*energy1Primary);
|
225 |
occlusion1 = occlusion1 & (amplitude1Secondary > 0.85*energy1Secondary);
|
224 |
occlusion1 = occlusion1 & (amplitude1Secondary > 0.85*energy1Secondary);
|
226 |
|
225 |
|
227 |
#ifdef QT_DEBUG
|
226 |
#ifdef SM_DEBUG
|
228 |
cvtools::writeMat(up1, "up1.mat", "up1");
|
227 |
cvtools::writeMat(up1, "up1.mat", "up1");
|
229 |
#endif
|
228 |
#endif
|
230 |
}
|
229 |
}
|
231 |
|
230 |
|
232 |
// // Erode occlusion masks
|
231 |
// // Erode occlusion masks
|
Line 241... |
Line 240... |
241 |
|
240 |
|
242 |
cv::Mat edges1;
|
241 |
cv::Mat edges1;
|
243 |
cv::Sobel(up1, edges1, -1, 1, 1, 5);
|
242 |
cv::Sobel(up1, edges1, -1, 1, 1, 5);
|
244 |
occlusion1 = occlusion1 & (abs(edges1) < 10);
|
243 |
occlusion1 = occlusion1 & (abs(edges1) < 10);
|
245 |
|
244 |
|
246 |
#ifdef QT_DEBUG
|
245 |
#ifdef SM_DEBUG
|
247 |
cvtools::writeMat(edges0, "edges0.mat", "edges0");
|
246 |
cvtools::writeMat(edges0, "edges0.mat", "edges0");
|
248 |
cvtools::writeMat(edges1, "edges1.mat", "edges1");
|
247 |
cvtools::writeMat(edges1, "edges1.mat", "edges1");
|
249 |
cvtools::writeMat(occlusion0, "occlusion0.mat", "occlusion0");
|
248 |
cvtools::writeMat(occlusion0, "occlusion0.mat", "occlusion0");
|
250 |
cvtools::writeMat(occlusion1, "occlusion1.mat", "occlusion1");
|
249 |
cvtools::writeMat(occlusion1, "occlusion1.mat", "occlusion1");
|
251 |
#endif
|
250 |
#endif
|
Line 298... |
Line 297... |
298 |
cv::remap(color0, color0, map0X, map0Y, CV_INTER_LINEAR);
|
297 |
cv::remap(color0, color0, map0X, map0Y, CV_INTER_LINEAR);
|
299 |
|
298 |
|
300 |
cv::cvtColor(frames1[0], color1, CV_BayerBG2RGB);
|
299 |
cv::cvtColor(frames1[0], color1, CV_BayerBG2RGB);
|
301 |
cv::remap(color1, color1, map1X, map1Y, CV_INTER_LINEAR);
|
300 |
cv::remap(color1, color1, map1X, map1Y, CV_INTER_LINEAR);
|
302 |
|
301 |
|
303 |
#ifdef QT_DEBUG
|
302 |
#ifdef SM_DEBUG
|
304 |
cvtools::writeMat(color0, "color0.mat", "color0");
|
303 |
cvtools::writeMat(color0, "color0.mat", "color0");
|
305 |
cvtools::writeMat(color1, "color1.mat", "color1");
|
304 |
cvtools::writeMat(color1, "color1.mat", "color1");
|
306 |
#endif
|
305 |
#endif
|
307 |
|
306 |
|
308 |
// Retrieve color information
|
307 |
// Retrieve color information
|