Skip to content

Instantly share code, notes, and snippets.

@da-moon
Last active November 4, 2018 15:29
Show Gist options
  • Save da-moon/0d935d65c34830ebb2fce12c7ed96172 to your computer and use it in GitHub Desktop.
Save da-moon/0d935d65c34830ebb2fce12c7ed96172 to your computer and use it in GitHub Desktop.
if you want to run headless, then run ifconfig in your odroid to find ip address
ifconfig -a
This is why you need net-tools
ping [email protected]
-- 192.168.1.20 ping statistics ---
30 packets transmitted, 30 received, 0% packet loss, time 29078ms
rtt min/avg/max/mdev = 3.398/151.852/2138.388/465.393 ms, pipe 3
--now we can use ssh to connect to the ipaddress:
ssh [email protected]
root@cescp:/home/cesco/github/android# ssh [email protected]
The authenticity of host '192.168.1.20 (192.168.1.20)' can't be established.
ECDSA key fingerprint is SHA256:BCB66+A/fD7BGFb6qXHGLkxQpgoprJpfODk4s0FJHFA.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.20' (ECDSA) to the list of known hosts.
[email protected]'s password:
============================================================================================================================
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake pkg-config nmap net-tools
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install libgtk2.0-dev
sudo apt-get install python2.7-dev python3-dev
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
sudo pip install numpy scipy matplotlib jupyter sympy nose
if interested in Java and android apps then do the following steps:
==========================================================================================================================================
A lot of times java is present, but not configured. Just because you have the JDK does not mean you can use Java.
firefox http://jdk.java.net/8/
accept the license agreement, then you can download:
if you have a 32 bit system then do this one:
wget https://download.java.net/java/jdk8u172/archive/b03/binaries/jdk-8u172-ea-bin-b03-linux-arm32-vfp-hflt-18_jan_2018.tar.gz
if you have a 64 bit system then you do this one:
wget http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-arm64-vfp-hflt.tar.gz
tar xvfz jdk-8u33-linux-arm-vfp-hflt.gz
mkdir /usr/lib/jvm
mv jdk1.8.0_172 /usr/lib/jvm/
export PATH=$PATH:/usr/lib/jvm/jdk1.8.0_172/bin
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_172/bin/javac 1
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_172/bin/java 1
update-alternatives --config javac
update-alternatives --config java
--testing java:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
=========================================================================================
Downloading, installing, and building Leptonica and Tesseract
first you need to find out the version of Ubuntu that you/ODROId is running:
odroid@odroid:~/tesseract/leptonica-1.74.4/build$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
Now you know that you are running: Ubuntu 16.04.4 LTS xenial
sudo apt-get install g++
sudo apt-get install autoconf automake libtool
sudo apt-get install autoconf-archive
sudo apt-get install pkg-config
sudo apt-get install libpng-dev
sudo apt-get install libjpeg8-dev
sudo apt-get install libtiff5-dev
sudo apt-get install zlib1g-dev
sudo apt-get install xzgv
#in order to install the training tools you need these libraries:
sudo apt-get install libicu-dev
sudo apt-get install libpango1.0-dev
sudo apt-get install libcairo2-dev
http://www.leptonica.org/
wget http://www.leptonica.org/source/leptonica-1.74.4.tar.gz
mkdir tesseract
mv leptonica-1.7.4.tar ./tesseract
cd tesseract
gunzip leptonica-1.74.4.tar.gz
tar -xvf leptonica-1.74.4.tar.gz
mkdir build
cd build
../configure
make
sudo make install
make -j4 check
cd tesseract/
wget https://github.com/tesseract-ocr/tesseract/archive/4.0.0-beta.1.tar.gz
gunzip 4.0.0-beta.1.tar.gz
tar -xvf 4.0.0-beta.1.tar
rm 4.0.0-beta.1.tar
cd tesseract-4.0.0-beta.1/
./autogen.sh
LIBLEPT_HEADERSDIR=/usr/local/include/leptonica ./configure --prefix=/usr/local/ --with-extra-libraries=/usr/local/lib
make
sudo make install
sudo ldconfig
make training
sudo make training-install
wget https://github.com/tesseract-ocr/tessdata/raw/4.00/eng.traineddata
mv eng.traineddata ./tessdata/
cd tessdata/
export TESSDATA_PREFIX=/home/odroid/tesseract/tesseract-4.0.0-beta.1/tessdata/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The input files must be named accordingly to the Tesseract convention:
[language name].[font name].exp[number].[file extension]
Bug in Box Editor
Current Behavior:
Tesseract header files since commit da03e4e added the use of string in the unichar.h header file that is used during compilation by tesserocr. This causes the compilation of tesserocr to throw an error because the std library is not imported.
In file included from tesserocr.cpp:484:0:
/usr/local/include/tesseract/unichar.h:164:10: error: ‘string’ does not name a type
static string UTF32ToUTF8(const std::vector<char32>& str32);
^
Changing static string UTF32ToUTF8(const std::vector<char32>& str32); to static std::string UTF32ToUTF8(const std::vector<char32>& str32); in /usr/local/include/tesseract/unichar.h:164 fixes the problem for me.
I am aware that you do not provide support for product that aren't the command-line Tesseract but I thought you might want to know since it worked before the commit.
eng.ocrb.exp0.png
eng.ocrb.exp1.png
eng.ocrb.exp2.png
create the box files
run box_script.sh
==Getting a Text Box Editor==
REQUIREMENTS
============
* QT4 (tested with QT-4.7.3, QT-4.8.2)
* leptonica library
* tesseract 3.01 or 3.02 build as library
Obs.: In case you're compiling it with QT5 >= then you must to install libqt5svg5-dev/libqt5svg5-devel
BUILDING
========
adjust location of leptonica and tesseract in qt-box-editor.pro
qmake
make
BUILDING ON UBUNTU
==================
sudo apt-get install qt5-qmake
sudo apt-get install qt5-default
sudo apt-get install libqt5gui5
sudo apt-get install qt5-doc
sudo apt-get install libqt5svg5-dev
sudo apt-get install libleptonica-dev
qmake -qt=5
make
There may appear a bug during the compilation process, just go here on how to fix it, if you encounter it:
https://github.com/zdenop/qt-box-editor/issues/61
Use conversion_script.sh
Remove old files
rm pol.pffmtable pol.shapetable pol.traineddata pol.unicharset unicharset font_properties pol.inttemp pol.normproto *.tr *.txt
Use train_script.sh
Then we are going to extract the charset from the box files (the command creates a “unicharset” file).
unicharset_extractor `wrap $N "eng.ocrb.exp" ".box"`
Next we need to create a font_properties file.
echo "ocrb 0 0 1 0 0" > font_properties # tell Tesseract informations about the font
mftraining -F font_properties -U unicharset -O eng.unicharset `wrap $N "eng.ocrb.exp" ".tr"`
cntraining `wrap $N "eng.ocrb.exp" ".tr"`
$ cd ~
$ wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.4.1.zip
$ unzip opencv.zip
$ cd opencv
$ wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.4.1.zip
$ unzip opencv_contrib.zip
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.1/modules -D BUILD_EXAMPLES=ON ..
$ make -j4
$ sudo make install
$ sudo ldconfig
https://www.youtube.com/watch?v=esyYZ-H6jg8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment