Skip to content
Snippets Groups Projects
Commit 39145a54 authored by Guillaume HEUSCH's avatar Guillaume HEUSCH
Browse files

[preprocessor] fixed the problem with mean color extraction from a masked area

parent 55a11e79
No related branches found
No related tags found
1 merge request!70Resolve "Retrieve colors from all channels for some of pulse-based PAD preprocessors"
Pipeline #
......@@ -134,7 +134,7 @@ class LiPulseExtraction(Preprocessor):
ldms = previous_ldms
# so do nothing ...
logger.warning("No mask detected in frame {}".format(i))
face_color[i] = 0
face_color[i] = [0, 0, 0]
continue
frame = frame_rotated
......@@ -144,6 +144,7 @@ class LiPulseExtraction(Preprocessor):
logger.warning("Frame {}: no landmarks detected, using the ones from previous frame".format(i))
if self.debug:
if False:
from matplotlib import pyplot
display = numpy.copy(frame)
for p in ldms:
......@@ -152,10 +153,12 @@ class LiPulseExtraction(Preprocessor):
pyplot.show()
ldms = numpy.array(ldms)
mask_points, mask = kp66_to_mask(frame, ldms, self.indent, self.debug)
#mask_points, mask = kp66_to_mask(frame, ldms, self.indent, self.debug)
mask_points, mask = kp66_to_mask(frame, ldms, self.indent, False)
#XXX : be sure that the 3 colors are returned !!
face_color[i] = compute_average_colors_mask(frame, mask, self.debug)
#face_color[i] = compute_average_colors_mask(frame, mask, self.debug)
face_color[i] = compute_average_colors_mask(frame, mask, False)
logger.debug("Face color in frame {} = {}".format(i, face_color[i])
previous_ldms = ldms
counter += 1
......
......@@ -130,7 +130,7 @@ class PPGSecure(Preprocessor):
# get the mask and the green value in the different ROIs
masks = self._get_masks(frame, ldms)
for k in range(5):
green_mean[i, k] = compute_average_colors_mask(frame, masks[k], self.debug)
green_mean[i, k] = compute_average_colors_mask(frame, masks[k], self.debug)[1]
previous_ldms = ldms
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment