+#ifndef __GLOBALHISTOGRAMBINARIZER_H__
+#define __GLOBALHISTOGRAMBINARIZER_H__
/*
* GlobalHistogramBinarizer.h
* zxing
*
- * Created by Ralf Kistner on 16/10/2009.
- * Copyright 2008 ZXing authors All rights reserved.
+ * Copyright 2010 ZXing authors All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#ifndef GLOBALHISTOGRAMBINARIZER_H_
-#define GLOBALHISTOGRAMBINARIZER_H_
-
-#include <valarray>
+#include <vector>
#include <zxing/Binarizer.h>
+#include <zxing/common/BitArray.h>
#include <zxing/common/BitMatrix.h>
namespace zxing {
+
+ class GlobalHistogramBinarizer : public Binarizer {
+ private:
+ Ref<BitMatrix> cached_matrix_;
+ Ref<BitArray> cached_row_;
+ int cached_row_num_;
-class GlobalHistogramBinarizer : public Binarizer {
-public:
- GlobalHistogramBinarizer(Ref<LuminanceSource> source);
- virtual ~GlobalHistogramBinarizer();
-
- virtual Ref<BitMatrix> estimateBlackMatrix();
- static int estimate(std::valarray<int> &histogram);
-};
-
+ public:
+ GlobalHistogramBinarizer(Ref<LuminanceSource> source);
+ virtual ~GlobalHistogramBinarizer();
+
+ virtual Ref<BitArray> getBlackRow(int y, Ref<BitArray> row);
+ virtual Ref<BitMatrix> getBlackMatrix();
+ static int estimate(std::vector<int> &histogram);
+ Ref<Binarizer> createBinarizer(Ref<LuminanceSource> source);
+ };
+
}
#endif /* GLOBALHISTOGRAMBINARIZER_H_ */