Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

OpenCV on Android

7,819 views

Published on

Presented at GDG Singapore DevFest 2013 on 12/10/2013, by Badrinath Kulkarni, GDG Bangalore.

This talk mainly gives an introduction to basic image processing concepts and how the same can be implemented in Android apps using OpenCv framework.

Published in: Technology, Education
  • Login to see the comments

OpenCV on Android

  1. 1. OpenCv & Android Working with images Badrinath Kulkarni GDG Bangalore
  2. 2. What is OpenCv ? Open Source Computer Vision Library OpenCV is an open source computer vision and machine learning software library. Windows, Linux/Mac, Android, IOS Current version 2.4.6
  3. 3. Using in Android
  4. 4. Installation 1/3 Download OpenCv from SourceForge. Currently it’s OpenCV-2.4.6-android-sdk.zip
  5. 5. Installation 2/3 Import OpenCV library and samples to the Eclipse. • Library • Samples Android NDK must be installed & configured.
  6. 6. OpenCv Manager • Published on Google Play • Compact apk-size • Hardware specific optimizations • Automatic updates
  7. 7. Sudoku App
  8. 8. Pre - processing Java Imgproc.medianBlur(src, dst, 3); input.jpg median_3x3.jpg
  9. 9. Registration Registration is the determination of a geometrical transformation that aligns points in one view of an object with corresponding points in another view of that Object. input.jpg registered_image.jpg | size : 640X640
  10. 10. Step 1/4 : Detect horizontal lines Java Imgproc.Sobel(src, dst, ddepth, dx, dy, ksize, scale, delta); medin_3x3.jpg sobel_horizontal.jpg sobel_horizontal_binarized.jpg
  11. 11. Step 2/4 : Detect vertical lines Java Imgproc.Sobel(src, dst, ddepth, dx, dy, ksize, scale, delta); medin_3x3.jpg sobel_vertical.jpg sobel_vertical_binarized.jpg
  12. 12. Step 3/4 : Detect corner points Imgporc.HoughLinesP(); Detect periphery lines Imgporc.HoughLinesP(); Java Imgproc.HoughLinesP(image, lines, rho, theta, threshold, minLineLength, maxLineGap);
  13. 13. Step 4/4 : Homography Java Mat transformM = Calib3d.findHomography(srcPts, dstPts); src points : intersection points dst points : (1,1) (1,640) (640,1) (640,640) median_3x3.jpg registered_image.jpg | size : 640X640 Java Imgproc.warpPerspective(src, dst, transformM, dsize);
  14. 14. Thresholding Java Imgproc.adaptiveThreshold(src, dst, maxValue, adaptiveMethod, thresholdType, blockSize, delta); registered_image.jpg threshold_image.jpg
  15. 15. Number detection 1/2 Remove unwanted lines. threshold_image.jpg data_image.jpg
  16. 16. Number detection 2/2 NCC ~ 1 Java Imgproc.findContours(image, contours, hierarchy, mode, method); Imgproc.boundingRect(contourPoints); Imgproc.resize(src, dst, dsize);
  17. 17. Final output The extracted matrix can be given to any Sudoku solver engine and the solved output can be shown to the user. 5 6 5 6 2 7 3 1 1 6 8 4 5 7 3 6 2 6 1 4 9 8 9 9 9X9 matrix with data from the image
  18. 18. Thank You! badrinath@gtugs.org http://ibadrinath.in @ibadrinath

×