41
Hacking Images on Windows Phone BUILDING WORLD'S MOST ADVANCED APPS Conducted By RAHAT YASIR ANINDO

Hacking images on windows phone

Embed Size (px)

DESCRIPTION

Hacking Images on Windows Phone; Building Worlds most Advanced apps

Citation preview

Page 1: Hacking images on windows phone

Hacking Images on Windows PhoneBUILDING WORLD'S MOST ADVANCED APPS

Conducted By RAHAT YASIR ANINDO

Page 2: Hacking images on windows phone

Overview Why Imaging app? Basic about Images Imaging app in Windows Phone Camera API’s of Windows Phone Imaging Filters Dual Capturing in Lumia 1020 Nokia Imaging SDK Sharing Imaging App Ideas

Page 3: Hacking images on windows phone

Imaging Apps are Every Where!

92%User take Photo or Video with their Smart Phone

Page 4: Hacking images on windows phone

Imaging Apps are Every Where!

49%User say Camera functionality is an important purchase factor

Page 5: Hacking images on windows phone

Imaging Apps are Every Where!

66%User take Photos or Videos with their Smart Phones weekly or more

Page 6: Hacking images on windows phone

Imaging Apps are Every Where!

78%User own a digital camera

Page 7: Hacking images on windows phone

Basic about Images

Image ! What is This?

Page 8: Hacking images on windows phone

Matrix Representation of an Image

8

1,11,10,1

1,10,10,1

1,01,00,0

)1,1()1,1()0,1(

)1,1()1,1()0,1()1,0()1,0()0,0(

),(

:image NAn

NMMM

N

N

aaa

aaaaaa

A

NMFMfMf

NfffNfff

yxf

M

Page 9: Hacking images on windows phone

Visual image formation-Digital Version

9

3D object

Digital Camera

Digitizer 2D Digital ImageCCD / CMOS

sensor Lens

Page 10: Hacking images on windows phone

Sampling and Quantization, 2D Case

10

Continuous Sampled

f(0,0) f(0,1)

f(N-1,M-1)

Page 11: Hacking images on windows phone

Image Sub-sampling-Gray 11

Page 12: Hacking images on windows phone

Image Re-sampling 12

Page 13: Hacking images on windows phone

Windows Phone Camera Basics

We can build a camera application that can capture still photos. We can query device camera capabilities (where there are multiple cameras on the

device (front and/or rear), where it has flash, etc.). We can get raw camera frames and process them ourselves (encode/decode). We can programmatically set flash and focus when taking a photo. We can change the resolution of the photo. We can continue using the hardware button for the camera shutter to capture a photo

and for auto-focus when taking shots outside our application. A camera need not be present (for example, front facing camera was not a part of the

original devices). Your application would need to handle that condition gracefully. To allow our application to have access to the camera capability, you need to specify

ID_CAP_ISV_CAMERA in our application manifest file. To allow our application to have access to a front facing camera (if one exists), we

need to specify ID_HW_FRONTCAMERA in our application manifest file.

Page 14: Hacking images on windows phone

Code to Capture images on Windows Phoneusing Microsoft.Phone.Tasks;using Microsoft.Phone;private CameraCaptureTask ccTask;public MainPage() { InitializeComponent(); ccTask = new CameraCaptureTask();}private void btnCamera_Click(object sender, RoutedEventArgs e) { ccTask.Show(); }

Page 15: Hacking images on windows phone

Code to Capture images on Windows Phone

using Microsoft.Devices;using Microsoft.Xna.Framework.Media;PhotoCamera myCamera;MediaLibrary mediaLibrary;public MainPage() { InitializeComponent(); mediaLibrary = new MediaLibrary();

}private void buttonStartCamera_Click(object sender, RoutedEventArgs e) { myCamera = new Microsoft.Devices.PhotoCamera(CameraType.Primary); myCamera.CaptureCompleted += new EventHandler<CameraOperationCompletedEventArgs>(camera_CaptureCompleted); myCamera.CaptureImageAvailable += new EventHandler<Microsoft.Devices.ContentReadyEventArgs>(camera_CaptureImageAvailable); viewfinderBrush.SetSource(myCamera); }

Page 16: Hacking images on windows phone

Code to Preview images on Windows Phoneprivate void ccTaskCompleted(object sender, PhotoResult pr) { byte[] imgLocal; if (pr.ChosenPhoto != null) { imgLocal = new byte[(int)pr.ChosenPhoto.Length]; pr.ChosenPhoto.Read(imgLocal, 0, imgLocal.Length); pr.ChosenPhoto.Seek(0, System.IO.SeekOrigin.Begin); var bitmapImage = PictureDecoder.DecodeJpeg(pr.ChosenPhoto); this.imgCaptured.Source = bitmapImage; } }

Page 17: Hacking images on windows phone

Windows phone camera API’s

Page 18: Hacking images on windows phone

Windows phone camera API’s

Page 19: Hacking images on windows phone

Point Processes: Increase Brightness

255,

256,255

,,,

gcrIgcrIgcrI

crJk

kkk if

if ,

index. band the is and 3210 ,,kg

Page 20: Hacking images on windows phone

Point Processes: Decrease Brightness

crI

gcrIgcrI

crJk

k

kk ,

0,,,

0,

if if

,

index. band the is and 3210 ,,kg

Page 21: Hacking images on windows phone

Point Processes: Increase Contrast

.255,

,255,0,0,

,255,,

,0,

crTcrT

crTcrTcrJ

k

k

k

kk

if if if

321 ,,k

0.1127127,),( acrIacrT kk where, Let

Page 22: Hacking images on windows phone

Point Processes: Decrease Contrast

.3,2,10.10

127127,),(

ka

crIacrT kk

and where

,

Page 23: Hacking images on windows phone

23Average filter, Example 1

Page 24: Hacking images on windows phone

24Average filter, Example 2

Beauty Mirror App of IOS

Page 25: Hacking images on windows phone

25

rk

rk

Histogram

nnrp k

k MNnnk

k 10 Lk

Image Pixel Intensity Histogram

1 1 3 3 71 1 3 3 51 0 3 3 20 0 2 2 20 0 2 2 2

0 4321 5 76r

nk

0

2

4

6

r 0 1 2 3 4 5 6 7

nk 5 5 7 6 0 1 0 1

Page 26: Hacking images on windows phone

26

There is one histo-gram per color bandR, G, & B. Luminosity histogram is from 1 band = (R+G+B)/3

RIh

GIh

BIh

LIh

Luminosity

The Histogram of a Color Image

Page 27: Hacking images on windows phone

27Edge Detection Examples: Original Images

Page 28: Hacking images on windows phone

28Edge Detection Examples: Vertical Difference

010020010

Page 29: Hacking images on windows phone

29Edge Detection Examples: Horizontal Difference

000121000

Page 30: Hacking images on windows phone

30

010141010 Edge Detection Examples: H + V

Diff.

Page 31: Hacking images on windows phone
Page 32: Hacking images on windows phone
Page 33: Hacking images on windows phone
Page 34: Hacking images on windows phone
Page 35: Hacking images on windows phone
Page 36: Hacking images on windows phone
Page 37: Hacking images on windows phone
Page 38: Hacking images on windows phone
Page 39: Hacking images on windows phone
Page 40: Hacking images on windows phone

Sharing Imaging App Ideas

Page 41: Hacking images on windows phone

THANK YOU