






'''simple docstring'''





import copy
import os

import cva
import numpy as np
from matplotlib import pyplot as plt







class  _lowercase   :
      def __init__(     self   ):
       snake_case__  :    Optional[Any]							       =""""""
       snake_case__  :    List[str]							       =""""""
       snake_case__  :    Dict							       =[]
       snake_case__  :    Tuple							       =0
       snake_case__  :    Optional[int]							       =2_5_6
       snake_case__  :    str							       =0
       snake_case__  :    Any							       =0
       snake_case__  :    Tuple							       =0
       snake_case__  :    List[Any]							       =0
      def 						lowercase__					(     self				,			a   ):
       snake_case__  :    Union[str, Any]							       =cva.imread(a				,			0   )
       snake_case__  :    Optional[int]							       =copy.deepcopy(self.img   )
       snake_case__  :    Optional[Any]							       =plt.hist(self.img.ravel()				,			2_5_6				,			[0, 2_5_6]				,			label="""x"""   )
       snake_case__  :    Any							       =np.sum(a   )
       for i in range(len(a   )   ):
        snake_case__  :    Any							       =x[i] / self.k
        self.sk += prk
        snake_case__  :    Union[str, Any]							       =(self.L - 1) * self.sk
        if self.rem != 0:
         snake_case__  :    List[Any]							       =int(last % last   )
        snake_case__  :    str							       =int(last + 1 if self.rem >= 0.5 else last   )
        self.last_list.append(a   )
        snake_case__  :    Tuple							       =int(np.ma.count(self.img   ) / self.img[1].size   )
        snake_case__  :    List[Any]							       =self.img[1].size
       for i in range(self.number_of_cols   ):
        for j in range(self.number_of_rows   ):
         snake_case__  :    Any							       =self.img[j][i]
         if num != self.last_list[num]:
          snake_case__  :    Union[str, Any]							       =self.last_list[num]
       cva.imwrite("""output_data/output.jpg"""				,			self.img   )
      def 						lowercase__					(     self   ):
       plt.hist(self.img.ravel()				,			2_5_6				,			[0, 2_5_6]   )



      def 						lowercase__					(     self   ):
       cva.imshow("""Output-Image"""				,			self.img   )
       cva.imshow("""Input-Image"""				,			self.original_image   )
       cva.waitKey(5_0_0_0   )
       cva.destroyAllWindows()


if __name__ == "__main__":
       __lowerCamelCase	:		Optional[Any]										=   os.path.join(os.path.basename(__file__), """image_data/input.jpg""")
       __lowerCamelCase	:		Union[str, Any]										=   ConstantStretch()
       stretcher.stretch(file_path)
       stretcher.plot_histogram()
       stretcher.show_image()













__lowerCamelCase	:		dict[str, float]										=   {
    "km/h": 1.0,
    "m/s": 3.6,
    "mph": 1.60_93_44,
    "knot": 1.8_52,
}

__lowerCamelCase	:		dict[str, float]										=   {
    "km/h": 1.0,
    "m/s": 0.2_77_77_77_78,
    "mph": 0.6_21_37_11_92,
    "knot": 0.5_39_95_68_03,
}







def 			A__							(      _a  :					float		,  _a  :					str		,  _a  :					str	):





 '''simple docstring'''







 if unit_to not in speed_chart or unit_from not in speed_chart_inverse:
  snake_case__  :    Tuple							       =(
      f"Incorrect 'from_type' or 'to_type' value: {unit_from!r}, {unit_to!r}\n"
      f"Valid values are: {', '.join(_a	)}"
  )
  raise ValueError(_a	)
 return round(speed * speed_chart[unit_from] * speed_chart_inverse[unit_to]		,  3	)


if __name__ == "__main__":
       import doctest

       doctest.testmod()





