All posts by gaj4

Math can do amazing things

This week, I focused on trying to clean up the signal from the webcam in order to get a clean reading of pulse rate.

This involved including Fast Fourier Transform (FFT) coding into my python code.

Te results were very clean for trials using a finger directly over a webcam as seen below

By the end of the week, I could pick up the pulse from a section of my forehead using the webcam, but the signal has a lot of noise around it.

Week 3 – I found a pulse

It was another long week of programming.  As with any programming experience, it has its ups and downs.   By the end of the week, I was able to track a pulse through the camera using a finger with a phone light behind it.  The signal is still very noisy and I have been trying (not successfully) to run a filter on the data to clean it up.

As you can see below, the signal allows me to get the photoplesmogram (ppg) .  From this i can calculate the time between beats and then generate the pulse rate.

Paths-UP Weeks 1 – OMG, I need to Program?

Hangin’ with my new friends!

It’s been a bust first week in Paths-UP.  First getting oriented into the program and determining our overall goal.  Then working on obtaining the necessary programming skills to perform the upcoming work

At the start, we met our Mentor Yong who is now like a shepherd with 6 blind sheep.

We got to take a tour of the scalable health lab and see some of the research going on there.  We then started reading some papers as a group.  Suddenly we are trying to understand what a photoplesmogram (PPG) is and how to use them.

So, a PPG is a time based plot of the absorption of light at a certain place (in the case of our work – a region of the face).  The concept is that when there is higher blood volume in that particular region, more light will by absorbed by the blood and the signal to our camera will decrease.  We can track the changes in the intensity of light to generate the PPG.  The PPG then can be interpreted to track things such as Pulse Rate and Pulse Rate Variability which are indicators of general health.

The value of PPG is it is non-contact way of collecting vital data.  It can hopefully be used through simple web-cams and camera phones with no additional hard-ware at the test subjects site.

However, there are some major difficulties to overcome:

  1. Camera technology has difficulty recognizing in darker skin
  2. Changes in lighting during capture
  3. Motion of the subject

Currently we are working on the basics.  We are trying to get the base facial recognition software up and running on our computers.

In order to prepare for the intense coding part of this project, I spent much of the week first reviewing the Python: Absolute Beginner course from EdX and then completing the certification thru the Python: Fundamentals course.  I can now write simple code as seen below, but more importantly, can start to understand more complex code.

Is that your FACE?

Is that your FACE?

June 24th, 2019 by gaj4

A long week of programming.

Beginning of the week was spent working to get haarcascades to work.  As is standard with programming, it’s silly things that slow you down.  While working on my program, it seemed that everything was fine.  The program ran and the video was being generated, however, it would not pick up faces or facial features.  I spent several hours trying changes and looking for solutions.  After getting frustrated, I finally decided to move outside to take advantage of the nice weather.  I started up my program and it picked up my face and eyes.  It was all about the lighting.  When I moved back inside, I flipped the orientation of the venetian blinds behind me, and BANG!, the program worked inside.

Next, it was time to work on thresholding and color recognition.

Finally, after working through various versions of thresholding and then applying some color filtering, I managed to be able to select for basic colors using thresholding and masking techniques.  The next step was to be able to isolate an object  and track its motion.

Through a series of searches on the web, I managed to find some very useful functions available in Open CV:  cv2.findContours(), cv2.contaouArea(), and cv2.minAreaRect().  These allowed me to find the outline of objects in the selected color range, take the area of the contour (this allows for sorting to find the largest object), and then draw the smallest possible rectangle that completely encloses the object.  A little help from Yong (who provided some slider code to help with color selection in the program) and I finally got the code to work as demonstrated in the attached video.

By adjusting the color sliders, it is possible to get the program on skin tone.  You can adjust the skin tone through the sliders to make it adaptable to different skin colors.

Face Track