widths2bars.h

来自「barcode readers [ from Image]」· C头文件 代码 · 共 75 行

H
75
字号
//
// Given an array of edge positions and strengths compute a string
// representing the bar code widths corresponding to those edge
// positions.
//
// Copyright (C) 2006 by Jon A. Webb (Contact via GMail; username is jonawebb)
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//

#ifndef Widths2Bars_h
#define Widths2Bars_h

#include <e32cons.h>
#include <e32math.h>

namespace Algorithm
{
	class CWidths2Bars: public CBase
    {
        // Lifecycle
    public:
        IMPORT_C static CWidths2Bars* NewL(TReal rMinWidth, TReal rMaxWidth, TReal rEps, int nMinBars);
        ~CWidths2Bars(void);

    private:
		// Constructor
		//   rMinWidth: minimum bar width in pixels
		//   rMaxWidth: maximum bar width in multiple of minimum bar widths
		//   rEps: flexibility in determining minimum bar width
		//   nMinStrength: minimum edge strength
		//   nMinBars: minimum number of bars
        CWidths2Bars(TReal rMinWidth, TReal rMaxWidth, TReal rEps, int nMinBars);

        // Operations
    public:
        // FindBarsL
		//   Given two arrays, one of bar edges and the other of bar edge strengths, produce
		//   a string representing the bars in the the input.
        //
		// Input
		//  pPositions is an array of bar edges
		//  pStrengths is an array of bar edge strengths
		// Output
		//  pBars is a string representing the bar widths, with 1 = shortest, 2 = twice the shortest, up to 9
        IMPORT_C bool FindBarsL(
				CArrayFix<TReal>* pPositions, 
				CArrayFix<char>*& pBars, 
				int& nBarStart, 
				int& nBarEnd);

    private:
        // Attributes
		int inMinBars;
		TReal irEps;
		TReal irMaxWidth;
        TReal irMinWidth;
    };

}; // namespace Algorithm

#endif // Widths2Bars_h

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?