Hacking Windows CE - DEF CON® Hacking Conference - The Hacker
Hacking images on windows phone
-
Upload
rahat-anindo -
Category
Technology
-
view
1.232 -
download
0
description
Transcript of Hacking images on windows phone
Hacking Images on Windows PhoneBUILDING WORLD'S MOST ADVANCED APPS
Conducted By RAHAT YASIR ANINDO
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
Imaging Apps are Every Where!
92%User take Photo or Video with their Smart Phone
Imaging Apps are Every Where!
49%User say Camera functionality is an important purchase factor
Imaging Apps are Every Where!
66%User take Photos or Videos with their Smart Phones weekly or more
Imaging Apps are Every Where!
78%User own a digital camera
Basic about Images
Image ! What is This?
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
Visual image formation-Digital Version
9
3D object
Digital Camera
Digitizer 2D Digital ImageCCD / CMOS
sensor Lens
Sampling and Quantization, 2D Case
10
Continuous Sampled
f(0,0) f(0,1)
f(N-1,M-1)
Image Sub-sampling-Gray 11
Image Re-sampling 12
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.
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(); }
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); }
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; } }
Windows phone camera API’s
Windows phone camera API’s
Point Processes: Increase Brightness
255,
256,255
,,,
gcrIgcrIgcrI
crJk
kkk if
if ,
index. band the is and 3210 ,,kg
Point Processes: Decrease Brightness
crI
gcrIgcrI
crJk
k
kk ,
0,,,
0,
if if
,
index. band the is and 3210 ,,kg
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
Point Processes: Decrease Contrast
.3,2,10.10
127127,),(
ka
crIacrT kk
and where
,
23Average filter, Example 1
24Average filter, Example 2
Beauty Mirror App of IOS
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
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
27Edge Detection Examples: Original Images
28Edge Detection Examples: Vertical Difference
010020010
29Edge Detection Examples: Horizontal Difference
000121000
30
010141010 Edge Detection Examples: H + V
Diff.
Sharing Imaging App Ideas
THANK YOU