Weeks 2 and 3: All GUI’d up

MAKING A GUI IS HARD!

I was away last week but was still working on Python. This week I managed to get a graphical user interface working that showed both the output from the camera as a signal but also from a pulse sensor as well.

Here is my short script to actually measure the frame rate of the webcam. My Macbook Air does 30 fps which is very common.

I spend the majority of the week learning to work with GUI elements in Python. This means windows, buttons, images, and general stuff where a program runs in a window instead of in the terminal. I had to learn how to add plots, and scale, and “listen” for events like a mouse click. In Python this is called signals and having a python program act on a signal is done with a slot. You create a program component (a function) to respond when a signal is given.

Here is an animated GIF showing a comparison of the signals from the camera versus a finger pulse sensor. The top window is the raw camera feed. Note my finger is covering the camera fully here. I have yet to get the peak detection to work very well.

First iteration: got the camera signal and image to display in a GUI.

Second iteration: got the camera signal and the

I also added Butterworth bandpass filtering to the signal which seems to need my signal to noise ratio to improve. And I am using HeartPy to find the peaks in the signal. Both processes worked to some degree but the whole system is so environment dependent that I can’t say it is in beta… more like alpha version. But progress is progress.

I also wrote code to save the streams of data as CSV files which can be processed as a whole after the fact.

I want to add some other stuff to the GUI like buttons to start and stop and the readings from the pulse sensor and the camera. Plus signal analysis using a fast Fourier transform is going to be hard.

 

Leave a Reply

Your email address will not be published. Required fields are marked *