Skip to content

Commit 37fef22

Browse files
committed
update doc
1 parent 844b801 commit 37fef22

File tree

2 files changed

+77
-57
lines changed

2 files changed

+77
-57
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ mnist
44
build/
55
temp.temp
66
.vscode
7-
Testing
7+
Testing
8+
test
9+
.history

README.md

Lines changed: 74 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,64 @@
11
# Sudoku-recognizer
22

33
## Requirement
4-
* CMake [[sources](https://cmake.org/)]
5-
* Boost v.1.58.0 (test only) [[sources]](http://www.boost.org/users/history/version_1_58_0.html)
6-
* ./bootstrap --with-libraries=test
7-
* ./b2
8-
* sudo ./b2 install
9-
* OpenCV 3.1.0 [[sources](http://opencv.org/downloads.html)] [[more info](http://docs.opencv.org/3.1.0/df/d65/tutorial_table_of_content_introduction.html)]
4+
5+
- CMake [[sources](https://cmake.org/)]
6+
- Boost v.1.58.0 (test only) [[sources]](http://www.boost.org/users/history/version_1_58_0.html)
7+
- ./bootstrap.sh --with-libraries=test
8+
- ./b2
9+
- sudo ./b2 install
10+
- OpenCV 3.1.0 [[install](https://docs.opencv.org/3.1.0/d7/d9f/tutorial_linux_install.html)] [[more info](http://docs.opencv.org/3.1.0/df/d65/tutorial_table_of_content_introduction.html)]
1011
- build for desktop application
1112
- Download, extract and get yourself inside the sources of OpenCV 3.1.0 and create a `build` folder. Then:
1213
```
1314
cd build
1415
# CMAKE_BUILD_TYPE could either "Release" or "Debug".
1516
# WITH_OPENCL The usage of OpenCL is a big improvement in terms of performance but you don't have to worry about it if you system has support you got it for free. On ubuntu I had to install
16-
sudo apt-get install opencl-headers beignet beignet-dev
17-
cmake -DCMAKE_BUILD_TYPE=Release -DWITH_OPENCL=ON ..
17+
sudo apt-get install opencl-headers beignet beignet-dev
18+
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_OPENCL=ON -DENABLE_PRECOMPILED_HEADERS=OFF ..
1819
make -j4
1920
sudo make install
2021
```
2122
- build for android application [here](http://answers.opencv.org/question/126795/build-opencv-31-for-android-with-opencl-support/)
2223
23-
2424
## Useful information
25+
2526
Note that all the commands have to be invoked in the `build` folder. The first time you have to create it.
27+
2628
```
2729
mkdir build && cd build
2830
```
2931
3032
## Recognizer
31-
![hhh.gif](https://bitbucket.org/repo/zpnRyB/images/276570042-sudoku4.gif)
3233
34+
![hhh.gif](https://bitbucket.org/repo/zpnRyB/images/276570042-sudoku4.gif)
3335
3436
### Tests
37+
3538
Once you have installed all the requirements, execute the tests to see if everything is OK
39+
3640
```
37-
cmake .. && ctest -V
41+
cmake .. && make && ctest -V
3842
```
3943
4044
### Parse one of the provided puzzle located in `assets/puzzles`
45+
4146
```
4247
cmake .. && make && src/recognize ./../assets/puzzles/s1.jpg
4348
```
4449
4550
### Tools that can help you during the development process
51+
4652
#### Show all extracted puzzles located in `assets/puzzles`
53+
4754
```
4855
cmake .. && make && src/showExtracted
4956
```
5057
5158
![eee.gif](https://bitbucket.org/repo/njp6xM/images/4118982265-eee.gif)
5259
5360
#### Show all extracted cells for `assets/puzzles/s33.jpg`
61+
5462
```
5563
cmake .. && make && src/showExtracted --puzzleNumber 33 --showCell
5664
```
@@ -59,42 +67,50 @@ cmake .. && make && src/showExtracted --puzzleNumber 33 --showCell
5967
6068
#### Other actions
6169
62-
##### will show all extracted puzzles
70+
##### will show all extracted puzzles
71+
6372
```
64-
cmake .. && make && src/showExtracted
73+
cmake .. && make && src/showExtracted
6574
```
6675
67-
##### will show all extracted cells
76+
##### will show all extracted cells
77+
6878
```
69-
cmake .. && make && src/showExtracted --showCell
79+
cmake .. && make && src/showExtracted --showCell
7080
```
7181
72-
##### will show the extracted puzzle: `assets/puzzles/s33.jpg`
82+
##### will show the extracted puzzle: `assets/puzzles/s33.jpg`
83+
7384
```
74-
cmake .. && make && src/showExtracted --puzzleNumber 33
85+
cmake .. && make && src/showExtracted --puzzleNumber 33
7586
```
7687
77-
##### will show the cell index: 10 of `assets/puzzles/s33.jpg`
88+
##### will show the cell index: 10 of `assets/puzzles/s33.jpg`
89+
7890
```
7991
## useful in situation where only cell number 40 is wrong
80-
cmake .. && make && src/showExtracted --puzzleNumber 33 --showCell --cellNumber 10
92+
cmake .. && make && src/showExtracted --puzzleNumber 33 --showCell --cellNumber 10
8193
```
8294
83-
##### will show the cell index: 10 of `assets/puzzles/s33.jpg` plus the process of extraction
95+
##### will show the cell index: 10 of `assets/puzzles/s33.jpg` plus the process of extraction
96+
8497
```
85-
cmake .. && make && src/showExtracted --puzzleNumber 33 --showCell --cellNumber 10 --debug
98+
cmake .. && make && src/showExtracted --puzzleNumber 33 --showCell --cellNumber 10 --debug
8699
```
87100
88101
### Create the `assets/raw-features.yml` yourself
102+
89103
```
90104
cmake .. && make && src/prepareData # create training data from s0 --> s35
91105
```
92106
93-
* The knn network can be tested using this:
107+
- The knn network can be tested using this:
108+
94109
```
95110
cmake .. && make && src/testKnn
96111
```
97-
> You can iterate over each picture by setting debug=true in the `testKnn` fn
112+
113+
> You can iterate over each picture by setting debug=true in the `testKnn` fn
98114
99115
## The whole process
100116
@@ -104,43 +120,45 @@ cmake .. && make && src/mouline ./../assets/puzzles/s0.jpg
104120
105121
![iii.gif](https://bitbucket.org/repo/njp6xM/images/1534426116-iii.gif)
106122
107-
All the hard work was to recognize the numbers that's why this part comes after the `Recognizer` even if obviously this is what people want to do.
123+
All the hard work was to recognize the numbers that's why this part comes after the `Recognizer` even if obviously this is what people want to do.
108124
A [mouline](https://github.com/BenNG/sudoku-recognizer/blob/master/src/lib/sudoku.cpp#L1743) function has been created that gather all other functions.
109125
So the process is:
110-
* parse the original image that holds the sudoku puzzle and extract it
111-
* parse the extracted puzzle and use a computer vision algorithm to grab the initial state.
112-
* Solve the sudoku
113-
* write the solution on the extracted puzzle
114-
* merge the extracted puzzle on the original picture
126+
127+
- parse the original image that holds the sudoku puzzle and extract it
128+
- parse the extracted puzzle and use a computer vision algorithm to grab the initial state.
129+
- Solve the sudoku
130+
- write the solution on the extracted puzzle
131+
- merge the extracted puzzle on the original picture
115132
116133
## Tips (Personal memo)
117-
* There are 2 extraction process
118-
* the extraction of the puzzle
119-
* the extraction of the grid within the puzzle (somethimes it is the same see s6.jpg)
120-
* If you want to play with `HOGDescriptor` add set(OpenCV_LIBS opencv_core opencv_objdetect) (this is not used in the project anymore)
121-
* The function `prepareData` creates `assets/raw-features.yml` and getKnn uses it
122-
* boost library (used only for test)
123-
* check is the /FindBoost.cmake the supported version (the lib is not used anymore because it is not possible to use it on android)
124-
* If you ask for a cell and you have an error chances are that your cell is a 1 and it is too tiny go to extractNumber and play with (and do not forget to run prepareData && test after)
125-
* area
126-
* boundingArea
127-
* width_threshold
128-
* height_threshold
129-
* Before the portage on android, I used a system for resolving the path of file that looked for the root of the project and join the path given but in a apk application
130-
there are no path so I had to rewrite all and use relative paths
131-
* adding curl to the project (not use anymore)
132-
* dl the source code [here](https://github.com/curl/curl/releases)
133-
* in the source code there is a `CMakeLists.txt` so:
134-
* cmake .
135-
* make
136-
* sudo make install
137-
* [then](https://github.com/BenNG/sudoku-recognizer/blob/2f30e4dc54620b646df8a97a8ec5651a171c3e56/src/CMakeLists.txt#L1)
138-
* [and](https://github.com/BenNG/sudoku-recognizer/blob/2f30e4dc54620b646df8a97a8ec5651a171c3e56/src/CMakeLists.txt#L31)
139-
* When you do a project using computer vision think about the resolution you will use for:
140-
* the camera
141-
* the image being processed by the algorithm
142134
135+
- There are 2 extraction process
136+
- the extraction of the puzzle
137+
- the extraction of the grid within the puzzle (somethimes it is the same see s6.jpg)
138+
- If you want to play with `HOGDescriptor` add set(OpenCV_LIBS opencv_core opencv_objdetect) (this is not used in the project anymore)
139+
- The function `prepareData` creates `assets/raw-features.yml` and getKnn uses it
140+
- boost library (used only for test)
141+
- check is the /FindBoost.cmake the supported version (the lib is not used anymore because it is not possible to use it on android)
142+
- If you ask for a cell and you have an error chances are that your cell is a 1 and it is too tiny go to extractNumber and play with (and do not forget to run prepareData && test after)
143+
- area
144+
- boundingArea
145+
- width_threshold
146+
- height_threshold
147+
- Before the portage on android, I used a system for resolving the path of file that looked for the root of the project and join the path given but in a apk application
148+
there are no path so I had to rewrite all and use relative paths
149+
- adding curl to the project (not use anymore)
150+
- dl the source code [here](https://github.com/curl/curl/releases)
151+
- in the source code there is a `CMakeLists.txt` so:
152+
- cmake .
153+
- make
154+
- sudo make install
155+
- [then](https://github.com/BenNG/sudoku-recognizer/blob/2f30e4dc54620b646df8a97a8ec5651a171c3e56/src/CMakeLists.txt#L1)
156+
- [and](https://github.com/BenNG/sudoku-recognizer/blob/2f30e4dc54620b646df8a97a8ec5651a171c3e56/src/CMakeLists.txt#L31)
157+
- When you do a project using computer vision think about the resolution you will use for:
158+
- the camera
159+
- the image being processed by the algorithm
143160
144161
## Thank you for answering my questions
145-
* [Berak](http://answers.opencv.org/users/2130/berak/)
146-
* [Baptiste Wicht](https://github.com/wichtounet/)
162+
163+
- [Berak](http://answers.opencv.org/users/2130/berak/)
164+
- [Baptiste Wicht](https://github.com/wichtounet/)

0 commit comments

Comments
 (0)