nokia asha from idea to app - imaging

18
Asha Idea to App: Imaging Michael Samarin Director, Developer Training and Evangelism Futurice @MichaelSamarin

Upload: microsoft-mobile-developer

Post on 09-May-2015

7.233 views

Category:

Technology


3 download

DESCRIPTION

Bring your ideas to life with the APIs and additional memory available for development on the Nokia Asha platform. Join this webinar to learn how much you can do in the area of imaging, with the Image Scaling API and the Image Processing API. You’ll also get detailed guidelines on how to work with the camerainterface and how to create special effects and filters.

TRANSCRIPT

Page 1: Nokia Asha from idea to app - Imaging

Asha Idea to App:ImagingMichael SamarinDirector, Developer Training and EvangelismFuturice

@MichaelSamarin

Page 2: Nokia Asha from idea to app - Imaging

http://developer.nokia.com/asha/java/downloads

Page 3: Nokia Asha from idea to app - Imaging
Page 4: Nokia Asha from idea to app - Imaging
Page 5: Nokia Asha from idea to app - Imaging

Manager

Player ControlData Source

javax.microedition.media

URLs“capture://image”“capture://video”

Live viewfinder VideoControlRecordControl

Page 6: Nokia Asha from idea to app - Imaging

Form videoForm;Item videoItem;Player player;VideoControl videoControl;

player = Manager.createPlayer("capture://image");//player = Manager.createPlayer("capture://video");

player.prefetch();player.realize();player.start();videoControl = (VideoControl)player.getControl("VideoControl");videoItem = (Item)videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null);videoForm.append(videoItem);

Page 7: Nokia Asha from idea to app - Imaging

byte[] imageBytes = videoControl.getSnapshot(null);

Image image = Image.createImage(imageBytes, 0, imageBytes.length);ImageItem imageItem = new ImageItem("", image, Item.PLAIN, "");videoForm.append(image);

String fileName = System.getProperty("fileconn.dir.photos”)+

"CapturedImage.jpg";FileConnection file = (FileConnection) Connector.open(fileName,

Connector.READ_WRITE);if (!file.exists()) file.create();

OutputStream out = file.openOutputStream();out.write(imageBytes);out.close();file.close();

Page 8: Nokia Asha from idea to app - Imaging

byte[] imageBytes = videoControl.getSnapshot(null);//byte[] imageBytes = videoControl.getSnapshot(“width=640&height=480”);

Image image = Image.createImage(imageBytes, 0, imageBytes.length);ImageItem imageItem = new ImageItem("", image, Item.PLAIN, "");videoForm.append(image);

String fileName = System.getProperty("fileconn.dir.photos”)+

"CapturedImage.jpg";FileConnection file = (FileConnection) Connector.open(fileName,

Connector.READ_WRITE);if (!file.exists()) file.create();

OutputStream out = file.openOutputStream();out.write(imageBytes);out.close();file.close();

Page 9: Nokia Asha from idea to app - Imaging

RecordControl recordControl;

recordControl = (RecordControl)player.getControl("RecordControl");

recordControl.setRecordLocation(System.getProperty("fileconn.dir.photos”) + "CapturedVideo.mp4");

recordControl.startRecord();

...

...

recordControl.stopRecord();

Page 10: Nokia Asha from idea to app - Imaging

• Displaying live camera viewfinder;• Taking snapshot;• Recording video;

Page 11: Nokia Asha from idea to app - Imaging
Page 12: Nokia Asha from idea to app - Imaging
Page 13: Nokia Asha from idea to app - Imaging

ImageScaler imageScaler = new ImageScaler(sourceImageFilePath, destinationFilePath);

imageScaler.addListener(this);

Integer requestId = new Integer(imageScaler.scaleImage(newWidth, newHeight, true));

. . .

public void scaleFinished(int requestId, int result)

...

Page 14: Nokia Asha from idea to app - Imaging
Page 15: Nokia Asha from idea to app - Imaging

MediaProcessor mediaProcessor = GlobalManager.createMediaProcessor(JPEG_TYPE);mediaProcessor.addMediaProcessorListener(this);...mediaProcessor.setInput(inputStream, MediaProcessor.UNKNOWN);...mediaProcessor.setOutput(byteArrayOutputStream);ImageEffectControl imageEffect =

(ImageEffectControl) mediaProcessor.getControl("javax.microedition.amms.control.imageeffect.ImageEffectControl");

imageEffect.setPreset("monochrome");imageEffect.setEnabled(true);mediaProcessor.start();

...public void mediaProcessorUpdate(MediaProcessor processor,

String event,Object eventData)

...

Page 16: Nokia Asha from idea to app - Imaging
Page 17: Nokia Asha from idea to app - Imaging

• Image Scaling API• Image Effects with APPS

Page 18: Nokia Asha from idea to app - Imaging

© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft* as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. *Microsoft refers to Microsoft Corp. and its affiliates, including Microsoft Mobile Oy, a wholly-owned subsidiary. The Nokia Devices and Services business is part of Microsoft Mobile Oy.

THANK YOU!