Working with camera and imaging on Nokia Asha software platform 1.0


Published on

Your camera and imaging apps can do more than before with Nokia Asha software platform 1.0, because of new APIs and increased available memory. Imaging apps for the Nokia Asha 501 phone can take full advantage of its 3.2-megapixel camera, in part because of the phone’s support for memory cards of up to 32 GB, a Java™ heap of 3 MB, and a maximum JAR size of 5 MB. In this webinar, Java expert Michael Samarin of Futurice introduces new Nokia Asha software platform 1.0 APIs for image scaling and image processing. He reviews related Java APIs that were made available on the Series 40 platform. In coding demonstrations, he provides detailed guidelines for capturing and processing images.

Find out more about:
* developing for Nokia Asha at:
* details on using advanced multimedia features in the Java Developer’s Library!developers-guides/multimedia/using-advanced-multimedia-features.html
* details on using the Image Scaling API in the Java Developer’s Library!developers-guides/ui-graphics-and-interaction/image-scaling-api.html

Check out the current webinar schedule here: or at

Published in: Technology, Art & Photos
1 Comment
  • Session 1, September 24, 2013 had technical difficulties and will probably not be posted. In the session 2 webinar of September 26, 2013, the question of barcode/QR code reading was posed by Karthik Subramaniyan. I offered the following: There was quite a discussion of reading barcodes (1D) and QR codes (2D) in Session 1 of this webinar. Angel Fernandez said that he had better luck with 2D than 1D surprisingly. Kevin sharp mentioned Nyquist as a limitation, and that only 2 or 3 pixels per barcode line made barcode reading untenable while some better results are possible for 2D (QR code) because it is designed to be read by a sensor, while 1D is designed to be read by 'flying dot'. Linear barcode 1D has about 110 elements while the image capture is 320 pixels; too tight to robustly capture, given only 2 or 3 pixels per element.

    I suggested possibly capturing a number of images and averaging them to overcome the 2-3 pixel/element limitation. Angel said this approach would not work because the barcodes are out of focus. The focal length of the camera is 50 cm to infinity, which is too far away for barcodes, which need less than 30 cm to fill image.,d.ZGU was given by Angel, describing it as an old article that shows empirically some resukts from resolutuon trial-error 'methodology'. Kevin suggested as a reference to his Nyquist limitation comment. Angel said the above cited article showed In fact, Ron's idea is used 'somehow' in Aldemans article, needing 7 or 8 pixels per element. I looked at Aldeman article and noticed that his images were taken at an angle then analysed as multiple lines of pixels, which would give a much larger sample set for averaging than a single line across a barcode. In this case, the slight differences from line to line help to refine the relative position averages for barcode elements.
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Working with camera and imaging on Nokia Asha software platform 1.0

  1. 1. Michael Samarin Director, Developer Training and Evangelism Futurice @MichaelSamarin WORKING WITH CAMERA AND IMAGING ON NOKIA ASHA SOFTWARE PLATFORM 1.0
  2. 2. 3RD PARTY CAMERA AND IMAGING APPS ON ASHA 501 • Capture low resolution still images and record video with Mobile Media API (JSR-135); • Downscale JPEG images with Nokia Image Scaling API; • Apply image processing filters with Advanced Multimedia Supplements API (JSR-234); • Access and change pixel data of images with LCDUI;
  3. 3. MOBILE MEDIA API (JSR-135) • 3rd party Apps on Asha 501 support: • Live camera viewfinder on LCDUI Form or Canvas; • Still image capture: 320x240 JPEG (device and emulator in Asha SDK 1.0); • Video capture: 320x240 MP4 (device);
  4. 4. IMAGE AND VIDEO CAPTURE WITH MM API Manager Player ControlData Source URLs “capture://image” “capture://video” Live viewfinder VideoControl RecordControl
  5. 5. DISPLAYING LIVE CAMERA VIEWFINDER 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);
  6. 6. TAKING AND SAVING SNAPSHOT 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("”) + "CapturedImage.jpg"; FileConnection file = (FileConnection), Connector.READ_WRITE); if (!file.exists()) file.create(); OutputStream out = file.openOutputStream(); out.write(imageBytes); out.close(); file.close();
  7. 7. RECORDING VIDEO RecordControl recordControl; recordControl = (RecordControl)player.getControl("RecordControl"); recordControl.setRecordLocation(System.getProperty("”) + "CapturedVideo.mp4"); recordControl.startRecord(); ... ... recordControl.stopRecord();
  8. 8. HANDS-ON DEMO – Displaying live camera viewfinder; – Taking snapshot; – Recording video;
  9. 9. NOKIA IMAGE SCALING API • The Image Scaling API allows MIDlets to downscale images by file size or by dimension (i.e. width and height) with the aspect ratio of the image can be retained if required. For JPEG images, the output quality can be set before downscaling. • Actual downscaling process is done outside of JVM, so no extra memory requirements for 3rd party apps. • Note: The Image Scaling API cannot upscale an image, and does not allow users to select any protected images for downscaling due to security or copyright issues. • Package
  10. 10. USING IMAGE SCALING • The Image Scaling API consists of the following classes and interfaces (packaged as a part of the Nokia API): • ImageScaler – Use the ImageScaler class to allow a MIDlet to downscale images in the device. • ImageScalerConstants – Use the ImageScaleConstants class to allow a MIDlet to use the image scaler definitions generated by the configuration utility. • ImageScalerListener – Use the ImageScalerListener interface to allow a MIDlet to discover status of images being downscaled in the device.
  11. 11. INITIATING IMAGE SCALING 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) { ... }
  12. 12. IMAGE EFFECTS WITH AMMS (JSR-234) • The Advanced Multimedia Supplements (JSR-234) on Asha 501 have possibility to apply several pre-defined image processing filters: • Monochrome • Negative • Emboss • Sepia • Solarize • API is asynchronous and allows register listeners to observe processing progress.
  13. 13. IMAGE EFFECTS WITH AMMS ON ASHA 501 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){ ... }
  14. 14. HANDS-ON DEMO – Nokia Image Scaling API – Image Effects with APPS
  15. 15. THANK YOU!