



'''simple docstring'''





import copy
import os

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







class     UpperCAmelCase_       :
    """simple docstring"""







    def __init__(    self					:     Dict						):
          snake_case__  :    Optional[int]    						=      """"""
          snake_case__  :    List[Any]    						=      """"""
          snake_case__  :    List[str]    						=      []
          snake_case__  :    str    						=      0
          snake_case__  :    Union[str, Any]    						=      256
          snake_case__  :    Union[str, Any]    						=      0
          snake_case__  :    Any    						=      0
          snake_case__  :    List[Any]    						=      0
          snake_case__  :    Optional[Any]    						=      0




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




    def lowerCamelCase       (    self					:     Optional[int]						):
          plt.hist(self.img.ravel() ,     256 ,     [0, 256]						)




    def lowerCamelCase       (    self					:     Optional[int]						):
          cva.imshow("""Output-Image""" ,     self.img						)
          cva.imshow("""Input-Image""" ,     self.original_image						)
          cva.waitKey(5_000						)
          cva.destroyAllWindows()


if __name__ == "__main__":
       __a          =		os.path.join(os.path.basename(__file__), "image_data/input.jpg")
       __a          =		ConstantStretch()
       stretcher.stretch(file_path)
       stretcher.plot_histogram()
       stretcher.show_image()








import math

class 						lowerCAmelCase   :

					'''simple docstring'''

					def __init__(     self :		Tuple						,   __a :		int=0							)	->     Optional[Any]:  # a graph with Node 0,1,...,N-1


												"""simple docstring"""

												__lowercase					:							Any			=   n
												__lowercase					:							Optional[int]			=   [
												    [math.inf for j in range(0						,   __a							)] for i in range(0						,   __a							)
												]  # adjacency matrix for weight
												__lowercase					:							Dict			=   [
												    [math.inf for j in range(0						,   __a							)] for i in range(0						,   __a							)
												]  # dp[i][j] stores minimum distance from i to j



					def 					lowerCAmelCase (     self :		int						,   __a :		Optional[int]						,   __a :		Tuple						,   __a :		Dict							)	->     Dict:


												"""simple docstring"""

												__lowercase					:							Any			=   w



					def 					lowerCAmelCase (     self :		List[str]							)	->     Tuple:


												"""simple docstring"""

												for k in range(0						,   self.n							):
																			for i in range(0						,   self.n							):
																										for j in range(0						,   self.n							):
																																	__lowercase					:							List[str]			=   min(self.dp[i][j]						,   self.dp[i][k] + self.dp[k][j]							)



					def 					lowerCAmelCase (     self :		Any						,   __a :		Any						,   __a :		str							)	->     int:


												"""simple docstring"""

												return self.dp[u][v]


if __name__ == "__main__":
	lowerCamelCase       :       int        =				Graph(5)
	graph.add_edge(0, 2, 9)
	graph.add_edge(0, 4, 10)
	graph.add_edge(1, 3, 5)
	graph.add_edge(2, 3, 7)
	graph.add_edge(3, 0, 10)
	graph.add_edge(3, 1, 2)
	graph.add_edge(3, 2, 1)
	graph.add_edge(3, 4, 6)
	graph.add_edge(4, 1, 3)
	graph.add_edge(4, 2, 4)
	graph.add_edge(4, 3, 9)
	graph.floyd_warshall()
	graph.show_min(1, 4)
	graph.show_min(0, 3)