if (monitorImages[p] == null) {
monitorImages[p] = IplImage.create(roiMask.width(), roiMask.height(), IPL_DEPTH_8U, channels);
}
FloatBuffer in = transformed.getFloatBuffer();
ByteBuffer mask = roiMask.getByteBuffer();
ByteBuffer out = monitorImages[p].getByteBuffer();
while (in.hasRemaining() && out.hasRemaining() && mask.hasRemaining()) {
byte m = mask.get();
for (int z = 0; z < channels; z++) {
float f = in.get();
out.put((byte)(m == 0 ? 0 : Math.round(f*255)));
}
}
monitorWindows[1].showImage(monitorImages[p], trackingSettings.getMonitorWindowsScale()*(1<<p));
cvSetZero(monitorImages[p]);
cvSetImageROI(monitorImages[p], cvGetImageROI(target));
cvConvertScale(target, monitorImages[p], 255, 0);
cvResetImageROI(monitorImages[p]);
infoLogString += realityAugmentor.drawRoi(monitorImages[p], p, undistortedCameraImage, transformer, parameters);
monitorWindows[2].showImage(monitorImages[p], trackingSettings.getMonitorWindowsScale()*(1<<p));
if (frameRecorder != null) {
cvResize(monitorImages[p], undistortedCameraImage, CV_INTER_LINEAR);
undistortedCameraImage.applyGamma(1/2.2);
frameRecorder.record(undistortedCameraImage);
}
// double[] outlierThresholds = alignerSettings.getOutlierThresholds();
// double outlierThreshold2 = aligner.getRMSE()*outlierThresholds[Math.min(outlierThresholds.length-1, p)];
// outlierThreshold2 *= outlierThreshold2;
in = residual.getFloatBuffer();
mask.position(0);
out.position(0);
while (in.hasRemaining() && out.hasRemaining() && mask.hasRemaining()) {
byte m = mask.get();
// double magnitude2 = 0;
for (int z = 0; z < channels; z++) {
float f = Math.abs(in.get());
// magnitude2 += f*f;
out.put((byte)(m == 0 ? 0 : Math.round(f*255)));
}
// byte value = (byte)(m == 0 || magnitude2 < outlierThreshold2 ? 0 : 255);
// for (int z = 0; z < channels; z++) {