~matthill/openalpr/master

« back to all changes in this revision

Viewing changes to src/openalpr/ocr/segmentation/histogram.h

  • Committer: Matt Hill
  • Date: 2016-07-02 14:27:26 UTC
  • Revision ID: git-v1:b6469b015e923bf7d15b5c823964d29c1b860f17
Moved segmentation code to inside OCR

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2015 OpenALPR Technology, Inc.
 
3
 * Open source Automated License Plate Recognition [http://www.openalpr.com]
 
4
 *
 
5
 * This file is part of OpenALPR.
 
6
 *
 
7
 * OpenALPR is free software: you can redistribute it and/or modify
 
8
 * it under the terms of the GNU Affero General Public License
 
9
 * version 3 as published by the Free Software Foundation
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU Affero General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Affero General Public License
 
17
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 
18
*/
 
19
 
 
20
#ifndef OPENALPR_HISTOGRAM_H
 
21
#define OPENALPR_HISTOGRAM_H
 
22
 
 
23
#include "opencv2/imgproc/imgproc.hpp"
 
24
#include "utility.h"
 
25
 
 
26
namespace alpr
 
27
{
 
28
 
 
29
  class Histogram
 
30
  {
 
31
  public:
 
32
    Histogram();
 
33
    virtual ~Histogram();
 
34
 
 
35
    cv::Mat histoImg;
 
36
 
 
37
    // Returns the lowest X position between two points.
 
38
    int getLocalMinimum(int leftX, int rightX);
 
39
    // Returns the highest X position between two points.
 
40
    int getLocalMaximum(int leftX, int rightX);
 
41
 
 
42
    int getHeightAt(int x);
 
43
 
 
44
    std::vector<std::pair<int, int> > get1DHits(int yOffset);
 
45
 
 
46
  protected:
 
47
 
 
48
    std::vector<int> colHeights;
 
49
 
 
50
 
 
51
    void analyzeImage(cv::Mat inputImage, cv::Mat mask, bool use_y_axis);
 
52
 
 
53
    int detect_peak(const double *data, int data_count, int *emi_peaks,
 
54
                    int *num_emi_peaks, int max_emi_peaks, int *absop_peaks,
 
55
                    int *num_absop_peaks, int max_absop_peaks, double delta,
 
56
                    int emi_first);
 
57
  };
 
58
 
 
59
}
 
60
#endif //OPENALPR_HISTOGRAM_H