E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author...
Transcript of E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author...
![Page 1: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/1.jpg)
E0-245: ASP
Lecture 19: Multimedia and Android Components
Dipanjan Gope
![Page 2: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/2.jpg)
2
Dipanjan Gope
• Location Sensors - Theory of location sensing
- Package android.location
• Physical Sensors - Sensor Manager
- Accelerometer
- Gyroscope
- Magnetometer
- Sensor fusion
• NFC
• Multimedia - Camera
- Microphone
Module 2: Android Sensor Applications
![Page 3: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/3.jpg)
3
Dipanjan Gope
Activity
Views
Intent
ContentProvider
BroadcastReceiver
Service
Coverage
![Page 4: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/4.jpg)
4
Dipanjan Gope
• Greg Milette, Adam Stroud: Professional Android Sensor Programing, 2012, Wiley India
• Reto Meier: Professional Android 4 application development. John Wiley & Sons, 2012.
References
![Page 5: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/5.jpg)
5
Dipanjan Gope
Content Provider
https://bestandroidtraining.wordpress.com/2013/03/30/android-project-structure/
![Page 6: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/6.jpg)
6
Dipanjan Gope
android.database.sqlite
class SQLiteDatabase - insert - query - delete
- ….
abstract class SQLiteOpenHelper - onCreate
- onUpgrade
class ContentValues class Cursor
![Page 7: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/7.jpg)
7
Dipanjan Gope
Quick Guide Database Usage
-http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/
![Page 8: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/8.jpg)
8
Dipanjan Gope
Step 0: Database content
….
![Page 9: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/9.jpg)
9
Dipanjan Gope
Step 1: Schema and SQLiteOpenHelper
![Page 10: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/10.jpg)
10
Dipanjan Gope
Step 2: Add to DB
![Page 11: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/11.jpg)
11
Dipanjan Gope
Step 3: Read from DB
![Page 12: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/12.jpg)
12
Dipanjan Gope
Step 4: Update DB
![Page 13: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/13.jpg)
13
Dipanjan Gope
Step 5: Delete DB
![Page 14: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/14.jpg)
14
Dipanjan Gope
DB Flow
![Page 15: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/15.jpg)
15
Dipanjan Gope
• Wrapper over DB for decoupling data and UI apps
ContentProvider
Interface ContentProvider:
![Page 16: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/16.jpg)
16
Dipanjan Gope
• Design DB, schemas, URIs
• Extend ContentProvider
• Implement interface functions
• Register in manifest
Steps: ContentProvider
![Page 17: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/17.jpg)
17
Dipanjan Gope
ContentProvider: Demo
![Page 18: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/18.jpg)
18
Dipanjan Gope
• Permissions .. Permissions .. Permissions
• Same query
Usage From Another App
![Page 19: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/19.jpg)
19
Dipanjan Gope
Permissions: CP Creator App
1
2
3
![Page 20: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/20.jpg)
20
Dipanjan Gope
Permissions: CP Access App
1
2
![Page 21: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/21.jpg)
21
Dipanjan Gope
Native Android Content Providers
Media Store
Browser
Contacts
Calendar
Call Log
![Page 22: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/22.jpg)
22
Dipanjan Gope
• Application continues to run when UI is invisible
• Has higher priority than inactive Activities - lesser chance of getting killed when system requires resources
• Can be configured to restart when resources are re-available
• Service priority can be raised to foreground Activity
Service
![Page 23: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/23.jpg)
23
Dipanjan Gope
Service
http://developer.android.com/guide/components/services.html
![Page 24: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/24.jpg)
24
Dipanjan Gope
Service Class
Ref: [2]
![Page 25: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/25.jpg)
25
Dipanjan Gope
Start/Stop a Service
Ref: [2]
![Page 26: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/26.jpg)
26
Dipanjan Gope
Multimedia
![Page 27: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/27.jpg)
27
Dipanjan Gope
• Camera - photos and videos
- other applications: barcode, face recognition, pulse rate detection
• Microphone - record audio
- other applications: Text-to-speech, voice activation
• Speaker - play audio
- other applications: audiogram
Multimedia: Components
![Page 28: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/28.jpg)
28
Dipanjan Gope
Audio: Speaker
![Page 29: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/29.jpg)
29
Dipanjan Gope
Speaker Application: Audiogram
![Page 30: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/30.jpg)
30
Dipanjan Gope
Audio: Microphone
![Page 31: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/31.jpg)
31
Dipanjan Gope
Heart Sounds: Phonocardiography
After basic Noise Filtering
Recorded Heart Sound:
S1 S2
Mobile Phone Sensor: Microphone
![Page 32: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/32.jpg)
32
Dipanjan Gope
Heart Rate Detection
0 0.5 1 1.5 2 2.5
x 105
-0.5
0
0.5
0 0.5 1 1.5 2 2.5
x 105
0
0.005
0.01
0 20 40 60 80 100 120 140 160 180 2000
200
400
80.7495 Hz
![Page 33: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/33.jpg)
33
Dipanjan Gope
Heart Sounds: Phonocardiography
S3
S4
Healthy Heart Sound
Third Heart Sound
Fourth Heart Sound
Mp3 from Littmann Heart Sounds
![Page 34: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/34.jpg)
34
Dipanjan Gope
Video/Image: Camera
Ref: [2]
![Page 35: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/35.jpg)
35
Pulse Detection from Mobile Phone
Video Recording Face Recognition RGB Components
ICA Analysis FFT Pulse From Spectrum
Pre-processing - Detrend - Zscore
Post-processing - Smooth - Bandpass Filter - Spline
M.Z. Poh, D.J. McDuff, R.W. Picard, Opt Express. 18(10) pp. 10762–10774, 2010.
![Page 36: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/36.jpg)
36
Pulse Detection from Mobile Phone
(a) RGB components extracted from 1280x720 resolution video capture from a Samsung Galaxy S3 mobile phone at 30 frames per second over a period of 30 seconds. (b) The FFT of (a) lacks prominent peaks in spectrum. (c) The 3 components extracted from the RGB traces using JADE ICA analysis algorithm (d) The FFT of (c) contains distinct peaks in the spectrum from which pulse-rate is obtained
![Page 37: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/37.jpg)
37
Accuracy Worsens With Distance
0.4 0.6 0.8 1 1.2 1.4 1.6 1.8
x 104
-2.5
-2
-1.5
-1
-0.5
0
0.5
Total Pixel Size of Detected Face
log
10
(Err
or)
WebCam Results
MTLB_dtrnd_schm1
MTLB_dtrnd_schm2
MTLB_dtrnd_schm3
TRVN_dtrnd_schm1
TRVN_dtrnd_schm2
TRVN_dtrnd_schm3
![Page 38: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/38.jpg)
38
Dipanjan Gope
Activity
Views
Intent
ContentProvider
BroadcastReceiver
Service
Coverage
![Page 39: E0-245: ASPdipanjan/E0_245/E0245-ASP...- Codes or apk file Title PowerPoint Presentation Author Dipanjan Gope Created Date 4/8/2015 11:15:41 AM ...](https://reader033.fdocuments.in/reader033/viewer/2022060707/6072b9d81e13c9448448f171/html5/thumbnails/39.jpg)
39
Dates
• Final Exam: 30th April 10-1pm
• Final Project submission: same day
- Codes or apk file