403Webshell
Server IP : 146.190.157.162  /  Your IP : 216.73.217.127
Web Server : Apache
System : Linux ubuntu-s-2vcpu-4gb-amd-sfo3-01-KIT-DIGITAL 6.5.0-44-generic #44-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 7 15:10:09 UTC 2024 x86_64
User : businessweek ( 639)
PHP Version : 8.2.10-2ubuntu2.2
Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_signal,pcntl_signal_dispatch,pcntl_getpriority,pcntl_setpriority,dl,putenv,parse_ini_file,show_source
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/PIL/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/PIL/__pycache__/ImageMorph.cpython-311.pyc
�

D#�d)��f�ddlZddlmZmZdZgd�Zgd�ZGd�d��ZGd	�d
��ZdS)�N�)�Image�
_imagingmorphi)	��r��r���)	rrrrr	rr
rrc�>�eZdZdZd
d�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
dS)�
LutBuilderaTA class for building a MorphLut from a descriptive language

    The input patterns is a list of a strings sequences like these::

        4:(...
           .1.
           111)->1

    (whitespaces including linebreaks are ignored). The option 4
    describes a series of symmetry operations (in this case a
    4-rotation), the pattern is described by:

    - . or X - Ignore
    - 1 - Pixel is on
    - 0 - Pixel is off

    The result of the operation is described after "->" string.

    The default is to return the current pixel value, which is
    returned if no other match is found.

    Operations:

    - 4 - 4 way rotation
    - N - Negate
    - 1 - Dummy op for no other operation (an op must always be given)
    - M - Mirroring

    Example::

        lb = LutBuilder(patterns = ["4:(... .1. 111)->1"])
        lut = lb.build_lut()

    Nc��|�||_ng|_d|_|�=ddgdgddgdgddggd�d�}||vrd	|zd
z}t|���|||_dSdS)N�1:(... ... ...)->0z4:(00. 01. ...)->1z4:(... .0. .1.)->1z4:(... .0. ..1)->1z4:(... .1. .0.)->0z4:(... .1. ..0)->0)rz4:(.0. .1. ...)->1z4:(01. .1. ...)->1)�corner�	dilation4�	dilation8�erosion4�erosion8�edgezUnknown pattern �!)�patterns�lut�	Exception)�selfr�op_name�known_patterns�msgs     �0/usr/lib/python3/dist-packages/PIL/ImageMorph.py�__init__zLutBuilder.__init__@s�����$�D�M�M��D�M������/�1E�F�2�3�2�4H�I�1�2�1�3G�H����
��N��n�,�,�(�7�2�S�8����n�n�$�*�7�3�D�M�M�M�#��c�&�|xj|z
c_dS�N�r)rrs  r�add_patternszLutBuilder.add_patternsYs���
�
��!�
�
�
�
r!c�|���ddg�d�t��fd�tt��D����|_dS)Nrr�c3�6�K�|]}�|�zdkV��dS)rN�)�.0�i�m�symbolss  ��r�	<genexpr>z/LutBuilder.build_default_lut.<locals>.<genexpr>_s0�����K�K�a�W�a�!�e�q�[�1�K�K�K�K�K�Kr!)�	bytearray�range�LUT_SIZEr)rr,r-s @@r�build_default_lutzLutBuilder.build_default_lut\sC�����a�&�����K�K�K�K�K�5��?�?�K�K�K�K�K����r!c��|jSr#�r)rs r�get_lutzLutBuilder.get_lutas	���x�r!c�p��t|��dksJ�d��fd�|D����S)z�string_permute takes a pattern and a permutation and returns the
        string permuted according to the permutation list.
        �	�c3�(�K�|]}�|V��
dSr#r))r*�p�patterns  �rr.z-LutBuilder._string_permute.<locals>.<genexpr>is'�����7�7�a�w�q�z�7�7�7�7�7�7r!)�len�join)rr;�permutations ` r�_string_permutezLutBuilder._string_permutedsE����;���1�$�$�$�$��w�w�7�7�7�7�;�7�7�7�7�7�7r!c��||fg}d|vr\|dd}td��D]>}|�|�|ddt��|f���?d|vrOt	|��}|d|�D]5\}}|�|�|t
��|f���6d|vr�t	|��}|d|�D]l\}}|�d	d
���dd	���d
d��}dt|��z
}|�||f���m|S)z�pattern_permute takes a basic pattern and its result and clones
        the pattern according to the modifications described in the $options
        parameter. It returns a list of all cloned patterns.�4���rr	r�MN�N�0�Z�1)r0�appendr?�ROTATION_MATRIXr<�
MIRROR_MATRIX�replace�int)	r�
basic_pattern�options�basic_resultr�resr+�nr;s	         r�_pattern_permutezLutBuilder._pattern_permuteksh��#�L�1�2���'�>�>��2�,�q�/�C��1�X�X�
�
������)�)�(�2�,�q�/�?�K�K�S�Q������'�>�>��H�
�
�A� (��!���
U�
U��������!5�!5�g�}�!M�!M�s� S�T�T�T�T��'�>�>��H�
�
�A� (��!���
0�
0����!�/�/�#�s�3�3�;�;�C��E�E�M�M�c�SV�W�W���#�c�(�(�l������#��/�/�/�/��r!c��|���g}|jD]�}tjd|�dd����}|sd|zdz}t|���|�d��}|�d��}t|�d����}|�d	d���dd��}||�|||��z
}��t|��D]V\}}|d
�dd���dd
��}tj
|��}||df||<�Wtt��D]i}t|��dd�}	ddt|	��z
z|	zddd�}	|D],\}}
|�|	��rd
dg|
|j|<�-�j|jS)zlCompile all patterns into a morphology lut.

        TBD :Build based on (file) morphlut:modify_lut
        z(\w*):?\s*\((.+?)\)\s*->\s*(\d)�
r8zSyntax error in pattern "�"rrr� r�.�Xz[01]NrEr7rB)r2r�re�searchrKr�grouprLrR�	enumerate�compiler0r1�binr<�matchr)rrr:r,rrNr;�resultr+�
bitpattern�rs           r�	build_lutzLutBuilder.build_lut�s���
	
��� � � �����	H�	H�A��	�<�a�i�i��b�>Q�>Q�R�R�A��
%�1�A�5��;����n�n�$��g�g�a�j�j�G��g�g�a�j�j�G��������_�_�F��o�o�c�2�.�.�6�6�t�R�@�@�G���-�-�g�w��G�G�G�H�H�$�H�-�-�	*�	*�J�A�w���
�"�"�3��,�,�4�4�S�&�A�A�A��
�1�
�
�A��g�a�j�/�H�Q�K�K�
�x���	,�	,�A��Q�������J���S��_�_�!4�5�
�B�D�D�b�D�I�J� �
,�
,���1��7�7�:�&�&�,�#$�a�&��)�D�H�Q�K��
,��x�r!)NN)�__name__�
__module__�__qualname__�__doc__r r%r2r5r?rRrcr)r!rrrs�������!�!�F4�4�4�4�2"�"�"�L�L�L�
���8�8�8����<)�)�)�)�)r!rc�>�eZdZdZd
d�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
dS)�MorphOpz*A class for binary morphological operatorsNc��||_|�)t|������|_dS|�)t|������|_dSdS)z&Create a binary morphological operatorN)rr$)rrrc)rrrrs    rr zMorphOp.__init__�sa�������!�'�2�2�2�<�<�>�>�D�H�H�H�
�
!�!�8�4�4�4�>�>�@�@�D�H�H�H�"�
!r!c�*�|j�d}t|���|jdkrd}t|���t	j|j|jd��}tjt|j��|j
j|j
j��}||fS)z�Run a single morphological operation on an image

        Returns a tuple of the number of changed pixels and the
        morphed imageN�No operator loaded�L�Image mode must be L)rr�mode�
ValueErrorr�new�sizer�apply�bytes�im�id)r�imager�outimage�counts     rrsz
MorphOp.apply�s���
�8��&�C��C�.�.� ��:����(�C��S�/�/�!��9�U�Z���T�:�:���#�E�$�(�O�O�U�X�[�(�+�.�Q�Q���h��r!c���|j�d}t|���|jdkrd}t|���t	jt
|j��|jj��S)z�Get a list of coordinates matching the morphological operation on
        an image.

        Returns a list of tuples of (x,y) coordinates
        of all matching pixels. See :ref:`coordinate-system`.Nrlrmrn)	rrrorprr_rtrurv�rrwrs   rr_z
MorphOp.match�sZ���8��&�C��C�.�.� ��:����(�C��S�/�/�!��"�5���?�?�E�H�K�@�@�@r!c�v�|jdkrd}t|���tj|jj��S)z�Get a list of all turned on pixels in a binary image

        Returns a list of tuples of (x,y) coordinates
        of all matching pixels. See :ref:`coordinate-system`.rmrn)rorpr�
get_on_pixelsrurvr{s   rr}zMorphOp.get_on_pixels�s7���:����(�C��S�/�/�!��*�5�8�;�7�7�7r!c��t|d��5}t|�����|_ddd��n#1swxYwYt	|j��t
krd|_d}t
|���dS)z!Load an operator from an mrl file�rbNzWrong size operator file!)�openr/�readrr<r1r)r�filename�frs    r�load_lutzMorphOp.load_lut�s���
�(�D�
!�
!�	+�Q� ������*�*�D�H�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+��t�x�=�=�H�$�$��D�H�-�C��C�.�.� �%�$s�'A�A�Ac��|j�d}t|���t|d��5}|�|j��ddd��dS#1swxYwYdS)zSave an operator to an mrl fileNrl�wb)rrr��write)rr�rr�s    r�save_lutzMorphOp.save_lut�s����8��&�C��C�.�.� �
�(�D�
!�
!�	�Q�
�G�G�D�H����	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A�A�Ac��||_dS)z#Set the lut from an external sourceNr4)rrs  r�set_lutzMorphOp.set_lut�s
������r!)NNN)rdrerfrgr rsr_r}r�r�r�r)r!rriri�s�������4�4�A�A�A�A���� 
A�
A�
A�	8�	8�	8�!�!�!��������r!ri)	rYr8rrr1rIrJrrir)r!r�<module>r�s���
�	�	�	�"�"�"�"�"�"�"�"�������
���
�V�V�V�V�V�V�V�V�rI�I�I�I�I�I�I�I�I�Ir!

Youez - 2016 - github.com/yon3zu
LinuXploit