├── .classpath
├── .gitignore
├── .project
├── AndroidManifest.xml
├── LICENSE
├── README.md
├── jni
├── Android.mk
├── Application.mk
├── NativeVision
│ ├── .kdev4
│ │ └── NativeVision.kdev4
│ ├── CMakeLists.txt
│ ├── NativeVision.kdev4
│ ├── imgTrainer.cpp
│ ├── imgTrainer.h
│ ├── include
│ │ └── yaml-cpp
│ │ │ ├── aliasmanager.h
│ │ │ ├── anchor.h
│ │ │ ├── contrib
│ │ │ ├── anchordict.h
│ │ │ └── graphbuilder.h
│ │ │ ├── conversion.h
│ │ │ ├── dll.h
│ │ │ ├── emitfromevents.h
│ │ │ ├── emitter.h
│ │ │ ├── emittermanip.h
│ │ │ ├── eventhandler.h
│ │ │ ├── exceptions.h
│ │ │ ├── iterator.h
│ │ │ ├── ltnode.h
│ │ │ ├── mark.h
│ │ │ ├── node.h
│ │ │ ├── nodeimpl.h
│ │ │ ├── nodereadimpl.h
│ │ │ ├── nodeutil.h
│ │ │ ├── noncopyable.h
│ │ │ ├── null.h
│ │ │ ├── ostream.h
│ │ │ ├── parser.h
│ │ │ ├── stlemitter.h
│ │ │ ├── stlnode.h
│ │ │ ├── traits.h
│ │ │ └── yaml.h
│ ├── lsh.hpp
│ ├── main.cpp
│ ├── make_patches.py
│ ├── speaker.cpp
│ ├── speaker.h
│ ├── test.cpp
│ ├── us_old_patches.yaml
│ ├── vision.cpp
│ ├── vision.h
│ ├── webcam_test.cpp
│ └── yaml
│ │ ├── aliasmanager.cpp
│ │ ├── collectionstack.h
│ │ ├── contrib
│ │ ├── graphbuilder.cpp
│ │ ├── graphbuilderadapter.cpp
│ │ └── graphbuilderadapter.h
│ │ ├── conversion.cpp
│ │ ├── directives.cpp
│ │ ├── directives.h
│ │ ├── emitfromevents.cpp
│ │ ├── emitter.cpp
│ │ ├── emitterstate.cpp
│ │ ├── emitterstate.h
│ │ ├── emitterutils.cpp
│ │ ├── emitterutils.h
│ │ ├── exp.cpp
│ │ ├── exp.h
│ │ ├── indentation.h
│ │ ├── iterator.cpp
│ │ ├── iterpriv.h
│ │ ├── node.cpp
│ │ ├── nodebuilder.cpp
│ │ ├── nodebuilder.h
│ │ ├── nodeownership.cpp
│ │ ├── nodeownership.h
│ │ ├── null.cpp
│ │ ├── ostream.cpp
│ │ ├── parser.cpp
│ │ ├── ptr_stack.h
│ │ ├── ptr_vector.h
│ │ ├── regex.cpp
│ │ ├── regex.h
│ │ ├── regeximpl.h
│ │ ├── scanner.cpp
│ │ ├── scanner.h
│ │ ├── scanscalar.cpp
│ │ ├── scanscalar.h
│ │ ├── scantag.cpp
│ │ ├── scantag.h
│ │ ├── scantoken.cpp
│ │ ├── setting.h
│ │ ├── simplekey.cpp
│ │ ├── singledocparser.cpp
│ │ ├── singledocparser.h
│ │ ├── stream.cpp
│ │ ├── stream.h
│ │ ├── streamcharsource.h
│ │ ├── stringsource.h
│ │ ├── tag.cpp
│ │ ├── tag.h
│ │ └── token.h
├── android-ndk-profiler.mk
├── build.sh
├── jni_recognizer.cpp
└── prof.h
├── proguard.cfg
├── project.properties
├── res
├── drawable-hdpi
│ ├── ic_launcher.png
│ ├── mnu_focus.png
│ ├── mnu_light.png
│ ├── mnu_settings.png
│ ├── mnu_tipstricks.png
│ └── tips_tricks_icon.png
├── drawable-ldpi
│ └── ic_launcher.png
├── drawable-mdpi
│ └── ic_launcher.png
├── layout
│ ├── main.xml
│ ├── settings.xml
│ ├── tip.xml
│ └── tips_and_tricks.xml
├── menu
│ └── main.xml
├── raw
│ ├── au100bfull_pic.jpg
│ ├── au100ffull_pic.jpg
│ ├── au10bfull_pic.jpg
│ ├── au10ffull_pic.jpg
│ ├── au20bfull_pic.jpg
│ ├── au20ffull_pic.jpg
│ ├── au50bfull_pic.jpg
│ ├── au50ffull_pic.jpg
│ ├── au5bfull_pic.jpg
│ ├── au5bfull_pic_alt1.jpg
│ ├── au5bfull_pic_alt2.jpg
│ ├── au5ffull_pic.jpg
│ ├── au5ffull_pic_alt1.jpg
│ ├── au5ffull_pic_alt2.jpg
│ ├── by100000bfull_pic.jpg
│ ├── by100000ffull_pic.jpg
│ ├── by10000bfull_pic.jpg
│ ├── by10000ffull_pic.jpg
│ ├── by1000bfull_pic.jpg
│ ├── by1000ffull_pic.jpg
│ ├── by100bfull_pic.jpg
│ ├── by100ffull_pic.jpg
│ ├── by200000bfull_pic.jpg
│ ├── by200000ffull_pic.jpg
│ ├── by20000bfull_pic.jpg
│ ├── by20000ffull_pic.jpg
│ ├── by50000bfull_pic.jpg
│ ├── by50000ffull_pic.jpg
│ ├── by5000bfull_pic.jpg
│ ├── by5000ffull_pic.jpg
│ ├── by500bfull_pic.jpg
│ ├── by500ffull_pic.jpg
│ ├── by50bfull_pic.jpg
│ ├── by50ffull_pic.jpg
│ ├── ca100bfull_pic.jpg
│ ├── ca100ffull_pic.jpg
│ ├── ca10bfull_pic.jpg
│ ├── ca10ffull_pic.jpg
│ ├── ca10ffull_pic_alt1.jpg
│ ├── ca20bfull_pic.jpg
│ ├── ca20ffull_pic.jpg
│ ├── ca50bfull_pic.jpg
│ ├── ca50ffull_pic.jpg
│ ├── ca5bfull_pic.jpg
│ ├── ca5ffull_pic.jpg
│ ├── ca5ffull_pic_alt1.jpg
│ ├── eu100bfull_pic.jpg
│ ├── eu100ffull_pic.jpg
│ ├── eu10bfull_pic.jpg
│ ├── eu10ffull_pic.jpg
│ ├── eu200bfull_pic.jpg
│ ├── eu200ffull_pic.jpg
│ ├── eu20bfull_pic.jpg
│ ├── eu20ffull_pic.jpg
│ ├── eu500bfull_pic.jpg
│ ├── eu500ffull_pic.jpg
│ ├── eu50bfull_pic.jpg
│ ├── eu50ffull_pic.jpg
│ ├── eu5bfull_pic.jpg
│ ├── eu5ffull_pic.jpg
│ ├── ka100bfull_pic.jpg
│ ├── ka100ffull_pic.jpg
│ ├── ka10bfull_pic.jpg
│ ├── ka10ffull_pic.jpg
│ ├── ka1bfull_pic.jpg
│ ├── ka1ffull_pic.jpg
│ ├── ka200bfull_pic.jpg
│ ├── ka200ffull_pic.jpg
│ ├── ka20bfull_pic.jpg
│ ├── ka20ffull_pic.jpg
│ ├── ka2bfull_pic.jpg
│ ├── ka2ffull_pic.jpg
│ ├── ka50bfull_pic.jpg
│ ├── ka50ffull_pic.jpg
│ ├── ka5bfull_pic.jpg
│ ├── ka5ffull_pic.jpg
│ ├── ru1000bfull_pic.jpg
│ ├── ru1000ffull_pic.jpg
│ ├── ru100bfull_pic.jpg
│ ├── ru100ffull_pic.jpg
│ ├── ru10bfull_pic.jpg
│ ├── ru10ffull_pic.jpg
│ ├── ru5000bfull_pic.jpg
│ ├── ru5000ffull_pic.jpg
│ ├── ru500bfull_pic.jpg
│ ├── ru500ffull_pic.jpg
│ ├── ru50bfull_pic.jpg
│ ├── ru50ffull_pic.jpg
│ ├── sound_chaching.ogg
│ ├── sound_focuscomplete.ogg
│ ├── sound_recognitionevent.ogg
│ ├── ua100bfull_pic.jpg
│ ├── ua100bfull_pic_alt1.jpg
│ ├── ua100ffull_pic.jpg
│ ├── ua100ffull_pic_alt1.jpg
│ ├── ua10bfull_pic.jpg
│ ├── ua10bfull_pic_alt1.jpg
│ ├── ua10bfull_pic_alt2.jpg
│ ├── ua10ffull_pic.jpg
│ ├── ua10ffull_pic_alt1.jpg
│ ├── ua10ffull_pic_alt2.jpg
│ ├── ua1bfull_pic.jpg
│ ├── ua1bfull_pic_alt1.jpg
│ ├── ua1bfull_pic_alt2.jpg
│ ├── ua1ffull_pic.jpg
│ ├── ua1ffull_pic_alt1.jpg
│ ├── ua1ffull_pic_alt2.jpg
│ ├── ua1ffull_pic_alt3.jpg
│ ├── ua200bfull_pic.jpg
│ ├── ua200bfull_pic_alt1.jpg
│ ├── ua200ffull_pic.jpg
│ ├── ua200ffull_pic_alt1.jpg
│ ├── ua20bfull_pic.jpg
│ ├── ua20bfull_pic_alt1.jpg
│ ├── ua20bfull_pic_alt2.jpg
│ ├── ua20ffull_pic.jpg
│ ├── ua20ffull_pic_alt1.jpg
│ ├── ua20ffull_pic_alt2.jpg
│ ├── ua2bfull_pic.jpg
│ ├── ua2bfull_pic_alt1.jpg
│ ├── ua2bfull_pic_alt2.jpg
│ ├── ua2ffull_pic.jpg
│ ├── ua2ffull_pic_alt1.jpg
│ ├── ua2ffull_pic_alt2.jpg
│ ├── ua500bfull_pic.jpg
│ ├── ua500ffull_pic.jpg
│ ├── ua50bfull_pic.jpg
│ ├── ua50bfull_pic_alt1.jpg
│ ├── ua50ffull_pic.jpg
│ ├── ua50ffull_pic_alt1.jpg
│ ├── ua5bfull_pic.jpg
│ ├── ua5bfull_pic_alt1.jpg
│ ├── ua5bfull_pic_alt2.jpg
│ ├── ua5ffull_pic.jpg
│ ├── ua5ffull_pic_alt1.jpg
│ ├── ua5ffull_pic_alt2.jpg
│ ├── uk10bfull_pic.jpg
│ ├── uk10ffull_pic.jpg
│ ├── uk20bfull_pic.jpg
│ ├── uk20bfull_pic_alt1.jpg
│ ├── uk20ffull_pic.jpg
│ ├── uk20ffull_pic_alt1.jpg
│ ├── uk50bfull_pic.jpg
│ ├── uk50bfull_pic_alt1.jpg
│ ├── uk50ffull_pic.jpg
│ ├── uk50ffull_pic_alt1.jpg
│ ├── uk5bfull_pic.jpg
│ ├── uk5ffull_pic.jpg
│ ├── us100bfull_pic.jpg
│ ├── us100ffull_pic.jpg
│ ├── us10bfull_pic.jpg
│ ├── us10ffull_pic.jpg
│ ├── us1bfull_pic.jpg
│ ├── us1ffull_pic.jpg
│ ├── us20bfull_pic.jpg
│ ├── us20ffull_pic.jpg
│ ├── us2bfull_pic.jpg
│ ├── us2ffull_pic.jpg
│ ├── us50bfull_pic.jpg
│ ├── us50ffull_pic.jpg
│ ├── us5bfull_pic.jpg
│ └── us5ffull_pic.jpg
├── values-ru
│ ├── language_packs.xml
│ ├── strings.xml
│ └── tips_and_tricks.xml
└── values
│ ├── attrs.xml
│ ├── language_packs.xml
│ ├── strings.xml
│ └── tips_and_tricks.xml
└── src
└── com
└── ndu
└── mobile
└── darwinwallet
├── AutoFocusModes.java
├── AutoFocuser.java
├── BillRecognizerActivity.java
├── CurrencyInfo.java
├── IAutoFocusEvent.java
├── IRecognitionEvent.java
├── Preview.java
├── RecognitionResult.java
├── Recognizer.java
├── SettingsActivity.java
├── TipsArrayAdapter.java
├── TipsnTricksActivity.java
└── Voice.java
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 | obj/
3 | gen/
4 | libs/
5 | *.a
6 | *.o
7 | *.so
8 | *~
9 | *.ref
10 | jni/NativeVision/currency
11 | jni/NativeVision/build
12 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | DarwinWallet
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
22 |
23 |
24 |
28 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
42 |
43 |
44 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | darwinwallet
2 | ============
3 |
4 | Darwin Wallet is an Android app that enables blind and visually impaired users to quickly recognize paper money. It uses the phone's camera to detect currency denominations for US, UK, Canadian, European Union, Belarusian rubles, and Australian bills. Simply hold the bill in front of the phone's camera and the app will speak its value
5 |
6 | Check it out on the Android App Store:
7 | https://play.google.com/store/apps/details?id=com.ndu.mobile.darwinwallet&hl=en
8 |
9 | Darwin Wallet is licensed under the GPLv2
10 |
--------------------------------------------------------------------------------
/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 |
4 |
5 | include $(CLEAR_VARS)
6 |
7 | OPENCV_CAMERA_MODULES := off
8 | #OPENCV_MK_PATH:=/home/mhill/projects/darwin_wallet/opencv/OpenCV-2.3.1/share/OpenCV/OpenCV.mk
9 | OPENCV_MK_PATH:=/home/mhill/projects/darwin_wallet/opencv/sdk/native/jni/OpenCV.mk
10 |
11 |
12 | OPENCV_LIB_TYPE:=STATIC
13 | OPENCV_INSTALL_MODULES:=on
14 |
15 | include $(OPENCV_MK_PATH)
16 |
17 | #Profiler
18 | #-include android-ndk-profiler.mk
19 |
20 | #include ../includeOpenCV.mk
21 | #ifeq ("$(wildcard $(OPENCV_MK_PATH))","")
22 | # #try to load OpenCV.mk from default install location
23 | # include $(TOOLCHAIN_PREBUILT_ROOT)/user/share/OpenCV/OpenCV.mk
24 | #else
25 | # include $(OPENCV_MK_PATH)
26 | #endif
27 |
28 | LOCAL_C_INCLUDES := /home/mhill/projects/darwin_wallet/opencv/sdk/native/jni/include
29 |
30 | LOCAL_MODULE := native_wallet
31 | LOCAL_SRC_FILES := jni_recognizer.cpp NativeVision/vision.cpp
32 | LOCAL_CFLAGS=-ffast-math -O3 -funroll-loops
33 | #LOCAL_CFLAGS=-O3 -funroll-loops
34 |
35 | LOCAL_LDLIBS += -llog -ldl
36 |
37 | #Profiling
38 | #LOCAL_CFLAGS := -pg
39 | #LOCAL_STATIC_LIBRARIES := andprof
40 |
41 |
42 |
43 | include $(BUILD_SHARED_LIBRARY)
44 |
--------------------------------------------------------------------------------
/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_STL := gnustl_static
2 | APP_CPPFLAGS := -frtti -fexceptions -Wno-error=format-security
3 | APP_ABI := armeabi-v7a
4 |
--------------------------------------------------------------------------------
/jni/NativeVision/.kdev4/NativeVision.kdev4:
--------------------------------------------------------------------------------
1 | [Buildset]
2 | BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x18\x00N\x00a\x00t\x00i\x00v\x00e\x00V\x00i\x00s\x00i\x00o\x00n)
3 |
4 | [CMake]
5 | BuildDirs=/home/mhill/projects/darwin_wallet/NativeVision/build
6 | CMakeDir=/usr/share/cmake-2.8/Modules
7 | Current CMake Binary=file:///usr/bin/cmake
8 | CurrentBuildDir=file:///home/mhill/projects/darwin_wallet/NativeVision/build
9 | CurrentBuildType=Debug
10 | CurrentInstallDir=
11 | Extra Arguments=
12 | ProjectRootRelative=./
13 |
14 | [Launch]
15 | Launch Configurations=Launch Configuration 0,Launch Configuration 1,Launch Configuration 2,Launch Configuration 3
16 |
17 | [Launch][Launch Configuration 0]
18 | Configured Launch Modes=execute
19 | Configured Launchers=nativeAppLauncher
20 | Name=Main
21 | Type=Native Application
22 |
23 | [Launch][Launch Configuration 0][Data]
24 | Arguments=
25 | Dependencies=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x00)
26 | Dependency Action=Nothing
27 | EnvironmentGroup=default
28 | Executable=
29 | External Terminal=konsole --noclose --workdir %workdir -e %exe
30 | Project Target=NativeVision,nativevision
31 | Use External Terminal=false
32 | Working Directory=
33 | isExecutable=false
34 |
35 | [Launch][Launch Configuration 1]
36 | Configured Launch Modes=execute
37 | Configured Launchers=nativeAppLauncher
38 | Name=Webcam Test
39 | Type=Native Application
40 |
41 | [Launch][Launch Configuration 1][Data]
42 | Arguments=
43 | Dependencies=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x00)
44 | Dependency Action=Nothing
45 | EnvironmentGroup=default
46 | Executable=
47 | External Terminal=konsole --noclose --workdir %workdir -e %exe
48 | Project Target=NativeVision,webcam_test
49 | Use External Terminal=false
50 | Working Directory=
51 | isExecutable=false
52 |
53 | [Launch][Launch Configuration 2]
54 | Configured Launch Modes=execute
55 | Configured Launchers=nativeAppLauncher
56 | Name=Trainer
57 | Type=Native Application
58 |
59 | [Launch][Launch Configuration 2][Data]
60 | Arguments=
61 | Dependencies=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x00)
62 | Dependency Action=Nothing
63 | EnvironmentGroup=default
64 | Executable=
65 | External Terminal=konsole --noclose --workdir %workdir -e %exe
66 | Project Target=NativeVision,trainer
67 | Use External Terminal=false
68 | Working Directory=
69 | isExecutable=false
70 |
71 | [Launch][Launch Configuration 3]
72 | Configured Launch Modes=execute
73 | Configured Launchers=nativeAppLauncher
74 | Name=Test one off
75 | Type=Native Application
76 |
77 | [Launch][Launch Configuration 3][Data]
78 | Arguments=
79 | Dependencies=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x00)
80 | Dependency Action=Nothing
81 | EnvironmentGroup=default
82 | Executable=
83 | External Terminal=konsole --noclose --workdir %workdir -e %exe
84 | Project Target=NativeVision,test
85 | Use External Terminal=false
86 | Working Directory=
87 | isExecutable=false
88 |
89 | [Project]
90 | VersionControlSupport=kdevgit
91 |
--------------------------------------------------------------------------------
/jni/NativeVision/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | project(nativevision)
4 |
5 | include_directories(include)
6 |
7 | add_executable(nativevision main.cpp vision.cpp imgTrainer.cpp speaker.cpp
8 |
9 | # YAML files
10 | ./yaml/aliasmanager.cpp ./yaml/conversion.cpp ./yaml/emitter.cpp ./yaml/scanscalar.cpp ./yaml/stream.cpp
11 | ./yaml/exp.cpp ./yaml/emitfromevents.cpp ./yaml/regex.cpp ./yaml/scantag.cpp ./yaml/singledocparser.cpp
12 | ./yaml/ostream.cpp ./yaml/simplekey.cpp ./yaml/null.cpp ./yaml/directives.cpp ./yaml/emitterstate.cpp ./yaml/scanner.cpp
13 | ./yaml/parser.cpp ./yaml/contrib/graphbuilderadapter.cpp ./yaml/contrib/graphbuilder.cpp ./yaml/emitterutils.cpp
14 | ./yaml/iterator.cpp ./yaml/nodeownership.cpp ./yaml/nodebuilder.cpp ./yaml/tag.cpp ./yaml/scantoken.cpp ./yaml/node.cpp
15 | )
16 |
17 | add_executable(webcam_test webcam_test.cpp vision.cpp)
18 |
19 | add_executable(test test.cpp vision.cpp )
20 |
21 |
22 | target_link_libraries (nativevision
23 |
24 | #OpenCV
25 | opencv_core opencv_imgproc opencv_calib3d opencv_video opencv_features2d opencv_ml opencv_highgui opencv_objdetect opencv_contrib opencv_legacy
26 |
27 | #E-speak
28 | espeak
29 | )
30 |
31 | target_link_libraries (webcam_test opencv_core opencv_imgproc opencv_calib3d opencv_video opencv_features2d opencv_ml opencv_highgui opencv_objdetect opencv_contrib opencv_legacy)
32 |
33 | target_link_libraries (test opencv_core opencv_imgproc opencv_calib3d opencv_video opencv_features2d opencv_ml opencv_highgui opencv_objdetect opencv_contrib opencv_legacy)
34 |
--------------------------------------------------------------------------------
/jni/NativeVision/NativeVision.kdev4:
--------------------------------------------------------------------------------
1 | [Project]
2 | Name=NativeVision
3 | Manager=KDevCMakeManager
4 | VersionControl=kdevgit
5 |
--------------------------------------------------------------------------------
/jni/NativeVision/imgTrainer.cpp:
--------------------------------------------------------------------------------
1 |
2 |
3 | #include "imgTrainer.h"
4 | #include "vision.h"
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | //int main(int argc, char** argv)
14 | //{
15 | // loadRecognitionSet("", getMatcher());
16 | //
17 | // return 0;
18 | //}
19 |
20 |
21 | int loadRecognitionSet(string name, Ptr descriptorMatcher, vector& billMapping)
22 | {
23 | std::ostringstream out;
24 | out << "/home/mhill/projects/darwin_wallet/DarwinWallet/jni/NativeVision/currency/" << name << ".yaml";
25 |
26 | cout << "loading: " << out.str() << endl;
27 | std::ifstream fin(out.str().c_str());
28 |
29 | // Setup the detector, extractor, and matcher
30 | //ORB::CommonParams cp = ORB::CommonParams(1.2f,12U,5,1);
31 |
32 | Ptr detector = getTrainerDetector();
33 | //Ptr detector2 = getQueryDetector();
34 |
35 |
36 |
37 | // Parse the yaml input file
38 | YAML::Parser parser(fin);
39 |
40 | YAML::Node doc;
41 | std::string detection_points;
42 | std::string scale_factor;
43 |
44 | cout << "parsing yaml" << endl;
45 |
46 | vector trainImages;
47 |
48 | while(parser.GetNextDocument(doc)) {
49 |
50 | const YAML::Node& bills = doc["bills"];
51 |
52 | //doc["detection_points_per_image"] >> detection_points;
53 | //doc["scale_factor"] >> scale_factor;
54 |
55 | //cout << "Detection Points: " << detection_points << endl;
56 | //cout << "Scale factor: " << scale_factor << endl;
57 |
58 | // for(YAML::Iterator it=bills.begin();it!=bills.end();++it) {
59 |
60 | // std::string key, value;
61 | std::string img_path;
62 | // it.first() >> key;
63 | //
64 | // const YAML::Node& bill = bills[key];
65 | // std::cout << "Key: " << key << std::endl;
66 |
67 | for(int i = 0; i < bills.size(); i++) {
68 |
69 | std::string patch, type;
70 | bills[i]["type"] >> type;
71 | bills[i]["patch"] >> patch;
72 | std::cout << " -- Patch: " << type << " (" << patch << ")" << std::endl;
73 |
74 |
75 | out.str("");
76 | out << "/home/mhill/projects/darwin_wallet/DarwinWallet/res/raw/" << name << type << "full_pic.jpg";
77 | img_path = out.str();
78 |
79 | std::cout << img_path << endl;
80 |
81 | // load and add patch to recognizer
82 | cout << "< Reading image: " << type << endl;
83 | Mat img1 = imread( img_path );
84 | if( img1.empty() )
85 | {
86 | cout << "Can not read images" << endl;
87 | return -1;
88 | }
89 |
90 | billMapping.push_back(type);
91 | Mat trainData = trainImage(img1, detector, descriptorMatcher);
92 | trainImages.push_back(trainData);
93 | }
94 |
95 | // }
96 |
97 |
98 | }
99 |
100 | descriptorMatcher->add(trainImages);
101 | descriptorMatcher->train();
102 |
103 | //FileStorage fileobj = FileStorage("/tmp/outty", FileStorage::WRITE);
104 | //descriptorMatcher->write(fileobj);
105 |
106 | return 0;
107 | }
108 |
109 |
110 |
--------------------------------------------------------------------------------
/jni/NativeVision/imgTrainer.h:
--------------------------------------------------------------------------------
1 | #include "opencv2/highgui/highgui.hpp"
2 | #include "opencv2/calib3d/calib3d.hpp"
3 | #include "opencv2/imgproc/imgproc.hpp"
4 | #include "opencv2/features2d/features2d.hpp"
5 | #include "opencv2/video/tracking.hpp"
6 |
7 | #include
8 | #include "yaml-cpp/yaml.h"
9 |
10 | #include
11 | #include
12 |
13 |
14 | using namespace cv;
15 | using namespace std;
16 |
17 | int loadRecognitionSet(string name, Ptr descriptorMatcher, vector& billMapping);
--------------------------------------------------------------------------------
/jni/NativeVision/include/yaml-cpp/aliasmanager.h:
--------------------------------------------------------------------------------
1 | #ifndef ALIASMANAGER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
2 | #define ALIASMANAGER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
3 |
4 | #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
5 | #pragma once
6 | #endif
7 |
8 | #include "yaml-cpp/anchor.h"
9 | #include