

'''simple docstring'''





import copy
import os

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





class     snake_case_			:


							"""simple docstring"""





							def __init__( self							):
												__lowerCAmelCase					=							''''''
												__lowerCAmelCase					=							''''''
												__lowerCAmelCase					=							[]
												__lowerCAmelCase					=							0
												__lowerCAmelCase					=							2_5_6
												__lowerCAmelCase					=							0
												__lowerCAmelCase					=							0
												__lowerCAmelCase					=							0
												__lowerCAmelCase					=							0




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




							def        A__  ( self							):
												plt.hist(self.img.ravel()					,						2_5_6					,						[0, 2_5_6]							)




							def        A__  ( 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      				=     os.path.join(os.path.basename(__file__), '''image_data/input.jpg''')
		lowerCamelCase      				=     ConstantStretch()
		stretcher.stretch(file_path)
		stretcher.plot_histogram()
		stretcher.show_image()









def        __lowercase    (  UpperCAmelCase__		,					UpperCAmelCase__      ):

					"""simple docstring"""






					assert x is not None
					assert y is not None

					__lowerCAmelCase					=							len(UpperCAmelCase__      )
					__lowerCAmelCase					=							len(UpperCAmelCase__      )

					# declaring the array for storing the dp values
					__lowerCAmelCase					=							[[0] * (n + 1) for _ in range(m + 1      )]  # noqa: E741

					for i in range(1		,					m + 1      ):
										for j in range(1		,					n + 1      ):
															__lowerCAmelCase					=							1 if x[i - 1] == y[j - 1] else 0

															__lowerCAmelCase					=							max(l[i - 1][j]		,					l[i][j - 1]		,					l[i - 1][j - 1] + match      )

					__lowerCAmelCase					=							''
					__lowerCAmelCase,	__lowerCAmelCase					=							m, n
					while i > 0 and j > 0:
										__lowerCAmelCase					=							1 if x[i - 1] == y[j - 1] else 0

										if l[i][j] == l[i - 1][j - 1] + match:
															if match == 1:
																				__lowerCAmelCase					=							x[i - 1] + seq
															i -= 1
															j -= 1
										elif l[i][j] == l[i - 1][j]:
															i -= 1
										else:
															j -= 1

					return l[m][n], seq


if __name__ == "__main__":
		lowerCamelCase      				=     '''AGGTAB'''
		lowerCamelCase      				=     '''GXTXAYB'''
		lowerCamelCase      				=     4
		lowerCamelCase      				=     '''GTAB'''

		lowerCamelCase				,				lowerCamelCase      				=     longest_common_subsequence(a, b)
		print('''len =''', ln, ''', sub-sequence =''', subseq)
		import doctest

		doctest.testmod()






