Adding mirror image support.

This commit is contained in:
Tadas Baltrusaitis 2018-01-27 11:12:00 +00:00
parent 90ccbcb72a
commit eb5a2ed01f
2 changed files with 11 additions and 5 deletions

View file

@ -384,22 +384,23 @@ namespace HeadPoseLive
// CAPTURE FRAME AND DETECT LANDMARKS FOLLOWED BY THE REQUIRED IMAGE PROCESSING
//////////////////////////////////////////////
RawImage frame = null;
frame = reader.GetNextImage();
RawImage frame = reader.GetNextImage();
lastFrameTime = CurrentTime;
processing_fps.AddFrame();
var grayFrame = reader.GetCurrentFrameGray();
if (grayFrame == null)
continue;
if (mirror_image)
{
frame.Mirror();
grayFrame.Mirror();
}
bool detectionSucceeding = ProcessFrame(face_model, gaze_analyser, model_params, frame, grayFrame, reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy());
lock (recording_lock)
{
if (recording)
{
// Add objects to recording queues

View file

@ -136,6 +136,11 @@ namespace OpenCVWrappers {
refCount++;
}
void Mirror()
{
cv::flip(*mat, *mat, 1);
}
// Finalizer. Definitely called before Garbage Collection,
// but not automatically called on explicit Dispose().
// May be called multiple times.