mirror of
https://github.com/zxing/zxing.git
synced 2025-01-13 04:07:27 -08:00
c++ version of r2344
git-svn-id: https://zxing.googlecode.com/svn/trunk@2346 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
d19176ec5f
commit
88a46d0773
|
@ -33,5 +33,13 @@ namespace zxing {
|
|||
Ref<LuminanceSource> Binarizer::getLuminanceSource() const {
|
||||
return source_;
|
||||
}
|
||||
|
||||
int Binarizer::getWidth() const {
|
||||
return source_->getWidth();
|
||||
}
|
||||
|
||||
int Binarizer::getHeight() const {
|
||||
return source_->getHeight();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,6 +40,10 @@ class Binarizer : public Counted {
|
|||
|
||||
Ref<LuminanceSource> getLuminanceSource() const ;
|
||||
virtual Ref<Binarizer> createBinarizer(Ref<LuminanceSource> source) = 0;
|
||||
|
||||
int getWidth() const;
|
||||
int getHeight() const;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -42,10 +42,14 @@ Detector::Detector(Ref<BitMatrix> image) :
|
|||
image_(image) {
|
||||
}
|
||||
|
||||
Ref<BitMatrix> Detector::getImage() {
|
||||
Ref<BitMatrix> Detector::getImage() const {
|
||||
return image_;
|
||||
}
|
||||
|
||||
Ref<ResultPointCallback> Detector::getResultPointCallback() const {
|
||||
return callback_;
|
||||
}
|
||||
|
||||
Ref<DetectorResult> Detector::detect(DecodeHints const& hints) {
|
||||
callback_ = hints.getResultPointCallback();
|
||||
FinderPatternFinder finder(image_, hints.getResultPointCallback());
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
#ifndef __DETECTOR_H__
|
||||
#define __DETECTOR_H__
|
||||
|
||||
|
@ -40,7 +41,8 @@ private:
|
|||
Ref<ResultPointCallback> callback_;
|
||||
|
||||
protected:
|
||||
Ref<BitMatrix> getImage();
|
||||
Ref<BitMatrix> getImage() const;
|
||||
Ref<ResultPointCallback> getResultPointCallback() const;
|
||||
|
||||
static Ref<BitMatrix> sampleGrid(Ref<BitMatrix> image, int dimension, Ref<PerspectiveTransform>);
|
||||
static int computeDimension(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft,
|
||||
|
@ -53,14 +55,15 @@ protected:
|
|||
float allowanceFactor);
|
||||
Ref<DetectorResult> processFinderPatternInfo(Ref<FinderPatternInfo> info);
|
||||
public:
|
||||
|
||||
virtual Ref<PerspectiveTransform> createTransform(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref <
|
||||
ResultPoint > bottomLeft, Ref<ResultPoint> alignmentPattern, int dimension);
|
||||
|
||||
Detector(Ref<BitMatrix> image);
|
||||
Ref<DetectorResult> detect(DecodeHints const& hints);
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __DETECTOR_H__
|
||||
#endif // __DETECTOR_H__
|
||||
|
|
|
@ -32,9 +32,10 @@ namespace zxing {
|
|||
float estimatedModuleSize_;
|
||||
int count_;
|
||||
|
||||
FinderPattern(float posX, float posY, float estimatedModuleSize, int count);
|
||||
|
||||
public:
|
||||
FinderPattern(float posX, float posY, float estimatedModuleSize);
|
||||
FinderPattern(float posX, float posY, float estimatedModuleSize, int count);
|
||||
int getCount() const;
|
||||
float getEstimatedModuleSize() const;
|
||||
void incrementCount();
|
||||
|
|
|
@ -537,5 +537,14 @@ Ref<FinderPatternInfo> FinderPatternFinder::find(DecodeHints const& hints) {
|
|||
Ref<FinderPatternInfo> result(new FinderPatternInfo(patternInfo));
|
||||
return result;
|
||||
}
|
||||
|
||||
Ref<BitMatrix> FinderPatternFinder::getImage() {
|
||||
return image_;
|
||||
}
|
||||
|
||||
std::vector<Ref<FinderPattern> >& FinderPatternFinder::getPossibleCenters() {
|
||||
return possibleCenters_;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
#ifndef __FINDER_PATTERN_FINDER_H__
|
||||
#define __FINDER_PATTERN_FINDER_H__
|
||||
|
||||
|
@ -60,6 +61,10 @@ protected:
|
|||
bool haveMultiplyConfirmedCenters();
|
||||
std::vector<Ref<FinderPattern> > selectBestPatterns();
|
||||
static std::vector<Ref<FinderPattern> > orderBestPatterns(std::vector<Ref<FinderPattern> > patterns);
|
||||
|
||||
Ref<BitMatrix> getImage();
|
||||
std::vector<Ref<FinderPattern> >& getPossibleCenters();
|
||||
|
||||
public:
|
||||
static float distance(Ref<ResultPoint> p1, Ref<ResultPoint> p2);
|
||||
FinderPatternFinder(Ref<BitMatrix> image, Ref<ResultPointCallback>const&);
|
||||
|
|
Loading…
Reference in a new issue