

import copy
import os

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






class 						__magic_name__    :


 def __init__(						self		: Optional[int]    )    ->      Optional[Any]:
   UpperCAmelCase					      =  ""
   UpperCAmelCase					      =  ""
   UpperCAmelCase					      =  []
   UpperCAmelCase					      =  0
   UpperCAmelCase					      =  2_5_6
   UpperCAmelCase					      =  0
   UpperCAmelCase					      =  0
   UpperCAmelCase					      =  0
   UpperCAmelCase					      =  0


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


 def _UpperCamelCase	(						self		: str    )    ->      int:
   plt.hist(self.img.ravel()			,						2_5_6			,						[0, 2_5_6]    )


 def _UpperCamelCase	(						self		: Dict    )    ->      Optional[Any]:
   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__       = os.path.join(os.path.basename(__file__), "image_data/input.jpg")
      lowerCAmelCase__       = ConstantStretch()
      stretcher.stretch(file_path)
      stretcher.plot_histogram()
      stretcher.show_image()






def      _lowerCAmelCase(	__A			):
  assert column_title.isupper()
  UpperCAmelCase					      =  0
  UpperCAmelCase					      =  len(__A			) - 1
  UpperCAmelCase					      =  0

  while index >= 0:
    UpperCAmelCase					      =  (ord(column_title[index]			) - 64) * pow(26   ,       __A			)
    answer += value
    power += 1
    index -= 1

  return answer


if __name__ == "__main__":
      from doctest import testmod

      testmod()



