determining spo2 level and heartbeat using phone … · algorithm, the setup consists of a standard...

12
DETERMINING SPO2 LEVEL AND HEARTBEAT USING PHONE CAMERA D.Surya Chandra Babu 1 , S.V.S. Prasad 2 , Thottempudi pardhu 3 1,2,3 Dept.ECE, MLR Institute of Technology, Hyderabad. 1 [email protected], 2 [email protected], 3 [email protected] June 12, 2018 Abstract In this paper, we use a mobile phones camerato estimate the heart rate of a person and his/her blood spo2 level, based on its ability to record and detect variations in color signals of a fingertip placed in contact with its optical sensor. The accuracy of this application is confirmed by comparing its results to that of standard pulse oximeter available in the market. Keywords :blood oxygen, mobile camera, heart beat, spo2. 1 INTRODUCTION Oxygen saturation is defined as the ratio of oxyhaemoglobin to the total concentration of haemoglobin present in the blood (i.e. Oxyhaemoglobin + reduced haemoglobin). Haemoglobin is an essential component of blood, because of the low solubility of oxygen in it. Molecules of oxygen bind to the 1 International Journal of Pure and Applied Mathematics Volume 120 No. 6 2018, 3487-3497 ISSN: 1314-3395 (on-line version) url: http://www.acadpubl.eu/hub/ Special Issue http://www.acadpubl.eu/hub/ 3487

Upload: others

Post on 09-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DETERMINING SPO2 LEVEL AND HEARTBEAT USING PHONE … · algorithm, the setup consists of a standard smartphone running Android 4.0.2 (Ice Cream Sandwich), API Level 14. \The device

DETERMINING SPO2 LEVEL ANDHEARTBEAT USING PHONE

CAMERA

D.Surya Chandra Babu1, S.V.S. Prasad2,Thottempudi pardhu3

1,2,3Dept.ECE, MLR Institute of Technology,Hyderabad.

[email protected],[email protected],

[email protected]

June 12, 2018

Abstract

In this paper, we use a mobile phones camerato estimatethe heart rate of a person and his/her blood spo2 level,based on its ability to record and detect variations in colorsignals of a fingertip placed in contact with its optical sensor.The accuracy of this application is confirmed by comparingits results to that of standard pulse oximeter available inthe market.

Keywords:blood oxygen, mobile camera, heart beat,spo2.

1 INTRODUCTION

Oxygen saturation is defined as the ratio of oxyhaemoglobin tothe total concentration of haemoglobin present in the blood (i.e.Oxyhaemoglobin + reduced haemoglobin).

Haemoglobin is an essential component of blood, because ofthe low solubility of oxygen in it. Molecules of oxygen bind to the

1

International Journal of Pure and Applied MathematicsVolume 120 No. 6 2018, 3487-3497ISSN: 1314-3395 (on-line version)url: http://www.acadpubl.eu/hub/Special Issue http://www.acadpubl.eu/hub/

3487

Page 2: DETERMINING SPO2 LEVEL AND HEARTBEAT USING PHONE … · algorithm, the setup consists of a standard smartphone running Android 4.0.2 (Ice Cream Sandwich), API Level 14. \The device

haemoglobin, hence the ratio of oxygenated haemoglobin(HbO2)to the total haemoglobin concentration is important, and is calledthe Sp02 level. “Hence, since Sp02 levels are a measure of physicalwell being there is a need for low-cost physiological monitoringsolutions that are easy to use, accurate, and can be used in thehome or ambulatory settings”. “Smart phones are becoming morepopular, more powerful and have a variety of sensors available tocapture information from the outside world, process the data inreal-time, and transfer information remotely using wirelesscommunications”. “Extensive research has been conducted tomonitor various physiological parameters without any need ofadditional hardware”. “These factors make smart phones an idealchoice and their potential has been explored for many medicaltelemonitoring applications”.

“Optical video monitoring of the skin with a digital camera andan external flashlight contains information related to the subtlecolor changes caused by cardiac signal as the blood flows in andout”. “The rate at which this colour change occurs can be usedto determine heart rate of the person”. Numerous applicationsexist on the Android market to calculate heart rate through opticalrecordings. “But none of them manage to extract the spO2 levelof the flowing blood. Normal blood oxygen levels are consideredto lie in the range of 95-99”. If the level is below 90 percent, itis considered low, resulting in conditions like hypoxemia. “Bloodoxygen levels below 80 Percent may compromise organ function,such as the brain and heart, and should be promptly addressed”.

2 PULSE OXIMETRY

Pulse oximetry is a method used to measure the concen- tration ofoxygenated haemoglobin in the blood. A small device that clips tothe body (typically a finger),called a pulse oximeter, uses twodifferent wavelength of lights to estimate the oxygenatedhaemoglobin in the blood. Infrared and red light are passedthrough the finger and light which is not absorbed by the tissue ismeasured by a photo detector. This method exploits the fact thatdeoxy- haemoglobin (Hb) has a higher optical extinction in thered region of the light spectrum around 660 nm compared to

2

International Journal of Pure and Applied Mathematics Special Issue

3488

Page 3: DETERMINING SPO2 LEVEL AND HEARTBEAT USING PHONE … · algorithm, the setup consists of a standard smartphone running Android 4.0.2 (Ice Cream Sandwich), API Level 14. \The device

oxyhaemoglobin (HbO2). Light passing through tissue containingblood is absorbed by tissue as well as arterial, cap- illary, andvenous blood. Usually only the arterial blood is pulsatile,however. Light absorption may therefore be split into a pulsatilecomponent (AC) and a constant or nonpulsatile component (DC).The main challenge is to implement the same algorithm usingonly a smart phone.

3 IMPLEMENTATION OF

ALGORITHM

The standard way of calculating the Sp2 level in the blood is tolook for the amount of absorption of different frequencies in whitelight by blood passing though a finger. Normally, it has been seenoxygenated haemoglobin absorbs more infra red light whereasdeoxygenated haemoglobin absorbs more red light. Normally, forcomparison, red and infrared lights are chosen. In this case, wehave chosen blue light as a substitute for infra red light becauseresults obtained with this colour seemed to emulate thoseobtained with infra-red light. Once the white light passes througha finger, its is received by the camera lens of a Smartphone whichcan dif- ferentiate the recognized blue and red components. Nowfor each frame that is received, there is a DC part and a AC partof the blue and red components. The DC part (represented hereby the mean of the colour) reflects the constant factors, like thedepth of the tissue light passes through. On the other hand, theAC part (represented here by the standard deviation of thecolours reflecting the dif- ferences in absorption). “The DC andAC parts can be used to calculate the spo2 level in the blood asgiven by the formula”:

SPO2 =AB(ACRED/DCRED)

ACBLUE/DCBLUE)(1)

Where A and B are parameters that need to be obtained byfitting the obtained Spo2 graph with that obtained by a standardpulse oximeter. In this case A and B have been taken to be 100and 5 respectively, after matching the obtained graph with astandard oximeter result graph. For the implementation of this

3

International Journal of Pure and Applied Mathematics Special Issue

3489

Page 4: DETERMINING SPO2 LEVEL AND HEARTBEAT USING PHONE … · algorithm, the setup consists of a standard smartphone running Android 4.0.2 (Ice Cream Sandwich), API Level 14. \The device

algorithm, the setup consists of a standard smartphone runningAndroid 4.0.2 (Ice Cream Sandwich), API Level 14. “The devicehas a 1Ghz processor and comes with a 5MP cam-era with flashand HD video recording capabilities”. “The code for theapplication was written in the Eclipse IDE for Java Developmentusing the ADT (Android Developer Tools) plug-in with a targetAPI Level of 10”. The permissions required by the app includeaccess to the phones camera namely ANDROID.PERMISSION.CAMERA.

3.1 First Step

“The first step of the algorithm involves the recording of a smallvideo clip of around 20 seconds”. “This much time is needed forthe values obtained to stabilize. The user interface included in thephone makes it easy for the user to do so. The user has to keephis index finger on the lens (pal- mar side away from the lens) forthe duration the video is to be recorded. For this particularimplementation of the algorithm to work, white light has to passthrough the finger and then be received by the phones cameralens. This can be achieved by having a small source of white light(a different phones flash or a torch with a white LED)”. “Afterplacing the finger on the lens, the user has to make sure that theimage produced on the screen is sufficiently bright and has a goodamount of red colour. He should then press the Start button tostart recording the clip. In subsequent updates to this app, wellbe including a mechanism to check the previews image qualityand other parameters before allowing the user to record the clip”.

3.2 Second Step

“When the user has finished recording the video, he can press theStop button. The pressing of this button stores the recorded videoin the smart-phones memory card. Once this happens, a newactivity is launched in the app”. “The class associated with thisactivity reads the recorded video from external storage. Once thisis done, it extracts the first 600 frames from the clip(corresponding to around 20 seconds of video)”.

4

International Journal of Pure and Applied Mathematics Special Issue

3490

Page 5: DETERMINING SPO2 LEVEL AND HEARTBEAT USING PHONE … · algorithm, the setup consists of a standard smartphone running Android 4.0.2 (Ice Cream Sandwich), API Level 14. \The device

3.3 Third Step

“After the extraction of the first 600 frames of the clip, they areparsed into a Bitmap Image Holder where they were processedone by one. Each frame is resized to 320X240 pixels for reducedcomputa- tion time. For each bitmap frame (hereafter referred toas image), the red, blue and green parts are ex- tracted. Thefollowing parameters were calculated for each image: mean of redcolor component, mean of blue color component, standarddeviation of red color component and the standard deviation ofblue color component. While these parameters are beingcalculated, a progress box is shown which indicates whatpercentage of computation is complete. Then according theformula mentioned above, the ratio is calculated. Since the valuesof a and b were unknown, they were decided upon after fitting thegraph obtained in a few test cases to the graph obtained in astandard spo2 machine. Thereafter, after the value of spo2 iscalculated for all the frames, the values are stored in an array anda graph is plotted using tools included in a standard library forplotting line graphs that was found on net called GraphView6”.“The calculated average SpO2 value of all the 600 frames is thendisplayed on a standard label holder. The average value obtainedfrom Spo2 graph is saved for further use”.

4 HEARTBEAT CALCULATION

Once this is complete, another activity is launched which isformatted in the form of a questionnaire. It asks the user for hisage, sex and approximate fitness level. Based on variousparameters the user enters, and using data available for standardheart beat rates, an ideal heart rate is decided upon for a personsatisfying the users profile. Following this, a new activity islaunched which provides a mechanism for calculating theheartbeat of the user. This is similar to the to first activitywherein spo2 in calculated however, this activity providesreal-time data of the heartbeat until stability is achieved. Once astable heartbeat is obtained, deviations are found between theideal heartbeat rate and the calculated one. The data for idealheart rate was collected from numerous medical research [7]

5

International Journal of Pure and Applied Mathematics Special Issue

3491

Page 6: DETERMINING SPO2 LEVEL AND HEARTBEAT USING PHONE … · algorithm, the setup consists of a standard smartphone running Android 4.0.2 (Ice Cream Sandwich), API Level 14. \The device

conducted across the globe.

5 FINAL STEP

“When all the required parameters have been furnished, thefollowing suggested actions are shown to the user: 1. Spo2calculated between 96 and 99 and calculated heart rate within+-15 of the ideal heart rate Result: Healthy 2. Spo2 calculated 95and calculated heart rate within +-15 of the ideal heart rateResult: The user should try again, if values persist, he shouldcross check his values with standard equipment 3. Spo2 calculatedbetween 96 and 99 and calculated heart rate outside +-15 of theideal heart rate Case: The user should try again, if values persist,he should cross check his values with standard equipment. Somescreen shots of the app are shown in figure 1-4. Flow diagram ofthe algorithm used in this app is shown in Figure 4”.

6 RESULTS

6

International Journal of Pure and Applied Mathematics Special Issue

3492

Page 7: DETERMINING SPO2 LEVEL AND HEARTBEAT USING PHONE … · algorithm, the setup consists of a standard smartphone running Android 4.0.2 (Ice Cream Sandwich), API Level 14. \The device

Figure 1: Default app interface

7

International Journal of Pure and Applied Mathematics Special Issue

3493

Page 8: DETERMINING SPO2 LEVEL AND HEARTBEAT USING PHONE … · algorithm, the setup consists of a standard smartphone running Android 4.0.2 (Ice Cream Sandwich), API Level 14. \The device

7 FUTURE WORK

“Work is being done to incorporate other factors to calculate idealheart rates. Also, low Spo2 can be linked to a number of differentheart defects, for instance, anemia. We are hoping to add somefeatures to the app to create a early warning system to this effect”.

Figure 2: User Questionnaire

8

International Journal of Pure and Applied Mathematics Special Issue

3494

Page 9: DETERMINING SPO2 LEVEL AND HEARTBEAT USING PHONE … · algorithm, the setup consists of a standard smartphone running Android 4.0.2 (Ice Cream Sandwich), API Level 14. \The device

Figure 3: Real time heartbeat graph

Figure 4: Flow chart

9

International Journal of Pure and Applied Mathematics Special Issue

3495

Page 10: DETERMINING SPO2 LEVEL AND HEARTBEAT USING PHONE … · algorithm, the setup consists of a standard smartphone running Android 4.0.2 (Ice Cream Sandwich), API Level 14. \The device

References

[1] Christopher G. Scully,Jinseok Lee, Joseph Meyer,Alexander M. GorbachDomhnull Granquist-Fraser,YitzhakMendelson,KiH.Chon “Physiological ParameterMonitoring from Optical Recordings With a Mobile Phonein IEEE Transactions on BioMedical Engineering”, Vol. 59,No.2, February 2012.

[2] E.Jonathan and M.J.Leahy, Cellular phone-basedphotoplethysmographic imaging, J. Biophotonics, vol. 4,no. 5, pp. 293296, 2011.

[3] Instant Heart Rate, Azumio Inc., 2011.

[4] SangeetaBagha,Laxmi Shaw “A Real Time Analysis of PPGSignal for Measurement of SpO2 and Pulse Rate”InternationalJournal of Computer Applications (0975 8887) Volume 36No.11, December 2011.

[5] M.-Z. Poh, D. J. McDuff, and R. W. Picard, Non-contact,automated cardiac pulse measurements using video imagingand blind source separation, Opt. Express, vol.18, no. 10,pp.1076210774,2010.

[6] GraphView: library for Android to program-matically create flexible and nice-looking diagramshttp://www.jjoe64.com/p/graphview-library.html

[7] Martin Brandfonbrener, MiltonLandowne, Nathan W Shock“Changes in cardiac output with age” Circulation, theJournal of the American Heart Association, 1955;12:557-566,doi:10.1161/01.CIR.12.4.557

10

International Journal of Pure and Applied Mathematics Special Issue

3496

Page 11: DETERMINING SPO2 LEVEL AND HEARTBEAT USING PHONE … · algorithm, the setup consists of a standard smartphone running Android 4.0.2 (Ice Cream Sandwich), API Level 14. \The device

3497

Page 12: DETERMINING SPO2 LEVEL AND HEARTBEAT USING PHONE … · algorithm, the setup consists of a standard smartphone running Android 4.0.2 (Ice Cream Sandwich), API Level 14. \The device

3498