



'''simple docstring'''





from math import isclose, sqrt


def 	UpperCAmelCase__      (      UpperCAmelCase__ :float ,					UpperCAmelCase__ :float ,					UpperCAmelCase__ :float					):






 '''simple docstring'''

 a						=		point_y / 4 / point_x
 a						=		2 * normal_gradient / (1 + normal_gradient * normal_gradient)
 a						=		(1 - normal_gradient * normal_gradient) / (
     1 + normal_gradient * normal_gradient
 )
 a						=		(sa - ca * incoming_gradient) / (ca + sa * incoming_gradient)

 # to find the next point, solve the simultaeneous equations:
 # y^2 + 4x^2 = 100
 # y - b = m * (x - a)
 # ==> A x^2 + B x + C = 0
 a						=		outgoing_gradient**2 + 4
 a						=		2 * outgoing_gradient * (point_y - outgoing_gradient * point_x)
 a						=		(point_y - outgoing_gradient * point_x) ** 2 - 1_00

 a						=		(
     -linear_term - sqrt(linear_term**2 - 4 * quadratic_term * constant_term					)
 ) / (2 * quadratic_term)
 a						=		(
     -linear_term + sqrt(linear_term**2 - 4 * quadratic_term * constant_term					)
 ) / (2 * quadratic_term)

 # two solutions, one of which is our input point
 a						=		x_minus if isclose(UpperCAmelCase__ ,					UpperCAmelCase__					) else x_plus
 a						=		point_y + outgoing_gradient * (next_x - point_x)

 return next_x, next_y, outgoing_gradient


def 	UpperCAmelCase__      (      UpperCAmelCase__ :float = 1.4 ,					UpperCAmelCase__ :float = -9.6					):






 '''simple docstring'''

 a						=		0
 a						=		first_x_coord
 a						=		first_y_coord
 a						=		(10.1 - point_y) / (0.0 - point_x)

 while not (-0.01 <= point_x <= 0.01 and point_y > 0):
  a		,  a		,  a						=		next_point(UpperCAmelCase__ ,					UpperCAmelCase__ ,					UpperCAmelCase__					)
  num_reflections += 1

 return num_reflections


if __name__ == "__main__":
     print(F"""{solution() = }""")






import copy
import os

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



class 		_lowercase		:

   def __init__(      self			:       List[str]							)       ->				List[str]:


    """simple docstring"""






    a						=		""
    a						=		""
    a						=		[]
    a						=		0
    a						=		256
    a						=		0
    a						=		0
    a						=		0
    a						=		0

   def 		A							(      self			:       Optional[Any]							,   __lowerCAmelCase			:       Any							)       ->				int:


    """simple docstring"""






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

   def 		A							(      self			:       Any							)       ->				int:


    """simple docstring"""






    plt.hist(self.img.ravel()							,   256							,   [0, 256]							)




   def 		A							(      self			:       Any							)       ->				int:


    """simple docstring"""






    cva.imshow("Output-Image"							,   self.img							)
    cva.imshow("Input-Image"							,   self.original_image							)
    cva.waitKey(5000							)
    cva.destroyAllWindows()


if __name__ == "__main__":
     A_		:     List[Any]        =     os.path.join(os.path.basename(__file__), '''image_data/input.jpg''')
     A_		:     int        =     ConstantStretch()
     stretcher.stretch(file_path)
     stretcher.plot_histogram()
     stretcher.show_image()

