Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android heart rate monitor code explanation [closed]

I found this code online for a heart rate monitor and I'm planning to use it as part of my project. I'm, however, having trouble understanding most part of the code as I'm new to Android. I am currently attending a course on Android but it's still in the basics and I have a deadline for the project. I would, hence, appreciate a proper explanation regarding the working of this code (explanation for the java files in the src folder would suffice). Thanks.

Link for code - https://github.com/phishman3579/android-heart-rate-monitor

like image 835
Sidd Avatar asked Dec 15 '22 17:12

Sidd


1 Answers

I took this code also for merging heart rate monitor in my application and can contribute with the following explanation:
There are 3 main parts in the project:
Part 1, HeartbeatView: It extends View and contains the small android icon on top that changes color between green and red (the color is updated from HeartRateMonitor class once the color tendency changes). This class and its usage can be removed and has no impact on the heart monitor process.
Part 2, HeartRateMonitor: The activity that does all the work... Occupies the camera and flash light. Calls the camera's startPreview() to start receiving frames (snapshots) from the camera (see onPreviewFrame()). The frames are sent for analyzing and decoding (see the 3rd part below) in order to measure the amount of red and its direction (getting lighter or darker red).
Part 3, ImageProcessing: The class has 2 functions that decode the frame and returns the amount of red from the given frame data.

Hope it helps... enjoy :)

like image 65
Yefi Damti Avatar answered Dec 30 '22 17:12

Yefi Damti