opencv on android

Post on 13-Jan-2017

7.155 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

OpenCv & AndroidWorking with images

Badrinath Kulkarni

GDG Bangalore

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

What is OpenCv ?

Using in Android

Installation 1/3

Download OpenCv from SourceForge. Currently it’s OpenCV-2.4.6-android-sdk.zip

Import OpenCV library and samples to

the Eclipse.

Installation 2/3

• Library

• Samples

Android NDK must be

installed & configured.

• Published on

Google Play

• Compact apk-size

• Hardware specific

optimizations

• Automatic updates

OpenCv Manager

Sudoku App

Pre - processing

Java

Imgproc.medianBlur(src, dst, 3);

input.jpg median_3x3.jpg

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

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

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

Step 3/4 : Detect corner points

Imgporc.HoughLinesP();

Detect periphery lines

Imgporc.HoughLinesP();

Java

Imgproc.HoughLinesP(image, lines, rho, theta, threshold,

minLineLength, maxLineGap);

Step 4/4 : Homography

Java

Imgproc.warpPerspective(src, dst, transformM, dsize);

registered_image.jpg | size : 640X640

Java

Mat transformM = Calib3d.findHomography(srcPts, dstPts);

src points : intersection points

dst points : (1,1) (1,640) (640,1) (640,640)

median_3x3.jpg

Thresholding

Java

Imgproc.adaptiveThreshold(src, dst, maxValue, adaptiveMethod, thresholdType, blockSize, delta);

registered_image.jpg threshold_image.jpg

Number detection 1/2

threshold_image.jpg data_image.jpg

Remove unwanted lines.

Number detection 2/2

Java

Imgproc.findContours(image, contours, hierarchy, mode, method);

Imgproc.boundingRect(contourPoints);

Imgproc.resize(src, dst, dsize);

NCC ~ 1

Final output

5 6

5 7

6 3 1

2 1 6 8

4 5

7 4 6 9

3 2 8

6 9

1 9

9X9 matrix with data from the image

The extracted matrix can be given to any Sudoku solver engine and the solved output can be

shown to the user.

Thank You!

badrinath@gtugs.org

http://ibadrinath.in

@ibadrinath

top related