
    -i                     R    d dl mZ d dlZd dlmZ e G d de                      ZdS )    )	dataclassN)Effectc                   6    e Zd ZU dZdZeed<   dZeed<   d Z	dS )BlackAndWhitezDesaturates the picture, makes it black and white.
    Parameter RGB allows to set weights for the different color
    channels.
    If RBG is 'CRT_phosphor' a special set of values is used.
    preserve_luminosity maintains the sum of RGB to 1.
    NRGBTpreserve_luminosityc                    | j         	g d| _         | j         dk    r	g d| _         dt          j        | j                   z  | j        rt	          | j                   ndz  \  fd}|                    |          S )zApply the effect to the clip.N)   r
   r
   CRT_phosphor)g333333?gjq?gL
F%u?g      ?r
   c                     | d d d d df         z  | d d d d df         z  z   | d d d d df         z  z   } t          j        d| gz                                d          S )Nr   r
         uint8)npdstackastype)imBGRs    \/var/www/html/speakWrite/venv/lib/python3.11/site-packages/moviepy/video/fx/BlackAndWhite.pyfilterz#BlackAndWhite.apply.<locals>.filter"   sx    R111a[1r!!!QQQ'{?2QAAAqqq!G_DB9Q"X&&--g666    )r   r   arrayr   sumimage_transform)selfclipr   r   r   r   s      @@@r   applyzBlackAndWhite.apply   s    8 yyDH8~%%///DH htx  ! $ 8?s48}}}aA 	1a	7 	7 	7 	7 	7 	7 	7 ##F+++r   )
__name__
__module____qualname____doc__r   str__annotations__r   boolr    r   r   r   r      sO           COOO $$$$, , , , ,r   r   )dataclassesr   numpyr   moviepy.Effectr   r   r'   r   r   <module>r+      su    ! ! ! ! ! !     ! ! ! ! ! ! , , , , ,F , , , , ,r   