// // Copyright 2020 FoxyUtils ehf. All rights reserved. // // This is a commercial product and requires a license to operate. // A trial license can be obtained at https://unidoc.io // // DO NOT EDIT: generated by unitwist Go source code obfuscator. // // Use of this source code is governed by the UniDoc End User License Agreement // terms that can be accessed at https://unidoc.io/eula/ package classer ;import (_d "github.com/unidoc/unipdf/v3/common";_cb "github.com/unidoc/unipdf/v3/internal/jbig2/basic";_b "github.com/unidoc/unipdf/v3/internal/jbig2/bitmap";_e "github.com/unidoc/unipdf/v3/internal/jbig2/errors";_g "image";_ce "math";);func (_fcfc *Classer )classifyRankHouseNonOne (_bce *_b .Boxes ,_fda ,_daa ,_ceb *_b .Bitmaps ,_bdbg *_b .Points ,_fgg *_cb .NumSlice ,_bfb int )(_fca error ){const _feb ="\u0043\u006c\u0061\u0073s\u0065\u0072\u002e\u0063\u006c\u0061\u0073\u0073\u0069\u0066y\u0052a\u006e\u006b\u0048\u006f\u0075\u0073\u0065O\u006e\u0065";var (_aec ,_ace ,_dgfg ,_adg float32 ;_dad ,_dagd ,_gdd int ;_decg ,_ceed ,_cae ,_cfb ,_dce *_b .Bitmap ;_bdbc ,_baa bool ;);_ceba :=_b .MakePixelSumTab8 ();for _bdc :=0;_bdc < len (_fda .Values );_bdc ++{if _ceed ,_fca =_daa .GetBitmap (_bdc );_fca !=nil {return _e .Wrap (_fca ,_feb ,"b\u006d\u0073\u0031\u002e\u0047\u0065\u0074\u0028\u0069\u0029");};if _dad ,_fca =_fgg .GetInt (_bdc );_fca !=nil {_d .Log .Trace ("\u0047\u0065t\u0074\u0069\u006e\u0067 \u0046\u0047T\u0065\u006d\u0070\u006c\u0061\u0074\u0065\u0073 \u0061\u0074\u003a\u0020\u0025\u0064\u0020\u0066\u0061\u0069\u006c\u0065d\u003a\u0020\u0025\u0076",_bdc ,_fca );};if _cae ,_fca =_ceb .GetBitmap (_bdc );_fca !=nil {return _e .Wrap (_fca ,_feb ,"b\u006d\u0073\u0032\u002e\u0047\u0065\u0074\u0028\u0069\u0029");};if _aec ,_ace ,_fca =_bdbg .GetGeometry (_bdc );_fca !=nil {return _e .Wrapf (_fca ,_feb ,"\u0070t\u0061[\u0069\u005d\u002e\u0047\u0065\u006f\u006d\u0065\u0074\u0072\u0079");};_adgd :=len (_fcfc .UndilatedTemplates .Values );_bdbc =false ;_ffe :=_edd (_fcfc ,_ceed );for _gdd =_ffe .Next ();_gdd > -1;{if _cfb ,_fca =_fcfc .UndilatedTemplates .GetBitmap (_gdd );_fca !=nil {return _e .Wrap (_fca ,_feb ,"\u0070\u0069\u0078\u0061\u0074\u002e\u005b\u0069\u0043l\u0061\u0073\u0073\u005d");};if _dagd ,_fca =_fcfc .FgTemplates .GetInt (_gdd );_fca !=nil {_d .Log .Trace ("\u0047\u0065\u0074\u0074\u0069\u006eg\u0020\u0046\u0047\u0054\u0065\u006d\u0070\u006c\u0061\u0074\u0065\u005b\u0025d\u005d\u0020\u0066\u0061\u0069\u006c\u0065d\u003a\u0020\u0025\u0076",_gdd ,_fca );};if _dce ,_fca =_fcfc .DilatedTemplates .GetBitmap (_gdd );_fca !=nil {return _e .Wrap (_fca ,_feb ,"\u0070\u0069\u0078\u0061\u0074\u0064\u005b\u0069\u0043l\u0061\u0073\u0073\u005d");};if _dgfg ,_adg ,_fca =_fcfc .CentroidPointsTemplates .GetGeometry (_gdd );_fca !=nil {return _e .Wrap (_fca ,_feb ,"\u0043\u0065\u006et\u0072\u006f\u0069\u0064P\u006f\u0069\u006e\u0074\u0073\u0054\u0065m\u0070\u006c\u0061\u0074\u0065\u0073\u005b\u0069\u0043\u006c\u0061\u0073\u0073\u005d");};_baa ,_fca =_b .RankHausTest (_ceed ,_cae ,_cfb ,_dce ,_aec -_dgfg ,_ace -_adg ,MaxDiffWidth ,MaxDiffHeight ,_dad ,_dagd ,float32 (_fcfc .Settings .RankHaus ),_ceba );if _fca !=nil {return _e .Wrap (_fca ,_feb ,"");};if _baa {_bdbc =true ;if _fca =_fcfc .ClassIDs .Add (_gdd );_fca !=nil {return _e .Wrap (_fca ,_feb ,"");};if _fca =_fcfc .ComponentPageNumbers .Add (_bfb );_fca !=nil {return _e .Wrap (_fca ,_feb ,"");};if _fcfc .Settings .KeepClassInstances {_ffc ,_fdg :=_fcfc .ClassInstances .GetBitmaps (_gdd );if _fdg !=nil {return _e .Wrap (_fdg ,_feb ,"\u0063\u002e\u0050\u0069\u0078\u0061\u0061\u002e\u0047\u0065\u0074B\u0069\u0074\u006d\u0061\u0070\u0073\u0028\u0069\u0043\u006ca\u0073\u0073\u0029");};if _decg ,_fdg =_fda .GetBitmap (_bdc );_fdg !=nil {return _e .Wrap (_fdg ,_feb ,"\u0070i\u0078\u0061\u005b\u0069\u005d");};_ffc .Values =append (_ffc .Values ,_decg );_aeaa ,_fdg :=_bce .Get (_bdc );if _fdg !=nil {return _e .Wrap (_fdg ,_feb ,"b\u006f\u0078\u0061\u002e\u0047\u0065\u0074\u0028\u0069\u0029");};_ffc .Boxes =append (_ffc .Boxes ,_aeaa );};break ;};};if !_bdbc {if _fca =_fcfc .ClassIDs .Add (_adgd );_fca !=nil {return _e .Wrap (_fca ,_feb ,"\u0021\u0066\u006f\u0075\u006e\u0064");};if _fca =_fcfc .ComponentPageNumbers .Add (_bfb );_fca !=nil {return _e .Wrap (_fca ,_feb ,"\u0021\u0066\u006f\u0075\u006e\u0064");};_bebc :=&_b .Bitmaps {};_decg =_fda .Values [_bdc ];_bebc .AddBitmap (_decg );_egea ,_efaf :=_decg .Width ,_decg .Height ;_fcfc .TemplatesSize .Add (uint64 (_egea )*uint64 (_efaf ),_adgd );_afbe ,_bbc :=_bce .Get (_bdc );if _bbc !=nil {return _e .Wrap (_bbc ,_feb ,"\u0021\u0066\u006f\u0075\u006e\u0064");};_bebc .AddBox (_afbe );_fcfc .ClassInstances .AddBitmaps (_bebc );_fcfc .CentroidPointsTemplates .AddPoint (_aec ,_ace );_fcfc .UndilatedTemplates .AddBitmap (_ceed );_fcfc .DilatedTemplates .AddBitmap (_cae );_fcfc .FgTemplates .AddInt (_dad );};};_fcfc .NumberOfClasses =len (_fcfc .UndilatedTemplates .Values );return nil ;};func (_a *Classer )AddPage (inputPage *_b .Bitmap ,pageNumber int ,method Method )(_gg error ){const _ad ="\u0043l\u0061s\u0073\u0065\u0072\u002e\u0041\u0064\u0064\u0050\u0061\u0067\u0065";_a .Widths [pageNumber ]=inputPage .Width ;_a .Heights [pageNumber ]=inputPage .Height ;if _gg =_a .verifyMethod (method );_gg !=nil {return _e .Wrap (_gg ,_ad ,"");};_df ,_f ,_gg :=inputPage .GetComponents (_a .Settings .Components ,_a .Settings .MaxCompWidth ,_a .Settings .MaxCompHeight );if _gg !=nil {return _e .Wrap (_gg ,_ad ,"");};_d .Log .Debug ("\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074s\u003a\u0020\u0025\u0076",_df );if _gg =_a .addPageComponents (inputPage ,_f ,_df ,pageNumber ,method );_gg !=nil {return _e .Wrap (_gg ,_ad ,"");};return nil ;};type Settings struct{MaxCompWidth int ;MaxCompHeight int ;SizeHaus int ;RankHaus float64 ;Thresh float64 ;WeightFactor float64 ;KeepClassInstances bool ;Components _b .Component ;Method Method ;};func (_aca *Classer )classifyRankHaus (_fbd *_b .Boxes ,_dec *_b .Bitmaps ,_agbd int )error {const _cfe ="\u0063\u006ca\u0073\u0073\u0069f\u0079\u0052\u0061\u006e\u006b\u0048\u0061\u0075\u0073";if _fbd ==nil {return _e .Error (_cfe ,"\u0062\u006fx\u0061\u0020\u006eo\u0074\u0020\u0064\u0065\u0066\u0069\u006e\u0065\u0064");};if _dec ==nil {return _e .Error (_cfe ,"\u0070\u0069x\u0061\u0020\u006eo\u0074\u0020\u0064\u0065\u0066\u0069\u006e\u0065\u0064");};_decf :=len (_dec .Values );if _decf ==0{return _e .Error (_cfe ,"e\u006dp\u0074\u0079\u0020\u006e\u0065\u0077\u0020\u0063o\u006d\u0070\u006f\u006een\u0074\u0073");};_cegd :=_dec .CountPixels ();_ead :=_aca .Settings .SizeHaus ;_fa :=_b .SelCreateBrick (_ead ,_ead ,_ead /2,_ead /2,_b .SelHit );_gec :=&_b .Bitmaps {Values :make ([]*_b .Bitmap ,_decf )};_acde :=&_b .Bitmaps {Values :make ([]*_b .Bitmap ,_decf )};var (_gdb ,_fdd ,_gafd *_b .Bitmap ;_abg error ;);for _dgf :=0;_dgf < _decf ;_dgf ++{_gdb ,_abg =_dec .GetBitmap (_dgf );if _abg !=nil {return _e .Wrap (_abg ,_cfe ,"");};_fdd ,_abg =_gdb .AddBorderGeneral (JbAddedPixels ,JbAddedPixels ,JbAddedPixels ,JbAddedPixels ,0);if _abg !=nil {return _e .Wrap (_abg ,_cfe ,"");};_gafd ,_abg =_b .Dilate (nil ,_fdd ,_fa );if _abg !=nil {return _e .Wrap (_abg ,_cfe ,"");};_gec .Values [_decf ]=_fdd ;_acde .Values [_decf ]=_gafd ;};_gge ,_abg :=_b .Centroids (_gec .Values );if _abg !=nil {return _e .Wrap (_abg ,_cfe ,"");};if _abg =_gge .Add (_aca .CentroidPoints );_abg !=nil {_d .Log .Trace ("\u004e\u006f\u0020\u0063en\u0074\u0072\u006f\u0069\u0064\u0073\u0020\u0074\u006f\u0020\u0061\u0064\u0064");};if _aca .Settings .RankHaus ==1.0{_abg =_aca .classifyRankHouseOne (_fbd ,_dec ,_gec ,_acde ,_gge ,_agbd );}else {_abg =_aca .classifyRankHouseNonOne (_fbd ,_dec ,_gec ,_acde ,_gge ,_cegd ,_agbd );};if _abg !=nil {return _e .Wrap (_abg ,_cfe ,"");};return nil ;};func (_adee Settings )Validate ()error {const _feag ="\u0053\u0065\u0074\u0074\u0069\u006e\u0067\u0073\u002e\u0056\u0061\u006ci\u0064\u0061\u0074\u0065";if _adee .Thresh < 0.4||_adee .Thresh > 0.98{return _e .Error (_feag ,"\u006a\u0062i\u0067\u0032\u0020\u0065\u006e\u0063\u006f\u0064\u0065\u0072\u0020\u0074\u0068\u0072\u0065\u0073\u0068\u0020\u006e\u006f\u0074\u0020\u0069\u006e\u0020\u0072\u0061\u006e\u0067\u0065\u0020\u005b\u0030\u002e\u0034\u0020\u002d\u0020\u0030\u002e\u0039\u0038\u005d");};if _adee .WeightFactor < 0.0||_adee .WeightFactor > 1.0{return _e .Error (_feag ,"\u006a\u0062i\u0067\u0032\u0020\u0065\u006ec\u006f\u0064\u0065\u0072\u0020w\u0065\u0069\u0067\u0068\u0074\u0020\u0066\u0061\u0063\u0074\u006f\u0072\u0020\u006e\u006f\u0074\u0020\u0069\u006e\u0020\u0072\u0061\u006e\u0067\u0065\u0020\u005b\u0030\u002e\u0030\u0020\u002d\u0020\u0031\u002e\u0030\u005d");};if _adee .RankHaus < 0.5||_adee .RankHaus > 1.0{return _e .Error (_feag ,"\u006a\u0062\u0069\u0067\u0032\u0020\u0065\u006e\u0063\u006f\u0064\u0065\u0072\u0020\u0072a\u006e\u006b\u0020\u0068\u0061\u0075\u0073\u0020\u0076\u0061\u006c\u0075\u0065 \u006e\u006f\u0074\u0020\u0069\u006e\u0020\u0072\u0061\u006e\u0067\u0065 [\u0030\u002e\u0035\u0020\u002d\u0020\u0031\u002e\u0030\u005d");};if _adee .SizeHaus < 1||_adee .SizeHaus > 10{return _e .Error (_feag ,"\u006a\u0062\u0069\u0067\u0032 \u0065\u006e\u0063\u006f\u0064\u0065\u0072\u0020\u0073\u0069\u007a\u0065\u0020h\u0061\u0075\u0073\u0020\u0076\u0061\u006c\u0075\u0065\u0020\u006e\u006f\u0074\u0020\u0069\u006e\u0020\u0072\u0061\u006e\u0067\u0065\u0020\u005b\u0031\u0020\u002d\u0020\u0031\u0030]");};switch _adee .Components {case _b .ComponentConn ,_b .ComponentCharacters ,_b .ComponentWords :default:return _e .Error (_feag ,"\u0069n\u0076\u0061\u006c\u0069d\u0020\u0063\u006c\u0061\u0073s\u0065r\u0020c\u006f\u006d\u0070\u006f\u006e\u0065\u006et");};return nil ;};func (_bd *Classer )addPageComponents (_ea *_b .Bitmap ,_fc *_b .Boxes ,_ade *_b .Bitmaps ,_cfa int ,_ec Method )error {const _af ="\u0043l\u0061\u0073\u0073\u0065r\u002e\u0041\u0064\u0064\u0050a\u0067e\u0043o\u006d\u0070\u006f\u006e\u0065\u006e\u0074s";if _ea ==nil {return _e .Error (_af ,"\u006e\u0069\u006c\u0020\u0069\u006e\u0070\u0075\u0074 \u0070\u0061\u0067\u0065");};if _fc ==nil ||_ade ==nil ||len (*_fc )==0{_d .Log .Trace ("\u0041\u0064\u0064P\u0061\u0067\u0065\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0073\u003a\u0020\u0025\u0073\u002e\u0020\u004e\u006f\u0020\u0063\u006f\u006d\u0070\u006f\u006e\u0065n\u0074\u0073\u0020\u0066\u006f\u0075\u006e\u0064",_ea );return nil ;};var _dfa error ;switch _ec {case RankHaus :_dfa =_bd .classifyRankHaus (_fc ,_ade ,_cfa );case Correlation :_dfa =_bd .classifyCorrelation (_fc ,_ade ,_cfa );default:_d .Log .Debug ("\u0055\u006ek\u006e\u006f\u0077\u006e\u0020\u0063\u006c\u0061\u0073\u0073\u0069\u0066\u0079\u0020\u006d\u0065\u0074\u0068\u006f\u0064\u003a\u0020'%\u0076\u0027",_ec );return _e .Error (_af ,"\u0075\u006e\u006bno\u0077\u006e\u0020\u0063\u006c\u0061\u0073\u0073\u0069\u0066\u0079\u0020\u006d\u0065\u0074\u0068\u006f\u0064");};if _dfa !=nil {return _e .Wrap (_dfa ,_af ,"");};if _dfa =_bd .getULCorners (_ea ,_fc );_dfa !=nil {return _e .Wrap (_dfa ,_af ,"");};_gc :=len (*_fc );_bd .BaseIndex +=_gc ;if _dfa =_bd .ComponentsNumber .Add (_gc );_dfa !=nil {return _e .Wrap (_dfa ,_af ,"");};return nil ;};var TwoByTwoWalk =[]int {0,0,0,1,-1,0,0,-1,1,0,-1,1,1,1,-1,-1,1,-1,0,-2,2,0,0,2,-2,0,-1,-2,1,-2,2,-1,2,1,1,2,-1,2,-2,1,-2,-1,-2,-2,2,-2,2,2,-2,2};func (_bbca *Settings )SetDefault (){if _bbca .MaxCompWidth ==0{switch _bbca .Components {case _b .ComponentConn :_bbca .MaxCompWidth =MaxConnCompWidth ;case _b .ComponentCharacters :_bbca .MaxCompWidth =MaxCharCompWidth ;case _b .ComponentWords :_bbca .MaxCompWidth =MaxWordCompWidth ;};};if _bbca .MaxCompHeight ==0{_bbca .MaxCompHeight =MaxCompHeight ;};if _bbca .Thresh ==0.0{_bbca .Thresh =0.9;};if _bbca .WeightFactor ==0.0{_bbca .WeightFactor =0.75;};if _bbca .RankHaus ==0.0{_bbca .RankHaus =0.97;};if _bbca .SizeHaus ==0{_bbca .SizeHaus =2;};};type Method int ;const (MaxConnCompWidth =350;MaxCharCompWidth =350;MaxWordCompWidth =1000;MaxCompHeight =120;);func (_caf *Classer )classifyCorrelation (_ddf *_b .Boxes ,_ecc *_b .Bitmaps ,_cec int )error {const _aaa ="\u0063\u006c\u0061\u0073si\u0066\u0079\u0043\u006f\u0072\u0072\u0065\u006c\u0061\u0074\u0069\u006f\u006e";if _ddf ==nil {return _e .Error (_aaa ,"\u006e\u0065\u0077\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0073\u0020\u0062\u006f\u0075\u006e\u0064\u0069\u006e\u0067\u0020\u0062o\u0078\u0065\u0073\u0020\u006eo\u0074\u0020f\u006f\u0075\u006e\u0064");};if _ecc ==nil {return _e .Error (_aaa ,"\u006e\u0065wC\u006f\u006d\u0070o\u006e\u0065\u006e\u0074s b\u0069tm\u0061\u0070\u0020\u0061\u0072\u0072\u0061y \u006e\u006f\u0074\u0020\u0066\u006f\u0075n\u0064");};_eb :=len (_ecc .Values );if _eb ==0{_d .Log .Debug ("\u0063l\u0061\u0073s\u0069\u0066\u0079C\u006f\u0072\u0072\u0065\u006c\u0061\u0074i\u006f\u006e\u0020\u002d\u0020\u0070r\u006f\u0076\u0069\u0064\u0065\u0064\u0020\u0070\u0069\u0078\u0061s\u0020\u0069\u0073\u0020\u0065\u006d\u0070\u0074\u0079");return nil ;};var (_fe ,_fea *_b .Bitmap ;_gcf error ;);_adea :=&_b .Bitmaps {Values :make ([]*_b .Bitmap ,_eb )};for _gaa ,_bga :=range _ecc .Values {_fea ,_gcf =_bga .AddBorderGeneral (JbAddedPixels ,JbAddedPixels ,JbAddedPixels ,JbAddedPixels ,0);if _gcf !=nil {return _e .Wrap (_gcf ,_aaa ,"");};_adea .Values [_gaa ]=_fea ;};_baf :=_caf .FgTemplates ;_dag :=_b .MakePixelSumTab8 ();_fcgb :=_b .MakePixelCentroidTab8 ();_cbe :=make ([]int ,_eb );_aae :=make ([][]int ,_eb );_abf :=_b .Points (make ([]_b .Point ,_eb ));_ee :=&_abf ;var (_eaa ,_cac int ;_agb ,_cc ,_aba int ;_eg ,_bbg int ;_agfd byte ;);for _aea ,_acd :=range _adea .Values {_aae [_aea ]=make ([]int ,_acd .Height );_eaa =0;_cac =0;_cc =(_acd .Height -1)*_acd .RowStride ;_agb =0;for _bbg =_acd .Height -1;_bbg >=0;_bbg ,_cc =_bbg -1,_cc -_acd .RowStride {_aae [_aea ][_bbg ]=_agb ;_aba =0;for _eg =0;_eg < _acd .RowStride ;_eg ++{_agfd =_acd .Data [_cc +_eg ];_aba +=_dag [_agfd ];_eaa +=_fcgb [_agfd ]+_eg *8*_dag [_agfd ];};_agb +=_aba ;_cac +=_aba *_bbg ;};_cbe [_aea ]=_agb ;if _agb > 0{(*_ee )[_aea ]=_b .Point {X :float32 (_eaa )/float32 (_agb ),Y :float32 (_cac )/float32 (_agb )};}else {(*_ee )[_aea ]=_b .Point {X :float32 (_acd .Width )/float32 (2),Y :float32 (_acd .Height )/float32 (2)};};};if _gcf =_caf .CentroidPoints .Add (_ee );_gcf !=nil {return _e .Wrap (_gcf ,_aaa ,"\u0063\u0065\u006et\u0072\u006f\u0069\u0064\u0020\u0061\u0064\u0064");};var (_ege ,_ffd ,_gce int ;_dda float64 ;_fed ,_de ,_bbd ,_dg float32 ;_ddg ,_fb _b .Point ;_bfag bool ;_gae *similarTemplatesFinder ;_cge int ;_efa *_b .Bitmap ;_bbdd *_g .Rectangle ;_eeb *_b .Bitmaps ;);for _cge ,_fea =range _adea .Values {_ffd =_cbe [_cge ];if _fed ,_de ,_gcf =_ee .GetGeometry (_cge );_gcf !=nil {return _e .Wrap (_gcf ,_aaa ,"\u0070t\u0061\u0020\u002d\u0020\u0069");};_bfag =false ;_ggf :=len (_caf .UndilatedTemplates .Values );_gae =_edd (_caf ,_fea );for _dagb :=_gae .Next ();_dagb > -1;{if _efa ,_gcf =_caf .UndilatedTemplates .GetBitmap (_dagb );_gcf !=nil {return _e .Wrap (_gcf ,_aaa ,"\u0075\u006e\u0069dl\u0061\u0074\u0065\u0064\u005b\u0069\u0063\u006c\u0061\u0073\u0073\u005d\u0020\u003d\u0020\u0062\u006d\u0032");};if _gce ,_gcf =_baf .GetInt (_dagb );_gcf !=nil {_d .Log .Trace ("\u0046\u0047\u0020T\u0065\u006d\u0070\u006ca\u0074\u0065\u0020\u005b\u0069\u0063\u006ca\u0073\u0073\u005d\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u003a\u0020\u0025\u0076",_gcf );};if _bbd ,_dg ,_gcf =_caf .CentroidPointsTemplates .GetGeometry (_dagb );_gcf !=nil {return _e .Wrap (_gcf ,_aaa ,"\u0043\u0065\u006e\u0074\u0072\u006f\u0069\u0064\u0050\u006f\u0069\u006e\u0074T\u0065\u006d\u0070\u006c\u0061\u0074e\u0073\u005b\u0069\u0063\u006c\u0061\u0073\u0073\u005d\u0020\u003d\u0020\u00782\u002c\u0079\u0032\u0020");};if _caf .Settings .WeightFactor > 0.0{if _ege ,_gcf =_caf .TemplateAreas .Get (_dagb );_gcf !=nil {_d .Log .Trace ("\u0054\u0065\u006dp\u006c\u0061\u0074\u0065A\u0072\u0065\u0061\u0073\u005b\u0069\u0063l\u0061\u0073\u0073\u005d\u0020\u003d\u0020\u0061\u0072\u0065\u0061\u0020\u0025\u0076",_gcf );};_dda =_caf .Settings .Thresh +(1.0-_caf .Settings .Thresh )*_caf .Settings .WeightFactor *float64 (_gce )/float64 (_ege );}else {_dda =_caf .Settings .Thresh ;};_dba ,_cegg :=_b .CorrelationScoreThresholded (_fea ,_efa ,_ffd ,_gce ,_ddg .X -_fb .X ,_ddg .Y -_fb .Y ,MaxDiffWidth ,MaxDiffHeight ,_dag ,_aae [_cge ],float32 (_dda ));if _cegg !=nil {return _e .Wrap (_cegg ,_aaa ,"");};if _cg {var (_efg ,_ccb float64 ;_bgb ,_gafe int ;);_efg ,_cegg =_b .CorrelationScore (_fea ,_efa ,_ffd ,_gce ,_fed -_bbd ,_de -_dg ,MaxDiffWidth ,MaxDiffHeight ,_dag );if _cegg !=nil {return _e .Wrap (_cegg ,_aaa ,"d\u0065\u0062\u0075\u0067Co\u0072r\u0065\u006c\u0061\u0074\u0069o\u006e\u0053\u0063\u006f\u0072\u0065");};_ccb ,_cegg =_b .CorrelationScoreSimple (_fea ,_efa ,_ffd ,_gce ,_fed -_bbd ,_de -_dg ,MaxDiffWidth ,MaxDiffHeight ,_dag );if _cegg !=nil {return _e .Wrap (_cegg ,_aaa ,"d\u0065\u0062\u0075\u0067Co\u0072r\u0065\u006c\u0061\u0074\u0069o\u006e\u0053\u0063\u006f\u0072\u0065");};_bgb =int (_ce .Sqrt (_efg *float64 (_ffd )*float64 (_gce )));_gafe =int (_ce .Sqrt (_ccb *float64 (_ffd )*float64 (_gce )));if (_efg >=_dda )!=(_ccb >=_dda ){return _e .Errorf (_aaa ,"\u0064\u0065\u0062\u0075\u0067\u0020\u0043\u006f\u0072r\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0020\u0073\u0063\u006f\u0072\u0065\u0020\u006d\u0069\u0073\u006d\u0061\u0074\u0063\u0068\u0020-\u0020\u0025d\u0028\u00250\u002e\u0034\u0066\u002c\u0020\u0025\u0076\u0029\u0020\u0076\u0073\u0020\u0025d(\u0025\u0030\u002e\u0034\u0066\u002c\u0020\u0025\u0076)\u0020\u0025\u0030\u002e\u0034\u0066",_bgb ,_efg ,_efg >=_dda ,_gafe ,_ccb ,_ccb >=_dda ,_efg -_ccb );};if _efg >=_dda !=_dba {return _e .Errorf (_aaa ,"\u0064\u0065\u0062\u0075\u0067\u0020\u0043o\u0072\u0072\u0065\u006c\u0061\u0074\u0069\u006f\u006e \u0073\u0063\u006f\u0072\u0065 \u004d\u0069\u0073\u006d\u0061t\u0063\u0068 \u0062\u0065\u0074w\u0065\u0065\u006e\u0020\u0063\u006frr\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0020/\u0020\u0074\u0068\u0072\u0065s\u0068\u006f\u006c\u0064\u002e\u0020\u0043\u006f\u006dpa\u0072\u0069\u0073\u006f\u006e:\u0020\u0025\u0030\u002e\u0034\u0066\u0028\u0025\u0030\u002e\u0034\u0066\u002c\u0020\u0025\u0064\u0029\u0020\u003e\u003d\u0020\u00250\u002e\u0034\u0066\u0028\u0025\u0030\u002e\u0034\u0066\u0029\u0020\u0076\u0073\u0020\u0025\u0076",_efg ,_efg *float64 (_ffd )*float64 (_gce ),_bgb ,_dda ,float32 (_dda )*float32 (_ffd )*float32 (_gce ),_dba );};};if _dba {_bfag =true ;if _cegg =_caf .ClassIDs .Add (_dagb );_cegg !=nil {return _e .Wrap (_cegg ,_aaa ,"\u006f\u0076\u0065\u0072\u0054\u0068\u0072\u0065\u0073\u0068\u006f\u006c\u0064");};if _cegg =_caf .ComponentPageNumbers .Add (_cec );_cegg !=nil {return _e .Wrap (_cegg ,_aaa ,"\u006f\u0076\u0065\u0072\u0054\u0068\u0072\u0065\u0073\u0068\u006f\u006c\u0064");};if _caf .Settings .KeepClassInstances {if _fe ,_cegg =_ecc .GetBitmap (_cge );_cegg !=nil {return _e .Wrap (_cegg ,_aaa ,"\u004b\u0065\u0065\u0070Cl\u0061\u0073\u0073\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0073\u0020\u002d \u0069");};if _eeb ,_cegg =_caf .ClassInstances .GetBitmaps (_dagb );_cegg !=nil {return _e .Wrap (_cegg ,_aaa ,"K\u0065\u0065\u0070\u0043\u006c\u0061s\u0073\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065s\u0020\u002d\u0020i\u0043l\u0061\u0073\u0073");};_eeb .AddBitmap (_fe );if _bbdd ,_cegg =_ddf .Get (_cge );_cegg !=nil {return _e .Wrap (_cegg ,_aaa ,"\u004be\u0065p\u0043\u006c\u0061\u0073\u0073I\u006e\u0073t\u0061\u006e\u0063\u0065\u0073");};_eeb .AddBox (_bbdd );};break ;};};if !_bfag {if _gcf =_caf .ClassIDs .Add (_ggf );_gcf !=nil {return _e .Wrap (_gcf ,_aaa ,"\u0021\u0066\u006f\u0075\u006e\u0064");};if _gcf =_caf .ComponentPageNumbers .Add (_cec );_gcf !=nil {return _e .Wrap (_gcf ,_aaa ,"\u0021\u0066\u006f\u0075\u006e\u0064");};_eeb =&_b .Bitmaps {};if _fe ,_gcf =_ecc .GetBitmap (_cge );_gcf !=nil {return _e .Wrap (_gcf ,_aaa ,"\u0021\u0066\u006f\u0075\u006e\u0064");};_eeb .AddBitmap (_fe );_bcg ,_ebe :=_fe .Width ,_fe .Height ;_dc :=uint64 (_ebe )*uint64 (_bcg );_caf .TemplatesSize .Add (_dc ,_ggf );if _bbdd ,_gcf =_ddf .Get (_cge );_gcf !=nil {return _e .Wrap (_gcf ,_aaa ,"\u0021\u0066\u006f\u0075\u006e\u0064");};_eeb .AddBox (_bbdd );_caf .ClassInstances .AddBitmaps (_eeb );_caf .CentroidPointsTemplates .AddPoint (_fed ,_de );_caf .FgTemplates .AddInt (_ffd );_caf .UndilatedTemplates .AddBitmap (_fe );_ege =(_fea .Width -2*JbAddedPixels )*(_fea .Height -2*JbAddedPixels );if _gcf =_caf .TemplateAreas .Add (_ege );_gcf !=nil {return _e .Wrap (_gcf ,_aaa ,"\u0021\u0066\u006f\u0075\u006e\u0064");};};};_caf .NumberOfClasses =len (_caf .UndilatedTemplates .Values );return nil ;};type similarTemplatesFinder struct{Classer *Classer ;Width int ;Height int ;Index int ;CurrentNumbers []int ;N int ;};const JbAddedPixels =6;func (_aeaad *similarTemplatesFinder )Next ()int {var (_afba ,_bed ,_bac ,_ebee int ;_cged bool ;_cebg *_b .Bitmap ;_dab error ;);for {if _aeaad .Index >=25{return -1;};_bed =_aeaad .Width +TwoByTwoWalk [2*_aeaad .Index ];_afba =_aeaad .Height +TwoByTwoWalk [2*_aeaad .Index +1];if _afba < 1||_bed < 1{_aeaad .Index ++;continue ;};if len (_aeaad .CurrentNumbers )==0{_aeaad .CurrentNumbers ,_cged =_aeaad .Classer .TemplatesSize .GetSlice (uint64 (_bed )*uint64 (_afba ));if !_cged {_aeaad .Index ++;continue ;};_aeaad .N =0;};_bac =len (_aeaad .CurrentNumbers );for ;_aeaad .N < _bac ;_aeaad .N ++{_ebee =_aeaad .CurrentNumbers [_aeaad .N ];_cebg ,_dab =_aeaad .Classer .DilatedTemplates .GetBitmap (_ebee );if _dab !=nil {_d .Log .Debug ("\u0046\u0069\u006e\u0064\u004e\u0065\u0078\u0074\u0054\u0065\u006d\u0070\u006c\u0061\u0074\u0065\u003a\u0020\u0074\u0065\u006d\u0070\u006c\u0061t\u0065\u0020\u006e\u006f\u0074 \u0066\u006fu\u006e\u0064\u003a\u0020");return 0;};if _cebg .Width -2*JbAddedPixels ==_bed &&_cebg .Height -2*JbAddedPixels ==_afba {return _ebee ;};};_aeaad .Index ++;_aeaad .CurrentNumbers =nil ;};};func (_aag *Classer )classifyRankHouseOne (_adb *_b .Boxes ,_aaf ,_gaac ,_aeb *_b .Bitmaps ,_gbb *_b .Points ,_dbg int )(_cgf error ){const _fg ="\u0043\u006c\u0061\u0073s\u0065\u0072\u002e\u0063\u006c\u0061\u0073\u0073\u0069\u0066y\u0052a\u006e\u006b\u0048\u006f\u0075\u0073\u0065O\u006e\u0065";var (_egd ,_bfc ,_adc ,_gaed float32 ;_abfc int ;_afb ,_fae ,_ggea ,_feg ,_agc *_b .Bitmap ;_gbce ,_dbgb bool ;);for _abgd :=0;_abgd < len (_aaf .Values );_abgd ++{_fae =_gaac .Values [_abgd ];_ggea =_aeb .Values [_abgd ];_egd ,_bfc ,_cgf =_gbb .GetGeometry (_abgd );if _cgf !=nil {return _e .Wrapf (_cgf ,_fg ,"\u0066\u0069\u0072\u0073\u0074\u0020\u0067\u0065\u006fm\u0065\u0074\u0072\u0079");};_faf :=len (_aag .UndilatedTemplates .Values );_gbce =false ;_bee :=_edd (_aag ,_fae );for _abfc =_bee .Next ();_abfc > -1;{_feg ,_cgf =_aag .UndilatedTemplates .GetBitmap (_abfc );if _cgf !=nil {return _e .Wrap (_cgf ,_fg ,"\u0062\u006d\u0033");};_agc ,_cgf =_aag .DilatedTemplates .GetBitmap (_abfc );if _cgf !=nil {return _e .Wrap (_cgf ,_fg ,"\u0062\u006d\u0034");};_adc ,_gaed ,_cgf =_aag .CentroidPointsTemplates .GetGeometry (_abfc );if _cgf !=nil {return _e .Wrap (_cgf ,_fg ,"\u0043\u0065\u006e\u0074\u0072\u006f\u0069\u0064\u0054\u0065\u006d\u0070l\u0061\u0074\u0065\u0073");};_dbgb ,_cgf =_b .HausTest (_fae ,_ggea ,_feg ,_agc ,_egd -_adc ,_bfc -_gaed ,MaxDiffWidth ,MaxDiffHeight );if _cgf !=nil {return _e .Wrap (_cgf ,_fg ,"");};if _dbgb {_gbce =true ;if _cgf =_aag .ClassIDs .Add (_abfc );_cgf !=nil {return _e .Wrap (_cgf ,_fg ,"");};if _cgf =_aag .ComponentPageNumbers .Add (_dbg );_cgf !=nil {return _e .Wrap (_cgf ,_fg ,"");};if _aag .Settings .KeepClassInstances {_ed ,_ece :=_aag .ClassInstances .GetBitmaps (_abfc );if _ece !=nil {return _e .Wrap (_ece ,_fg ,"\u004be\u0065\u0070\u0050\u0069\u0078\u0061a");};_afb ,_ece =_aaf .GetBitmap (_abgd );if _ece !=nil {return _e .Wrap (_ece ,_fg ,"\u004be\u0065\u0070\u0050\u0069\u0078\u0061a");};_ed .AddBitmap (_afb );_dbgd ,_ece :=_adb .Get (_abgd );if _ece !=nil {return _e .Wrap (_ece ,_fg ,"\u004be\u0065\u0070\u0050\u0069\u0078\u0061a");};_ed .AddBox (_dbgd );};break ;};};if !_gbce {if _cgf =_aag .ClassIDs .Add (_faf );_cgf !=nil {return _e .Wrap (_cgf ,_fg ,"");};if _cgf =_aag .ComponentPageNumbers .Add (_dbg );_cgf !=nil {return _e .Wrap (_cgf ,_fg ,"");};_dfb :=&_b .Bitmaps {};_afb ,_cgf =_aaf .GetBitmap (_abgd );if _cgf !=nil {return _e .Wrap (_cgf ,_fg ,"\u0021\u0066\u006f\u0075\u006e\u0064");};_dfb .Values =append (_dfb .Values ,_afb );_beb ,_bdf :=_afb .Width ,_afb .Height ;_aag .TemplatesSize .Add (uint64 (_bdf )*uint64 (_beb ),_faf );_cdd ,_fec :=_adb .Get (_abgd );if _fec !=nil {return _e .Wrap (_fec ,_fg ,"\u0021\u0066\u006f\u0075\u006e\u0064");};_dfb .AddBox (_cdd );_aag .ClassInstances .AddBitmaps (_dfb );_aag .CentroidPointsTemplates .AddPoint (_egd ,_bfc );_aag .UndilatedTemplates .AddBitmap (_fae );_aag .DilatedTemplates .AddBitmap (_ggea );};};return nil ;};func DefaultSettings ()Settings {_cgd :=&Settings {};_cgd .SetDefault ();return *_cgd };func (_bgc *Classer )getULCorners (_gcd *_b .Bitmap ,_ggc *_b .Boxes )error {const _ef ="\u0067\u0065\u0074U\u004c\u0043\u006f\u0072\u006e\u0065\u0072\u0073";if _gcd ==nil {return _e .Error (_ef ,"\u006e\u0069l\u0020\u0069\u006da\u0067\u0065\u0020\u0062\u0069\u0074\u006d\u0061\u0070");};if _ggc ==nil {return _e .Error (_ef ,"\u006e\u0069\u006c\u0020\u0062\u006f\u0075\u006e\u0064\u0073");};if _bgc .PtaUL ==nil {_bgc .PtaUL =&_b .Points {};};_ff :=len (*_ggc );var (_cd ,_dfd ,_agf ,_ceg int ;_bdb ,_fcf ,_ab ,_ecd float32 ;_cbcc error ;_afe *_g .Rectangle ;_fd *_b .Bitmap ;_bf _g .Point ;);for _abc :=0;_abc < _ff ;_abc ++{_cd =_bgc .BaseIndex +_abc ;if _bdb ,_fcf ,_cbcc =_bgc .CentroidPoints .GetGeometry (_cd );_cbcc !=nil {return _e .Wrap (_cbcc ,_ef ,"\u0043\u0065\u006e\u0074\u0072\u006f\u0069\u0064\u0050o\u0069\u006e\u0074\u0073");};if _dfd ,_cbcc =_bgc .ClassIDs .Get (_cd );_cbcc !=nil {return _e .Wrap (_cbcc ,_ef ,"\u0043\u006c\u0061s\u0073\u0049\u0044\u0073\u002e\u0047\u0065\u0074");};if _ab ,_ecd ,_cbcc =_bgc .CentroidPointsTemplates .GetGeometry (_dfd );_cbcc !=nil {return _e .Wrap (_cbcc ,_ef ,"\u0043\u0065\u006etr\u006f\u0069\u0064\u0050\u006f\u0069\u006e\u0074\u0073\u0054\u0065\u006d\u0070\u006c\u0061\u0074\u0065\u0073");};_da :=_ab -_bdb ;_ac :=_ecd -_fcf ;if _da >=0{_agf =int (_da +0.5);}else {_agf =int (_da -0.5);};if _ac >=0{_ceg =int (_ac +0.5);}else {_ceg =int (_ac -0.5);};if _afe ,_cbcc =_ggc .Get (_abc );_cbcc !=nil {return _e .Wrap (_cbcc ,_ef ,"");};_bec ,_fce :=_afe .Min .X ,_afe .Min .Y ;_fd ,_cbcc =_bgc .UndilatedTemplates .GetBitmap (_dfd );if _cbcc !=nil {return _e .Wrap (_cbcc ,_ef ,"\u0055\u006e\u0064\u0069\u006c\u0061\u0074\u0065\u0064\u0054e\u006d\u0070\u006c\u0061\u0074\u0065\u0073.\u0047\u0065\u0074\u0028\u0069\u0043\u006c\u0061\u0073\u0073\u0029");};_bf ,_cbcc =_ae (_gcd ,_bec ,_fce ,_agf ,_ceg ,_fd );if _cbcc !=nil {return _e .Wrap (_cbcc ,_ef ,"");};_bgc .PtaUL .AddPoint (float32 (_bec -_agf +_bf .X ),float32 (_fce -_ceg +_bf .Y ));};return nil ;};var _cg bool ;type Classer struct{BaseIndex int ;Settings Settings ;ComponentsNumber *_cb .IntSlice ;TemplateAreas *_cb .IntSlice ;Widths map[int ]int ;Heights map[int ]int ;NumberOfClasses int ;ClassInstances *_b .BitmapsArray ;UndilatedTemplates *_b .Bitmaps ;DilatedTemplates *_b .Bitmaps ;TemplatesSize _cb .IntsMap ;FgTemplates *_cb .NumSlice ;CentroidPoints *_b .Points ;CentroidPointsTemplates *_b .Points ;ClassIDs *_cb .IntSlice ;ComponentPageNumbers *_cb .IntSlice ;PtaUL *_b .Points ;PtaLL *_b .Points ;};const (MaxDiffWidth =2;MaxDiffHeight =2;);func (_gb *Classer )ComputeLLCorners ()(_ag error ){const _bg ="\u0043l\u0061\u0073\u0073\u0065\u0072\u002e\u0043\u006f\u006d\u0070\u0075t\u0065\u004c\u004c\u0043\u006f\u0072\u006e\u0065\u0072\u0073";if _gb .PtaUL ==nil {return _e .Error (_bg ,"\u0055\u004c\u0020\u0043or\u006e\u0065\u0072\u0073\u0020\u006e\u006f\u0074\u0020\u0064\u0065\u0066\u0069\u006ee\u0064");};_be :=len (*_gb .PtaUL );_gb .PtaLL =&_b .Points {};var (_cbc ,_gd float32 ;_bgg ,_age int ;_bggb *_b .Bitmap ;);for _db :=0;_db < _be ;_db ++{_cbc ,_gd ,_ag =_gb .PtaUL .GetGeometry (_db );if _ag !=nil {_d .Log .Debug ("\u0047e\u0074\u0074\u0069\u006e\u0067\u0020\u0050\u0074\u0061\u0055\u004c \u0066\u0061\u0069\u006c\u0065\u0064\u003a\u0020\u0025\u0076",_ag );return _e .Wrap (_ag ,_bg ,"\u0050\u0074\u0061\u0055\u004c\u0020\u0047\u0065\u006fm\u0065\u0074\u0072\u0079");};_bgg ,_ag =_gb .ClassIDs .Get (_db );if _ag !=nil {_d .Log .Debug ("\u0047\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0043\u006c\u0061s\u0073\u0049\u0044\u0020\u0066\u0061\u0069\u006c\u0065\u0064:\u0020\u0025\u0076",_ag );return _e .Wrap (_ag ,_bg ,"\u0043l\u0061\u0073\u0073\u0049\u0044");};_bggb ,_ag =_gb .UndilatedTemplates .GetBitmap (_bgg );if _ag !=nil {_d .Log .Debug ("\u0047\u0065t\u0074\u0069\u006e\u0067 \u0055\u006ed\u0069\u006c\u0061\u0074\u0065\u0064\u0054\u0065m\u0070\u006c\u0061\u0074\u0065\u0073\u0020\u0066\u0061\u0069\u006c\u0065d\u003a\u0020\u0025\u0076",_ag );return _e .Wrap (_ag ,_bg ,"\u0055\u006e\u0064\u0069la\u0074\u0065\u0064\u0020\u0054\u0065\u006d\u0070\u006c\u0061\u0074\u0065\u0073");};_age =_bggb .Height ;_gb .PtaLL .AddPoint (_cbc ,_gd +float32 (_age ));};return nil ;};func (_cde *Classer )verifyMethod (_cba Method )error {if _cba !=RankHaus &&_cba !=Correlation {return _e .Error ("\u0076\u0065\u0072i\u0066\u0079\u004d\u0065\u0074\u0068\u006f\u0064","\u0069\u006e\u0076\u0061li\u0064\u0020\u0063\u006c\u0061\u0073\u0073\u0065\u0072\u0020\u006d\u0065\u0074\u0068o\u0064");};return nil ;};func _ae (_daf *_b .Bitmap ,_ga ,_bfa ,_eaf ,_efd int ,_cee *_b .Bitmap )(_dd _g .Point ,_gbc error ){const _afa ="\u0066i\u006e\u0061\u006c\u0041l\u0069\u0067\u006e\u006d\u0065n\u0074P\u006fs\u0069\u0074\u0069\u006f\u006e\u0069\u006eg";if _daf ==nil {return _dd ,_e .Error (_afa ,"\u0073\u006f\u0075\u0072ce\u0020\u006e\u006f\u0074\u0020\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0064");};if _cee ==nil {return _dd ,_e .Error (_afa ,"t\u0065\u006d\u0070\u006cat\u0065 \u006e\u006f\u0074\u0020\u0070r\u006f\u0076\u0069\u0064\u0065\u0064");};_fcg ,_gaf :=_cee .Width ,_cee .Height ;_ba ,_gde :=_ga -_eaf -JbAddedPixels ,_bfa -_efd -JbAddedPixels ;_d .Log .Trace ("\u0078\u003a\u0020\u0027\u0025\u0064\u0027\u002c\u0020\u0079\u003a\u0020\u0027\u0025\u0064'\u002c\u0020\u0077\u003a\u0020\u0027\u0025\u0064\u0027\u002c\u0020\u0068\u003a \u0027\u0025\u0064\u0027\u002c\u0020\u0062\u0078\u003a\u0020\u0027\u0025d'\u002c\u0020\u0062\u0079\u003a\u0020\u0027\u0025\u0064\u0027",_ga ,_bfa ,_fcg ,_gaf ,_ba ,_gde );_gcdf ,_gbc :=_b .Rect (_ba ,_gde ,_fcg ,_gaf );if _gbc !=nil {return _dd ,_e .Wrap (_gbc ,_afa ,"");};_acg ,_ ,_gbc :=_daf .ClipRectangle (_gcdf );if _gbc !=nil {_d .Log .Error ("\u0043a\u006e\u0027\u0074\u0020\u0063\u006c\u0069\u0070\u0020\u0072\u0065c\u0074\u0061\u006e\u0067\u006c\u0065\u003a\u0020\u0025\u0076",_gcdf );return _dd ,_e .Wrap (_gbc ,_afa ,"");};_gcdc :=_b .New (_acg .Width ,_acg .Height );_ge :=_ce .MaxInt32 ;var _gdc ,_ddd ,_aa ,_dbe ,_gfg int ;for _gdc =-1;_gdc <=1;_gdc ++{for _ddd =-1;_ddd <=1;_ddd ++{if _ ,_gbc =_b .Copy (_gcdc ,_acg );_gbc !=nil {return _dd ,_e .Wrap (_gbc ,_afa ,"");};if _gbc =_gcdc .RasterOperation (_ddd ,_gdc ,_fcg ,_gaf ,_b .PixSrcXorDst ,_cee ,0,0);_gbc !=nil {return _dd ,_e .Wrap (_gbc ,_afa ,"");};_aa =_gcdc .CountPixels ();if _aa < _ge {_dbe =_ddd ;_gfg =_gdc ;_ge =_aa ;};};};_dd .X =_dbe ;_dd .Y =_gfg ;return _dd ,nil ;};func Init (settings Settings )(*Classer ,error ){const _bc ="\u0063\u006c\u0061s\u0073\u0065\u0072\u002e\u0049\u006e\u0069\u0074";_cf :=&Classer {Settings :settings ,Widths :map[int ]int {},Heights :map[int ]int {},TemplatesSize :_cb .IntsMap {},TemplateAreas :&_cb .IntSlice {},ComponentPageNumbers :&_cb .IntSlice {},ClassIDs :&_cb .IntSlice {},ComponentsNumber :&_cb .IntSlice {},CentroidPoints :&_b .Points {},CentroidPointsTemplates :&_b .Points {},UndilatedTemplates :&_b .Bitmaps {},DilatedTemplates :&_b .Bitmaps {},ClassInstances :&_b .BitmapsArray {},FgTemplates :&_cb .NumSlice {}};if _ca :=_cf .Settings .Validate ();_ca !=nil {return nil ,_e .Wrap (_ca ,_bc ,"");};return _cf ,nil ;};const (RankHaus Method =iota ;Correlation ;);func _edd (_eged *Classer ,_aeac *_b .Bitmap )*similarTemplatesFinder {return &similarTemplatesFinder {Width :_aeac .Width ,Height :_aeac .Height ,Classer :_eged };};