From 194a05b42a5ad8ce4e6340741df108b3e8f06743 Mon Sep 17 00:00:00 2001
From: Guillaume HEUSCH <guillaume.heusch@idiap.ch>
Date: Tue, 20 Feb 2018 11:36:00 +0100
Subject: [PATCH] [extractor] tried to adress to upside down case, ended up
 with problems with rotation ...

---
 bob/pad/face/extractor/Li.py | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/bob/pad/face/extractor/Li.py b/bob/pad/face/extractor/Li.py
index 7e327d7f..95335e03 100644
--- a/bob/pad/face/extractor/Li.py
+++ b/bob/pad/face/extractor/Li.py
@@ -100,12 +100,36 @@ class Li(Extractor, object):
     for i, frame in enumerate(video):
 
       logger.debug("Processing frame {}/{}".format(counter, nb_frames))
+      if self.debug:
+        from matplotlib import pyplot
+        pyplot.imshow(numpy.rollaxis(numpy.rollaxis(frame, 2),2))
+        pyplot.show()
      
       # detect landmarks
       try:
         ldms = detector(frame)
       except TypeError:
-        ldms = previous_ldms
+        
+        ####################
+        # looks like some images from replay mobile are upside down !
+        # looks like bob.ip.rotate has a color issue
+        ####################
+        
+        #rotated_shape = bob.ip.base.rotated_output_shape(frame, 180)
+        #frame_rotated = numpy.ndarray(rotated_shape, dtype=numpy.float64)
+        #from bob.ip.base import rotate
+        #bob.ip.base.rotate(frame, frame_rotated, 180)
+        #logger.warning("Rotating again ...")
+        #try:
+        #  ldms = detector(frame_rotated)
+        #except TypeError:
+        #  ldms = previous_ldms
+        #frame = frame_rotated
+        
+        # so do nothing ...
+        logger.warning("No mask detected in frame {}".format(i))
+        face_color[i] = 0
+        continue
 
       if self.debug:
         from matplotlib import pyplot
-- 
GitLab