Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question #1

Open
GoogleCodeExporter opened this issue Jan 21, 2016 · 42 comments
Open

Question #1

GoogleCodeExporter opened this issue Jan 21, 2016 · 42 comments

Comments

@GoogleCodeExporter
Copy link

could you please tell me what is the algorithm you have used for smoothing the 
red pixels signal ? 


Original issue reported on code.google.com by hasansha...@gmail.com on 5 May 2012 at 10:47

@GoogleCodeExporter
Copy link
Author

It's essentially a rolling median of the last 4 images. You'll see a big jump 
to the peak value when the heart beats.

Original comment by phishman3579@gmail.com on 21 May 2012 at 10:58

  • Added labels: Type-Other
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Author

and why did you choose the last 4 images ? if i make it six for example what 
would be the influence on changing number of images?

Original comment by hasansha...@gmail.com on 12 Jun 2012 at 1:07

@GoogleCodeExporter
Copy link
Author

Nothing scientific about the number 4, it seemed to work best in my testing. 
The larger the number the.more likely you'll include both peak and trough of 
the heart beat in the average which is not desirable.

Original comment by phishman3579@gmail.com on 8 Jul 2012 at 1:51

@GoogleCodeExporter
Copy link
Author

Issue 3 has been merged into this issue.

Original comment by phishman3579@gmail.com on 8 Jul 2012 at 1:52

@GoogleCodeExporter
Copy link
Author

Can you give me more information about the algorithm that u use in it ?
cause i want to make a graduation project like a ( heart monitor )

Original comment by newm2...@gmail.com on 31 Aug 2012 at 4:31

@GoogleCodeExporter
Copy link
Author

Take a look at the code in HeartRateMonitor.java specifically the 
onPreviewFrame() method.

Original comment by phishman3579@gmail.com on 31 Aug 2012 at 7:05

@GoogleCodeExporter
Copy link
Author

Thanks alot man
i will look at the code
the algorithm  is tough...

Original comment by newm2...@gmail.com on 31 Aug 2012 at 8:05

@GoogleCodeExporter
Copy link
Author

hmmmm
cant understand why we using that 
the array dosent have any values right !!!
int averageArrayAvg=0;
                        int averageArrayCnt=0;
                        for (int i=0; i<averageArray.length; i++) {
                                if (averageArray[i]>0) {
                                        averageArrayAvg += averageArray[i];
                                        averageArrayCnt++;
                                }
                        }

Original comment by the.ghos...@gmail.com on 3 Oct 2012 at 10:28

@GoogleCodeExporter
Copy link
Author

averageArray is updated each time you go through the code keeping the 4 latest 
averages.

Initially:
averageArray[0] = 0
averageArray[1] = 0
averageArray[2] = 0
averageArray[3] = 0
averageArray[4] = 0

First time through, let's say the average is 68
averageArray[0] = 68
averageArray[1] = 0
averageArray[2] = 0
averageArray[3] = 0
averageArray[4] = 0

Second time through, let's say the average is 72
averageArray[0] = 68
averageArray[1] = 72
averageArray[2] = 0
averageArray[3] = 0
averageArray[4] = 0

Second time through, average is 65
averageArray[0] = 68
averageArray[1] = 72
averageArray[2] = 65
averageArray[3] = 0
averageArray[4] = 0

Third time through, the average is 71
averageArray[0] = 68
averageArray[1] = 72
averageArray[2] = 65
averageArray[3] = 71
averageArray[4] = 0

Fourth time through, the average is 67
averageArray[0] = 68
averageArray[1] = 72
averageArray[2] = 65
averageArray[3] = 71
averageArray[4] = 67

Fifth time through; the average is 69, so I use the zero-th index.
averageArray[0] = 69
averageArray[1] = 72
averageArray[2] = 65
averageArray[3] = 71
averageArray[4] = 67

Original comment by phishman3579@gmail.com on 4 Oct 2012 at 1:46

@GoogleCodeExporter
Copy link
Author

i  got it 
thank u so much phishman

Original comment by the.ghos...@gmail.com on 4 Oct 2012 at 1:56

@GoogleCodeExporter
Copy link
Author

hi,how are you can you tell me why you are using 
greenBitmap = BitmapFactory.decodeResource(getResources(), 
R.drawable.green_icon);
        redBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.red_icon);
    green_icon and red_icon ,also can you provide me with this icon because they are not found in source code ,,all thanks to you 

Original comment by eng.moh_...@hotmail.com on 9 Oct 2012 at 2:05

@GoogleCodeExporter
Copy link
Author

They are located in res/drawable-mdpi folder of the source code.

http://code.google.com/p/android-heart-rate-monitor/source/browse/#svn%2Ftrunk%2
Fres%2Fdrawable-mdpi

Original comment by phishman3579@gmail.com on 9 Oct 2012 at 2:08

@GoogleCodeExporter
Copy link
Author

Thanks very much,but can you tell me whats the benefits for using this images 
in app 

Original comment by eng.moh_...@hotmail.com on 9 Oct 2012 at 5:52

@GoogleCodeExporter
Copy link
Author

They are used to visually show the user when a heart beat happens. If you run 
the App on a phone, it's the small rectangle that changes from green to red and 
vice versa.

Original comment by phishman3579@gmail.com on 9 Oct 2012 at 10:28

@GoogleCodeExporter
Copy link
Author

Original comment by phishman3579@gmail.com on 28 Apr 2013 at 12:12

@GoogleCodeExporter
Copy link
Author

Could you please explain how you detect the beat? (Theoretical side) Thank you.

Original comment by hisham....@gmail.com on 8 May 2013 at 1:15

@GoogleCodeExporter
Copy link
Author

Basically, you want to use the camera to with as little focus as possible. So, 
if you put your finger on the lens, it'll be confused and not be able to focus. 
Because it isn't focused you'll essentially have very coarse data picking up 
only shades of light and dark RGB. I look at the a single channel (red) and try 
to detect when it goes from light red to dark red.

Original comment by phishman3579@gmail.com on 9 May 2013 at 12:02

@GoogleCodeExporter
Copy link
Author

I can't understand the image processing steps. could you please explain that 
for me?

Original comment by rajishma...@gmail.com on 8 Jun 2013 at 10:43

@GoogleCodeExporter
Copy link
Author

I was wondering how can I extract the green values instead of the red values. 
In some papers that I have been reading, they say that the green values have 
less noise than any other color. Thus, I would like to give it a shot with the 
green color. 

In the "imageProcessing.java", in the decodeYUV420SPtoRedSum() method, there is 
this line of code:
                int red = (pixel >> 16) & 0xff;
I suppose this extracts the red value.
How can I extract the green value?

Original comment by PhedonRo...@gmail.com on 12 Jun 2013 at 6:21

@GoogleCodeExporter
Copy link
Author

You can try:
int green = (pixel >>  8) & 0xff;

Original comment by phishman3579@gmail.com on 16 Jun 2013 at 2:39

@GoogleCodeExporter
Copy link
Author

How can I detect whether the user's finger is placed on the camera or not? Can 
I somehow know that? FOr example, if the average of the red pixels are not 
greater than a specific number-threshold, then it means that the user's finger 
is not placed on the camera... Is it possible to do something like that or is 
there any easiest way? 
It would be a good addition to the project if we can do that.

Original comment by PhedonRo...@gmail.com on 1 Jul 2013 at 3:59

@GoogleCodeExporter
Copy link
Author

For anyone interested, I figured out how to detect whether the user has his 
finger placed on the camera or not. 
In the imageProcessing.java, in the decodeYUV420SPtoRedAvg() method, we 
calculate the average value of the pixels of the red color. DOing a small 
experiment, I found out that when the user has his finger placed on the camera 
lens, the average has a value of >200 . In other case, the average value is 
<200.  thus, in the HeartRateActivity you can add an if statement after the 
call of the decodeYUV420SPtoRedAvg(), to find wether the value returned is >200 
or < 199. You can use this to display an alert box or something similar to 
guide the user to place his finger on the camera lens.

Original comment by PhedonRo...@gmail.com on 7 Jul 2013 at 4:54

@GoogleCodeExporter
Copy link
Author

[deleted comment]

1 similar comment
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Hi , I have seen that the app works fine if the surrounding light is good , but 
in dim light it does not give correct output like other leading apps. 

Original comment by mo.exten...@gmail.com on 29 Aug 2013 at 1:26

@GoogleCodeExporter
Copy link
Author

[deleted comment]

1 similar comment
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

5 similar comments
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Can i make an Windows Phone 8.1 app of it?

Original comment by fmy...@gmail.com on 9 Oct 2014 at 3:08

@GoogleCodeExporter
Copy link
Author

I couldnt understand the concept of Image Processing used here.?
What is YUV420SP..? Is  it a video format.?

Original comment by anish.vi...@gmail.com on 7 Jan 2015 at 2:25

@GoogleCodeExporter
Copy link
Author

Suppose  an averageArray value is getting and like you said it's 69 or maybe 
any value.... It's for 10s .? Is it.? How we can convert it into minute.? Beats 
per minute

Original comment by anish.vi...@gmail.com on 7 Jan 2015 at 3:35

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Hi phishman, your application is working fine but can you please change 
algorithm, which can be like Heart rate(Google Play Store link : 
https://play.google.com/store/apps/details?id=si.modula.android.instantheartrate
). Your application retrieving each heart rate value every 10 seconds but Heart 
rate application is calculating average heart rate value with in 10 seconds. 
thanks in advance.

Original comment by nayaka.r...@gmail.com on 25 Jan 2015 at 6:27

@GoogleCodeExporter
Copy link
Author

nayaka.ravikumar,

The code is completely open sourced, feel free to fork the code and change
the algorithm to be whatever you'd like.

On Sun, Jan 25, 2015 at 1:27 PM, <android-heart-rate-monitor@googlecode.com>
wrote:

Original comment by phishman3579@gmail.com on 28 Jan 2015 at 12:46

@GoogleCodeExporter
Copy link
Author

anish.vilayil.s,

It's a simple change; look at like 172 here.. the reference to 10 is the
signal.
https://code.google.com/p/android-heart-rate-monitor/source/browse/src/com/jweth
erell/heart_rate_monitor/HeartRateMonitor.java#172

On Tue, Jan 6, 2015 at 10:35 PM, <android-heart-rate-monitor@googlecode.com>
wrote:

Original comment by phishman3579@gmail.com on 28 Jan 2015 at 12:49

@GoogleCodeExporter
Copy link
Author

Hello,
how to pick beatsAvg value and send it to dialog or fragment?, i've tried to 
call a dialog at the bottom of conditional field in if(totalTimeInSecs>=10) {}, 
but still no luck, 

Original comment by famaa...@gmail.com on 22 Feb 2015 at 4:37

@GoogleCodeExporter
Copy link
Author

can you send the algorithm for calcualating heart rate?

Original comment by ctspo...@gmail.com on 6 Apr 2015 at 9:26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant