More Related Content More from Industrial Technology Research Institute (ITRI)(工業技術研究院, 工研院) (20) Supporting OpenCV 3.0 for "Mastering OpenCV Android Application Programming"1. ©SIProp Project, 2006-2008 1
Supporting OpenCV 3.0 for
Noritsuna Imamura
noritsuna@siprop.org
"Mastering OpenCV Android
Application Programming"
2. ©SIProp Project, 2006-2008 2
What’s this?
"Mastering OpenCV Android Application
Programming" is one of programming book.
Published Site:
https://www.packtpub.com/application-
development/mastering-opencv-android-application-
programming
I explain:
How to Rewrite the sample
source codes to OpenCV 3.0
Additions of New Features on
OpenCV 3.0
3. ©SIProp Project, 2006-2008 3
All Chapters
Transition Guide for OpenCV 3.0
http://docs.opencv.org/master/db/dfa/tutorial_transi
tion_guide.html
OpenCV Version for Loarder
OLD:
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSIO
N_2_4_10, this, mLoaderCallback);
NEW:
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSIO
N_3_0_0, this, mLoaderCallback)
4. ©SIProp Project, 2006-2008 4
Chapter 1
Add THRESH_TRIANGLE to threshold options.
THRESH_TRIANGLE:
Use Triangle algorithm to choose the optimal threshold value
5. ©SIProp Project, 2006-2008 5
Chapter 2
"Core" class to "Imgproc" class
Old:
Core.circle(corners, new Point(i, j), 5, new
Scalar(r.nextInt(255)), 2);
Core.line(houghLines, pt1, pt2, new Scalar(255, 0, 0), 1);
Core.circle(houghCircles,center,r, new Scalar(255,0,0),1);
Core.rectangle(people, facesArray[i].tl(), facesArray[i].br(),
new Scalar(100), 3);
New:
Imgproc.circle(corners, new Point(i, j), 5, new
Scalar(r.nextInt(255)), 2);
Imgproc.line(houghLines, pt1, pt2, new Scalar(255, 0, 0), 1);
Imgproc.circle(houghCircles,center,r, new Scalar(255,0,0),1);
Imgproc.rectangle(people, facesArray[i].tl(), facesArray[i].br(),
new Scalar(100), 3);
6. ©SIProp Project, 2006-2008 6
Chapter 3
Add "AKAZE(Accelerated KAZE)" algorithm in
FeatureDetector & DescriptorExtractor.
"AKAZE" algorithm
http://docs.opencv.org/3.0-
beta/modules/features2d/doc/feature_detection_and_descri
ption.html#akaze
7. ©SIProp Project, 2006-2008 7
Chapter 4
"Core" class to "Imgproc" class
Old:
Core.rectangle(mRgba, facesArray[i].tl(), facesArray[i].br(),
new Scalar(100), 3);
New:
Imgproc.rectangle(mRgba, facesArray[i].tl(), facesArray[i].br(),
new Scalar(100), 3);
Removed "NativeCameraView" class in OpenCV
3.0
OpenCV 3.0 has "JavaCameraView" only.
8. ©SIProp Project, 2006-2008 8
Chapter 5
"Core" class to "Imgproc" class
Old:
Core.line(mGray, prevList.get(i), nextList.get(i), color);
Core.circle(mGray, p, 5, new Scalar(255));
New:
Imgproc.line(mGray, prevList.get(i), nextList.get(i), color);
Imgproc.circle(mGray, p, 5, new Scalar(255));
9. ©SIProp Project, 2006-2008 9
Chapter 6
Change Include file dir
Old:
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <opencv2/stitching/stitcher.hpp>
New:
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include <opencv2/stitching.hpp>
Supporting ARM 64bits in Application.mk
Old:
APP_ABI := armeabi-v7a
New:
APP_ABI := armeabi-v7a arm64-v8a
10. ©SIProp Project, 2006-2008 10
Chapter 7 1/5
"Core" class to "Imgproc" class
Old:
Core.rectangle(temp, new Point(temp.cols()/2 - 200,
temp.rows() / 2 - 200), new Point(temp.cols() / 2 + 200,
temp.rows() / 2 + 200), new Scalar(255,255,255),1);
New:
Imgproc.rectangle(temp, new Point(temp.cols()/2 - 200,
temp.rows() / 2 - 200), new Point(temp.cols() / 2 + 200,
temp.rows() / 2 + 200), new Scalar(255,255,255),1);
"ML" Package is modified.
Old Name Rule:
org.opencv.ml.CvXXX
org.opencv.ml.CvXXXPrames
11. ©SIProp Project, 2006-2008 11
Chapter 7 2/5
Main class & Parameter class are separated.
New Name Rule:
org.opencv.ml.XXX
Main class & Parameter class are combined.
Ex.
CvKNearest -> KNearest
CvSVM -> SVM
12. ©SIProp Project, 2006-2008 12
Chapter 7 3/5
Constructor is removed, change to create()
static method.
Old:
new KNearest();
new CvSVM();
New:
KNearest.create();
SVM.create();
13. ©SIProp Project, 2006-2008 13
Chapter 7 4/5
arguments of "train()" method is changed.
Old:
knn.train(training_images, training_labels, new Mat(), false, 10,
false);
svm.train(training_images, training_labels);
New:
knn.train(training_images, Ml.ROW_SAMPLE, training_labels);
svm.train(training_images, Ml.ROW_SAMPLE, training_labels);
60k data is too big for SVM. Please modify the
small data.
Ex.
total_images = temp.getInt(); -> total_images = 100;
14. ©SIProp Project, 2006-2008 14
Chapter 7 5/5
"KNearest.find_nearest()" method is changed
the new name.
Old:
knn.find_nearest(test, 10, results, new Mat(), new Mat());
New:
knn.findNearest(test, 10, results);