
    Yh!                     F    d dl Z d dlZd Zd Zedk    r e             dS dS )    Nc                  
	   t          j        d          } |                     ddddt          d           |                     d	t          dd
gdd           |                     dt          d d           |                     dt          d d           |                     dt          dd           |                     dt          dd
gdd           |                     dt          dd
gdd           |                     dt          dd
gdd           |                     dt          dd
gdd           |                     dt          dd
gdd           |                     dd dt          d!"           |                     d#t          g d$d%d&           |                     d't
          d(d)           |                     d*t
          d+d,           |                     d-t
          d.d/           |                     d0t          d d1           |                     d2t          d d3           |                     d4t
          d.d+gd+d5           |                     d6t          d d7           |                     d8t          dd
gd
d9           |                     d:t
          d;d<           |                     d=t          d>d?           |                     d@t          dAdB           |                     dCt          dDdE           |                     dFt          dGdH           |                     dIt          dGdJ           |                     dKt
          dLdM           |                     dNt          dOdP           |                     dQt          d>dR           |                     dSt          dAdT           |                     dUt          dAdV           |                     dWt          dAdX           |                     dYt          dAdZ           |                     d[t          dOd\           |                     d]t          d>d^           |                     d_t          g d`dda           |                                 }|S )bNzProcess EasyOCR.)descriptionz-lz--lang+Tzfor languages)nargsrequiredtypehelpz--gpuFzUsing GPU (default: True))r   choicesdefaultr	   z--model_storage_directoryzDirectory for model (.pth) file)r   r   r	   z--user_network_directoryz"Directory for custom network filesz--recog_networkstandardzRecognition networksz--download_enabledzEnable Downloadz
--detectorzInitialize text detector modulez--recognizerz!Initialize text recognizer modulez	--verbosezPrint detail/warningz
--quantizezUse dynamic quantizationz-fz--filez
input file)r   r   r	   z	--decoder)greedy
beamsearchwordbeamsearchr   zdecoder algorithmz--beamWidth   zsize of beam searchz--batch_size   
batch_sizez	--workersr   znumber of processing cpu coresz--allowlistz4Force EasyOCR to recognize only subset of charactersz--blocklistzOBlock subset of character. This argument will be ignored if allowlist is given.z--detailzsimple output (default: 1)z--rotation_infozAllow EasyOCR to rotate each text box and return the one with the best confident score. Eligible values are 90, 180 and 270. For example, try [90, 180 ,270] for all possible text orientations.z--paragraphzCombine result into paragraphz
--min_size   z3Filter text box smaller than minimum value in pixelz--contrast_thsg?zText box with contrast lower than this value will be passed into model 2 times. First is with original image and second with contrast adjusted to 'adjust_contrast' value. The one with more confident level will be returned as a result.z--adjust_contrastg      ?z/target contrast level for low contrast text boxz--text_thresholdgffffff?zText confidence thresholdz
--low_textg?zText low-bound scorez--link_thresholdzLink confidence thresholdz--canvas_sizei 
  zFMaximum image size. Image bigger than this value will be resized down.z--mag_ratiog      ?zImage magnification ratioz--slope_thszfMaximum slope (delta y/delta x) to considered merging. Low value means tiled boxes will not be merged.z--ycenter_thszNMaximum shift in y direction. Boxes with different level should not be merged.z--height_thsz[Maximum different in box height. Boxes with very different text size should not be merged. z--width_thsz+Maximum horizontal distance to merge boxes.z--y_thszAMaximum vertical distance to merge boxes (when paragraph = True).z--x_thszCMaximum horizontal distance to merge boxes (when paragraph = True).z--add_marginzxExtend bounding boxes in all direction by certain value. This is important for language with complex script (E.g. Thai).z--output_format)r   dictjsonzoutput format.)	argparseArgumentParseradd_argumentstrboolintlistfloat
parse_args)parserargss     ]/var/www/tools.fuzzalab.pt/emblema-extractor/venv/lib/python3.11/site-packages/easyocr/cli.pyr   r      s   $1CDDDF
     u(     #.	     "1	     #	     u     u.     u0     u#     u'          :::      "	     	     -	     C	     ^	     A)      P	     u,     B	      z	     >	     (	     #	     (	     U	     (	     u	     ]	     j	     :	     P	     R	      H	     ,,,     DK    c                  H   t                      } t          j        | j        | j        | j        | j        | j        | j        | j	        | j
        | j        | j        
  
        }|                    | j        | j        | j        | j        | j        | j        | j        | j        | j        | j        | j        | j        | j        | j        | j        | j        | j        | j        | j         | j!        | j"        | j#        | j$        | j%        | j&        | j'                  D ]}tQ          |           d S )N)
	lang_listgpumodel_storage_directoryuser_network_directoryrecog_networkdownload_enableddetector
recognizerverbosequantize)decoder	beamWidthr   workers	allowlist	blocklistdetailrotation_info	paragraphmin_sizecontrast_thsadjust_contrasttext_thresholdlow_textlink_thresholdcanvas_size	mag_ratio	slope_thsycenter_ths
height_ths	width_thsy_thsx_ths
add_marginoutput_format))r   easyocrReaderlangr%   r&   r'   r(   r)   r*   r+   r,   r-   readtextfiler.   r/   r   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   print)r    readerlines      r!   mainrN      s   <<D^di $484P373N*.*<-1-B%)]'+$(L%)]	4 	4 	4F 	(,*..+/?(,*..*..'+{.2.@*..)--1->040D/3/B)-/3/B,0,<*..*..,0,<+/?*..&*j&*j+/?.2.@3   B B  4 	d5 r"   __main__)r   rF   r   rN   __name__ r"   r!   <module>rR      s^     i i iX& & &R zDFFFFF r"   