Skip to content

Commit

Permalink
Merge pull request #1260 from hotchkiss87:correct_spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek committed Jun 30, 2017
2 parents 003097e + 574e200 commit 07fb53c
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 65 deletions.
6 changes: 3 additions & 3 deletions modules/text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Here are instructions on how to install Tesseract on your machine (Linux or Mac;
Tesseract installation instruction (Linux, Mac)
-----------------------------------------------

0. Linux users may try to install tesseract-3.03-rc1 (or later) and leptonica-1.70 (or later) with the corresponding developement packages using their package manager. Mac users may try brew. The instructions below are for those who wants to build tesseract from source.
0. Linux users may try to install tesseract-3.03-rc1 (or later) and leptonica-1.70 (or later) with the corresponding development packages using their package manager. Mac users may try brew. The instructions below are for those who wants to build tesseract from source.

1. download leptonica 1.70 tarball (helper image processing library, used by tesseract. Later versions might work too):
http://www.leptonica.com/download.html
Expand All @@ -33,9 +33,9 @@ mkdir build && cd build
../configure --with-extra-includes=/usr/local --with-extra-libraries=/usr/local
make && sudo make install

tessract will be installed to /usr/local.
Tesseract will be installed to /usr/local.

3. download the pre-trained classifier data for english language:
3. download the pre-trained classifier data for English language:
https://code.google.com/p/tesseract-ocr/downloads/detail?name=eng.traineddata.gz

unzip it (gzip -d eng.traineddata.gz) and copy to /usr/local/share/tessdata.
Expand Down
4 changes: 2 additions & 2 deletions modules/text/include/opencv2/text.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ hierarchy by their inclusion relation:
![image](pics/component_tree.png)
The component tree may conatain a huge number of regions even for a very simple image as shown in
The component tree may contain a huge number of regions even for a very simple image as shown in
the previous image. This number can easily reach the order of 1 x 10\^6 regions for an average 1
Megapixel image. In order to efficiently select suitable regions among all the ERs the algorithm
make use of a sequential classifier with two differentiated stages.
In the first stage incrementally computable descriptors (area, perimeter, bounding box, and euler
In the first stage incrementally computable descriptors (area, perimeter, bounding box, and Euler's
number) are computed (in O(1)) for each region r and used as features for a classifier which
estimates the class-conditional probability p(r|character). Only the ERs which correspond to local
maximum of the probability p(r|character) are selected (if their probability is above a global limit
Expand Down
8 changes: 4 additions & 4 deletions modules/text/include/opencv2/text/erfilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct CV_EXPORTS ERStat
//! incrementally computable features
int area;
int perimeter;
int euler; //!< euler number
int euler; //!< Euler's number
Rect rect;
double raw_moments[2]; //!< order 1 raw moments to derive the centroid
double central_moments[3]; //!< order 2 central moments to construct the covariance matrix
Expand All @@ -105,7 +105,7 @@ struct CV_EXPORTS ERStat
ERStat* next;
ERStat* prev;

//! wenever the regions is a local maxima of the probability
//! whenever the regions is a local maxima of the probability
bool local_maxima;
ERStat* max_probability_ancestor;
ERStat* min_probability_ancestor;
Expand Down Expand Up @@ -317,7 +317,7 @@ enum erGrouping_Modes {
@param channels Vector of single channel images CV_8UC1 from wich the regions were extracted.
@param regions Vector of ER's retreived from the ERFilter algorithm from each channel.
@param regions Vector of ER's retrieved from the ERFilter algorithm from each channel.
@param groups The output of the algorithm is stored in this parameter as set of lists of indexes to
provided regions.
Expand Down Expand Up @@ -353,7 +353,7 @@ CV_EXPORTS_W void erGrouping(InputArray image, InputArray channel,
@param image Source image CV_8UC1 from which the MSERs where extracted.
@param contours Intput vector with all the contours (vector\<Point\>).
@param contours Input vector with all the contours (vector\<Point\>).
@param regions Output where the ERStat regions are stored.
Expand Down
44 changes: 22 additions & 22 deletions modules/text/include/opencv2/text/ocr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class CV_EXPORTS_W OCRTesseract : public BaseOCR
@param language an ISO 639-3 code or NULL will default to "eng".
@param char_whitelist specifies the list of characters used for recognition. NULL defaults to
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".
@param oem tesseract-ocr offers different OCR Engine Modes (OEM), by deffault
@param oem tesseract-ocr offers different OCR Engine Modes (OEM), by default
tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible
values.
@param psmode tesseract-ocr offers different Page Segmentation Modes (PSM) tesseract::PSM_AUTO
Expand Down Expand Up @@ -195,7 +195,7 @@ class CV_EXPORTS_W OCRHMMDecoder : public BaseOCR
This way it hides the feature extractor and the classifier itself, so developers can write
their own OCR code.
The default character classifier and feature extractor can be loaded using the utility funtion
The default character classifier and feature extractor can be loaded using the utility function
loadOCRHMMClassifierNM and KNN model provided in
<https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/OCRHMM_knn_model_data.xml.gz>.
*/
Expand Down Expand Up @@ -289,21 +289,21 @@ class CV_EXPORTS_W OCRHMMDecoder : public BaseOCR
(<http://en.wikipedia.org/wiki/Viterbi_algorithm>).
*/
static Ptr<OCRHMMDecoder> create(const Ptr<OCRHMMDecoder::ClassifierCallback> classifier,// The character classifier with built in feature extractor
const std::string& vocabulary, // The language vocabulary (chars when ascii english text)
const std::string& vocabulary, // The language vocabulary (chars when ASCII English text)
// size() must be equal to the number of classes
InputArray transition_probabilities_table, // Table with transition probabilities between character pairs
// cols == rows == vocabulari.size()
// cols == rows == vocabulary.size()
InputArray emission_probabilities_table, // Table with observation emission probabilities
// cols == rows == vocabulari.size()
// cols == rows == vocabulary.size()
decoder_mode mode = OCR_DECODER_VITERBI); // HMM Decoding algorithm (only Viterbi for the moment)

CV_WRAP static Ptr<OCRHMMDecoder> create(const Ptr<OCRHMMDecoder::ClassifierCallback> classifier,// The character classifier with built in feature extractor
const String& vocabulary, // The language vocabulary (chars when ascii english text)
const String& vocabulary, // The language vocabulary (chars when ASCII English text)
// size() must be equal to the number of classes
InputArray transition_probabilities_table, // Table with transition probabilities between character pairs
// cols == rows == vocabulari.size()
// cols == rows == vocabulary.size()
InputArray emission_probabilities_table, // Table with observation emission probabilities
// cols == rows == vocabulari.size()
// cols == rows == vocabulary.size()
int mode = OCR_DECODER_VITERBI); // HMM Decoding algorithm (only Viterbi for the moment)

/** @brief Creates an instance of the OCRHMMDecoder class. Loads and initializes HMMDecoder from the specified path
Expand All @@ -312,12 +312,12 @@ class CV_EXPORTS_W OCRHMMDecoder : public BaseOCR
*/
CV_WRAP static Ptr<OCRHMMDecoder> create(const String& filename,

const String& vocabulary, // The language vocabulary (chars when ascii english text)
const String& vocabulary, // The language vocabulary (chars when ASCII English text)
// size() must be equal to the number of classes
InputArray transition_probabilities_table, // Table with transition probabilities between character pairs
// cols == rows == vocabulari.size()
// cols == rows == vocabulary.size()
InputArray emission_probabilities_table, // Table with observation emission probabilities
// cols == rows == vocabulari.size()
// cols == rows == vocabulary.size()
int mode = OCR_DECODER_VITERBI, // HMM Decoding algorithm (only Viterbi for the moment)

int classifier = OCR_KNN_CLASSIFIER); // The character classifier type
Expand Down Expand Up @@ -371,7 +371,7 @@ CV_EXPORTS_W Ptr<OCRHMMDecoder::ClassifierCallback> loadOCRHMMClassifier(const S

/** @brief Utility function to create a tailored language model transitions table from a given list of words (lexicon).
*
* @param vocabulary The language vocabulary (chars when ascii english text).
* @param vocabulary The language vocabulary (chars when ASCII English text).
*
* @param lexicon The list of words that are expected to be found in a particular image.
*
Expand Down Expand Up @@ -466,7 +466,7 @@ class CV_EXPORTS_W OCRBeamSearchDecoder : public BaseOCR
@param classifier The character classifier with built in feature extractor.
@param vocabulary The language vocabulary (chars when ascii english text). vocabulary.size()
@param vocabulary The language vocabulary (chars when ASCII English text). vocabulary.size()
must be equal to the number of classes of the classifier.
@param transition_probabilities_table Table with transition probabilities between character
Expand All @@ -481,22 +481,22 @@ class CV_EXPORTS_W OCRBeamSearchDecoder : public BaseOCR
@param beam_size Size of the beam in Beam Search algorithm.
*/
static Ptr<OCRBeamSearchDecoder> create(const Ptr<OCRBeamSearchDecoder::ClassifierCallback> classifier,// The character classifier with built in feature extractor
const std::string& vocabulary, // The language vocabulary (chars when ascii english text)
const std::string& vocabulary, // The language vocabulary (chars when ASCII English text)
// size() must be equal to the number of classes
InputArray transition_probabilities_table, // Table with transition probabilities between character pairs
// cols == rows == vocabulari.size()
// cols == rows == vocabulary.size()
InputArray emission_probabilities_table, // Table with observation emission probabilities
// cols == rows == vocabulari.size()
// cols == rows == vocabulary.size()
decoder_mode mode = OCR_DECODER_VITERBI, // HMM Decoding algorithm (only Viterbi for the moment)
int beam_size = 500); // Size of the beam in Beam Search algorithm

CV_WRAP static Ptr<OCRBeamSearchDecoder> create(const Ptr<OCRBeamSearchDecoder::ClassifierCallback> classifier, // The character classifier with built in feature extractor
const String& vocabulary, // The language vocabulary (chars when ascii english text)
const String& vocabulary, // The language vocabulary (chars when ASCII English text)
// size() must be equal to the number of classes
InputArray transition_probabilities_table, // Table with transition probabilities between character pairs
// cols == rows == vocabulari.size()
// cols == rows == vocabulary.size()
InputArray emission_probabilities_table, // Table with observation emission probabilities
// cols == rows == vocabulari.size()
// cols == rows == vocabulary.size()
int mode = OCR_DECODER_VITERBI, // HMM Decoding algorithm (only Viterbi for the moment)
int beam_size = 500); // Size of the beam in Beam Search algorithm

Expand All @@ -506,12 +506,12 @@ class CV_EXPORTS_W OCRBeamSearchDecoder : public BaseOCR
*/
CV_WRAP static Ptr<OCRBeamSearchDecoder> create(const String& filename, // The character classifier file
const String& vocabulary, // The language vocabulary (chars when ascii english text)
const String& vocabulary, // The language vocabulary (chars when ASCII English text)
// size() must be equal to the number of classes
InputArray transition_probabilities_table, // Table with transition probabilities between character pairs
// cols == rows == vocabulari.size()
// cols == rows == vocabulary.size()
InputArray emission_probabilities_table, // Table with observation emission probabilities
// cols == rows == vocabulari.size()
// cols == rows == vocabulary.size()
int mode = OCR_DECODER_VITERBI, // HMM Decoding algorithm (only Viterbi for the moment)
int beam_size = 500);
protected:
Expand Down
2 changes: 1 addition & 1 deletion modules/text/samples/character_recognition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int main(int argc, char* argv[])
return(0);
}

string vocabulary = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; // must have the same order as the clasifier output classes
string vocabulary = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; // must have the same order as the classifier output classes

Ptr<OCRHMMDecoder::ClassifierCallback> ocr = loadOCRHMMClassifierCNN("OCRBeamSearch_CNN_model_data.xml.gz");

Expand Down
4 changes: 2 additions & 2 deletions modules/text/samples/cropped_word_recognition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int argc, char* argv[])
return(0);
}

string vocabulary = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; // must have the same order as the clasifier output classes
string vocabulary = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; // must have the same order as the classifier output classes
vector<string> lexicon; // a list of words expected to be found on the input image
lexicon.push_back(string("abb"));
lexicon.push_back(string("riser"));
Expand All @@ -53,7 +53,7 @@ int main(int argc, char* argv[])
createOCRHMMTransitionsTable(vocabulary,lexicon,transition_p);

// An alternative would be to load the default generic language model
// (created from ispell 42869 english words list)
// (created from ispell 42869 English words list)
/*Mat transition_p;
string filename = "OCRHMM_transitions_table.xml";
FileStorage fs(filename, FileStorage::READ);
Expand Down
4 changes: 2 additions & 2 deletions modules/text/samples/end_to_end_recognition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ using namespace std;
using namespace cv;
using namespace cv::text;

//Calculate edit distance netween two words
//Calculate edit distance between two words
size_t edit_distance(const string& A, const string& B);
size_t min(size_t x, size_t y, size_t z);
bool isRepetitive(const string& s);
Expand Down Expand Up @@ -164,7 +164,7 @@ int main(int argc, char* argv[])
cout << "TIME_OCR = " << ((double)getTickCount() - t_r)*1000/getTickFrequency() << endl;


/* Recognition evaluation with (approximate) hungarian matching and edit distances */
/* Recognition evaluation with (approximate) Hungarian matching and edit distances */

if(argc>2)
{
Expand Down
2 changes: 1 addition & 1 deletion modules/text/samples/segmented_word_recognition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ int main(int argc, char* argv[]) {
else
image.copyTo(mask);

// be sure the mask is a binry image
// be sure the mask is a binary image
cvtColor(mask, mask, COLOR_BGR2GRAY);
threshold(mask, mask, 128., 255, THRESH_BINARY);

Expand Down
2 changes: 1 addition & 1 deletion modules/text/samples/webcam_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ int main(int argc, char* argv[])
{

outputs[i].erase(remove(outputs[i].begin(), outputs[i].end(), '\n'), outputs[i].end());
//cout << "OCR output = \"" << outputs[i] << "\" lenght = " << outputs[i].size() << endl;
//cout << "OCR output = \"" << outputs[i] << "\" length = " << outputs[i].size() << endl;
if (outputs[i].size() < 3)
continue;

Expand Down
Loading

0 comments on commit 07fb53c

Please sign in to comment.