microsoft powerpoint - android-2.ppt [compatibility mode]

24
Mobile image processing – Part 2 Mobile application development on Android Hello Worldproject Hello World project “Viewfinder EE368” project Image processing library Mobile application examples Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 1

Upload: peterbuck

Post on 04-Jul-2015

3.346 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Mobile image processing – Part 2

Mobile application development on Android“Hello World” projectHello World project“Viewfinder EE368” projectImage processing libraryg g yMobile application examples

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 1

Page 2: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Google GogglesProduct recognition

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 2

http://www.google.com/mobile/goggles

Page 3: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

How to download Google Goggles

Open the Android Market applicationSearch for “Google Goggles”Search for Google Goggles

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 3

Page 4: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Recognizing video at a glanceVisual bookmarks for movies and TV shows

(1) User snaps a photo of screen (3) User resumes video on the phone(1) User snaps a photo of screen. (3) User resumes video on the phone.

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 4

(2) Our system identifies video andframe within the video.

Page 5: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Recognizing video at a glanceVisual bookmarks for movies and TV shows

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 5

http://msw3.stanford.edu/~dchen/EE368/Video-Search-Android.wmv

Page 6: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Mobile devices versus personal computers

Feature Motorola DROID Typical PCScreen size 4.6 in x 2.4 in 25 in x 16 in

Processor speed 550 MHz 3.0 GHzRAM 256 MB 4 GBRAM 256 MB 4 GB

Disk space 133 MB internal8 GB external flash 500 GB disk

Internet access Typically 3GWiFi at hotspots WiFi or wired Ethernet

Telephony Core feature Supplementary featurep y pp y

Camera 5 MP camera embedded External webcam

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 6

Page 7: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

“Viewfinder EE368” project

Goals of this projectLearn how to access frames from the viewfinderLearn how to modify camera parametersLearn how to augment the viewfinder frames

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 7

Page 8: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Beginning the project

Download the tutorial from class pagehttp://ee368 stanford edu/Androidhttp://ee368.stanford.edu/Android

Create a new Android projectRecommended settingsg

Project Name: ViewfinderEE368Android 2.0.1Application Name: Viewfinder EE368Application Name: Viewfinder EE368Package Name: com.example.viewfinderee368Create Activity: ViewfinderEE368Min SDK Version: 6

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 8

Page 9: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Android manifest file (AndroidManifest.xml)

Landscape mode

Landscape mode

Main Activityy…

Set the proper hardware permissions

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 9

Page 10: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Class hierarchy

Viewfinder Manage two views andViewfinder EE368

(Activity)

Manage two views and manage program open/close

Draw onPreview(View)

Draw on Top

(View)

Handle incoming viewfinder frames and adjust camera

Augment viewfinder frames with a new layer of information

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 10

jparameters

yon top

Page 11: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Viewfinder class: full screen mode

Icon and title bars visible Icon and title bars hidden

Viewfinder EE368

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 11

Page 12: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Class hierarchy

Viewfinder Manage two views andViewfinder EE368

(Activity)

Manage two views and manager program open/close

Draw onPreview(View)

Draw on Top

(View)

Handle incoming viewfinder frames and adjust camera

Augment viewfinder frames with a new layer of information

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 12

jparameters

yon top

Page 13: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Timeline of events on the mobile device

N f N fNew frame New frame

CapturePreview CaptureCapture

Augment

Preview

DrawOnTop

Capture

Augment

TimeFrame Interval

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 13

Page 14: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Preview class: frames go down two paths

Preview frames Display on phone screen

Preview(View)

…phone screen

Forward to callback functioncallback function

…Data in YCbCr 4:2:0 format

width w

heig

ht h

w/2 w/2h/

2

h/2

Cb Cr

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 14

h Y

Page 15: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Preview class: set camera parameters

Preview(View)(View)

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 15

Page 16: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Class hierarchy

Viewfinder Manage two views andViewfinder EE368

(Activity)

Manage two views and manage program open/close

Draw onPreview(View)

Draw on Top

(View)

Handle incoming viewfinder frames and adjust camera

Augment viewfinder frames with a new layer of information

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 16

jparameters

yon top

Page 17: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

DrawOnTop class: create a paint brush

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 17

Page 18: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

DrawOnTop class: YCbCr to RGB

width w

t h

w/2 w/2

2 2

w

heig

ht h/2

h/2

YCb Cr

h

RGB

921.22225658.408

25608.298

−⋅

+⋅

=CrYR

58.13525612.208

25629.100

25608.298

256256

+⋅

−⋅

−⋅

=CrCbYG

84.27625641.516

25608.298

−⋅

+⋅

=CbYB

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 18

Page 19: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

DrawOnTop class: draw histogram bars

Bin 0 Bin 1 Bin 2 Bin 3 Bin 4

Rect rect = new Rect( left x, top y, right x, bottom y );Canvas.drawRect( rect );

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 19

Page 20: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Viewfinder EE368 demo

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 20

http://ee368.stanford.edu/Android/ViewfinderEE368

Page 21: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Real-time debugging using DDMS (1)

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 21

Page 22: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Real-time debugging using DDMS (2)

03EH368929E3K

DeviceFile system on device

Device

Messages on the devicethe device

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 22

Page 23: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Danger of unresponsiveness

Users notice delays longer than ~0.5 secAndroid only lets your program “hang” or “freeze” for ~5 secAndroid only lets your program hang or freeze for 5 sec before bringing up warning dialog

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 23

Page 24: Microsoft PowerPoint - Android-2.ppt [Compatibility Mode]

Activity life cycle

[ Professional Android Application Development ]

Bernd Girod, David Chen: EE368 Mobile Image Processing – Part 2 no. 24

[ Professional Android Application Development ]