Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: AsciiFont DisplayApp GR-PEACH_video LCD_shield_config LWIPBP3595Interface_STA_for_mbed-os USBDevice
HybridBinarizer.h
00001 // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 00002 #ifndef __HYBRIDBINARIZER_H__ 00003 #define __HYBRIDBINARIZER_H__ 00004 /* 00005 * HybridBinarizer.h 00006 * zxing 00007 * 00008 * Copyright 2010 ZXing authors All rights reserved. 00009 * 00010 * Licensed under the Apache License, Version 2.0 (the "License"); 00011 * you may not use this file except in compliance with the License. 00012 * You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, software 00017 * distributed under the License is distributed on an "AS IS" BASIS, 00018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 * See the License for the specific language governing permissions and 00020 * limitations under the License. 00021 */ 00022 00023 #include <vector> 00024 #include <zxing/Binarizer.h> 00025 #include <zxing/common/GlobalHistogramBinarizer.h> 00026 #include <zxing/common/BitArray.h> 00027 #include <zxing/common/BitMatrix.h> 00028 00029 namespace zxing { 00030 00031 class HybridBinarizer : public GlobalHistogramBinarizer { 00032 private: 00033 Ref<BitMatrix> matrix_; 00034 Ref<BitArray> cached_row_; 00035 00036 public: 00037 HybridBinarizer(Ref<LuminanceSource> source); 00038 virtual ~HybridBinarizer(); 00039 00040 virtual Ref<BitMatrix> getBlackMatrix(); 00041 Ref<Binarizer> createBinarizer(Ref<LuminanceSource> source); 00042 private: 00043 // We'll be using one-D arrays because C++ can't dynamically allocate 2D 00044 // arrays 00045 ArrayRef<int> calculateBlackPoints(ArrayRef<char> luminances, 00046 int subWidth, 00047 int subHeight, 00048 int width, 00049 int height); 00050 void calculateThresholdForBlock(ArrayRef<char> luminances, 00051 int subWidth, 00052 int subHeight, 00053 int width, 00054 int height, 00055 ArrayRef<int> blackPoints, 00056 Ref<BitMatrix> const& matrix); 00057 void thresholdBlock(ArrayRef<char>luminances, 00058 int xoffset, 00059 int yoffset, 00060 int threshold, 00061 int stride, 00062 Ref<BitMatrix> const& matrix); 00063 }; 00064 00065 } 00066 00067 #endif
Generated on Thu Jul 14 2022 21:25:54 by
1.7.2