SlideShare une entreprise Scribd logo
1  sur  19
OpenCv & Android
Working with images

Badrinath Kulkarni
GDG Bangalore
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
Using in Android
Installation 1/3
Download OpenCv from SourceForge. Currently it’s OpenCV-2.4.6-android-sdk.zip
Installation 2/3
Import OpenCV library and samples to
the Eclipse.

• Library
• Samples

Android NDK must be
installed & configured.
OpenCv Manager
• Published on
Google Play
• Compact apk-size
• Hardware specific
optimizations
• Automatic updates
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

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);
Thresholding
Java

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

registered_image.jpg

threshold_image.jpg
Number detection 1/2
Remove unwanted lines.

threshold_image.jpg

data_image.jpg
Number detection 2/2

NCC ~ 1

Java

Imgproc.findContours(image, contours, hierarchy, mode, method);
Imgproc.boundingRect(contourPoints);
Imgproc.resize(src, dst, dsize);
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
Thank You!

badrinath@gtugs.org

http://ibadrinath.in
@ibadrinath

Contenu connexe

Tendances

Android NDK and the x86 Platform
Android NDK and the x86 PlatformAndroid NDK and the x86 Platform
Android NDK and the x86 Platform
Sebastian Mauer
 

Tendances (7)

Native development kit (ndk) introduction
Native development kit (ndk)  introductionNative development kit (ndk)  introduction
Native development kit (ndk) introduction
 
NDK Programming in Android
NDK Programming in AndroidNDK Programming in Android
NDK Programming in Android
 
Android NDK and the x86 Platform
Android NDK and the x86 PlatformAndroid NDK and the x86 Platform
Android NDK and the x86 Platform
 
Oscon 2014 def core review
Oscon 2014 def core reviewOscon 2014 def core review
Oscon 2014 def core review
 
Android ndk: Entering the native world
Android ndk: Entering the native worldAndroid ndk: Entering the native world
Android ndk: Entering the native world
 
Pulumi iac on gcp
Pulumi iac on gcpPulumi iac on gcp
Pulumi iac on gcp
 
"OpenCV for Embedded: Lessons Learned," a Presentation from itseez
"OpenCV for Embedded: Lessons Learned," a Presentation from itseez"OpenCV for Embedded: Lessons Learned," a Presentation from itseez
"OpenCV for Embedded: Lessons Learned," a Presentation from itseez
 

En vedette

Angle citra math 3_e
Angle citra math 3_eAngle citra math 3_e
Angle citra math 3_e
Nur Fadzri
 
Raju Resume
Raju ResumeRaju Resume
Raju Resume
Raju KR
 
FGM presentation University of Bedfordshire slide handouts
FGM presentation University of Bedfordshire slide handoutsFGM presentation University of Bedfordshire slide handouts
FGM presentation University of Bedfordshire slide handouts
Nanci Hogan
 

En vedette (17)

Khulood Tohmaz
Khulood TohmazKhulood Tohmaz
Khulood Tohmaz
 
CMS-Garden 2013 - How we brought Joomla! to the CeBIT
CMS-Garden 2013 - How we brought Joomla! to the CeBITCMS-Garden 2013 - How we brought Joomla! to the CeBIT
CMS-Garden 2013 - How we brought Joomla! to the CeBIT
 
Επιστολή Αντιπεριφεριεάρχη Χίου σχετικά με τις ραδιοτηλεοπτικές συχνότητες κα...
Επιστολή Αντιπεριφεριεάρχη Χίου σχετικά με τις ραδιοτηλεοπτικές συχνότητες κα...Επιστολή Αντιπεριφεριεάρχη Χίου σχετικά με τις ραδιοτηλεοπτικές συχνότητες κα...
Επιστολή Αντιπεριφεριεάρχη Χίου σχετικά με τις ραδιοτηλεοπτικές συχνότητες κα...
 
SEMrush'in Around - SEMrush Presentation
SEMrush'in Around - SEMrush PresentationSEMrush'in Around - SEMrush Presentation
SEMrush'in Around - SEMrush Presentation
 
Angle citra math 3_e
Angle citra math 3_eAngle citra math 3_e
Angle citra math 3_e
 
Raju Resume
Raju ResumeRaju Resume
Raju Resume
 
Music video Techniques
Music video TechniquesMusic video Techniques
Music video Techniques
 
Films based on real life and books
Films based on real life and booksFilms based on real life and books
Films based on real life and books
 
Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!
 
Generos musicales
Generos musicalesGeneros musicales
Generos musicales
 
Rpp 9 pk
Rpp 9 pkRpp 9 pk
Rpp 9 pk
 
OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012
 
Rpp matematika sma xii bab 1 (matriks)
Rpp matematika sma xii bab 1 (matriks)Rpp matematika sma xii bab 1 (matriks)
Rpp matematika sma xii bab 1 (matriks)
 
Image Processing with OpenCV
Image Processing with OpenCVImage Processing with OpenCV
Image Processing with OpenCV
 
Object detection
Object detectionObject detection
Object detection
 
Rpp matematika kelas 6 semester 2
Rpp matematika kelas 6 semester 2Rpp matematika kelas 6 semester 2
Rpp matematika kelas 6 semester 2
 
FGM presentation University of Bedfordshire slide handouts
FGM presentation University of Bedfordshire slide handoutsFGM presentation University of Bedfordshire slide handouts
FGM presentation University of Bedfordshire slide handouts
 

Similaire à [Devfest]open cv & android

Similaire à [Devfest]open cv & android (20)

Open cv with android
Open cv with androidOpen cv with android
Open cv with android
 
OpenCV+Android.pptx
OpenCV+Android.pptxOpenCV+Android.pptx
OpenCV+Android.pptx
 
OpenCV (Open source computer vision)
OpenCV (Open source computer vision)OpenCV (Open source computer vision)
OpenCV (Open source computer vision)
 
Android ndk
Android ndkAndroid ndk
Android ndk
 
Android NDK
Android NDKAndroid NDK
Android NDK
 
Getting Native with NDK
Getting Native with NDKGetting Native with NDK
Getting Native with NDK
 
Android ndk - Introduction
Android ndk  - IntroductionAndroid ndk  - Introduction
Android ndk - Introduction
 
Ii 1300-java essentials for android
Ii 1300-java essentials for androidIi 1300-java essentials for android
Ii 1300-java essentials for android
 
Open cv
Open cvOpen cv
Open cv
 
VeenaChilukala
VeenaChilukalaVeenaChilukala
VeenaChilukala
 
Java in a world of containers
Java in a world of containersJava in a world of containers
Java in a world of containers
 
Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018
 
Introduction to the Android NDK
Introduction to the Android NDKIntroduction to the Android NDK
Introduction to the Android NDK
 
Corba 2
Corba 2Corba 2
Corba 2
 
Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
“OpenCV: Past, Present and Future,” a Presentation from OpenCV.org
“OpenCV: Past, Present and Future,” a Presentation from OpenCV.org“OpenCV: Past, Present and Future,” a Presentation from OpenCV.org
“OpenCV: Past, Present and Future,” a Presentation from OpenCV.org
 
Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015
 
_OOP with JAVA Solution Manual (1).pdf
_OOP with JAVA Solution Manual (1).pdf_OOP with JAVA Solution Manual (1).pdf
_OOP with JAVA Solution Manual (1).pdf
 
Writing Android Libraries
Writing Android LibrariesWriting Android Libraries
Writing Android Libraries
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

[Devfest]open cv & android

  • 1. OpenCv & Android Working with images Badrinath Kulkarni GDG Bangalore
  • 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.
  • 5. Installation 1/3 Download OpenCv from SourceForge. Currently it’s OpenCV-2.4.6-android-sdk.zip
  • 6. Installation 2/3 Import OpenCV library and samples to the Eclipse. • Library • Samples Android NDK must be installed & configured.
  • 7. OpenCv Manager • Published on Google Play • Compact apk-size • Hardware specific optimizations • Automatic updates
  • 9. Pre - processing Java Imgproc.medianBlur(src, dst, 3); input.jpg median_3x3.jpg
  • 10. 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
  • 11. 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
  • 12. 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
  • 13. Step 3/4 : Detect corner points Imgporc.HoughLinesP(); Detect periphery lines Imgporc.HoughLinesP(); Java Imgproc.HoughLinesP(image, lines, rho, theta, threshold, minLineLength, maxLineGap);
  • 14. 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);
  • 15. Thresholding Java Imgproc.adaptiveThreshold(src, dst, maxValue, adaptiveMethod, thresholdType, blockSize, delta); registered_image.jpg threshold_image.jpg
  • 16. Number detection 1/2 Remove unwanted lines. threshold_image.jpg data_image.jpg
  • 17. Number detection 2/2 NCC ~ 1 Java Imgproc.findContours(image, contours, hierarchy, mode, method); Imgproc.boundingRect(contourPoints); Imgproc.resize(src, dst, dsize);
  • 18. 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