

'''simple docstring'''





import copy
import os

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


class SCREAMING_SNAKE_CASE  :






			"""simple docstring"""




			def __init__(    self							):

				"""simple docstring"""


				snake_case_      		= ''
				snake_case_      		= ''
				snake_case_      		= []
				snake_case_      		= 0
				snake_case_      		= 2_56
				snake_case_      		= 0
				snake_case_      		= 0
				snake_case_      		= 0
				snake_case_      		= 0


			def 			__lowerCAmelCase (    self ,				__UpperCamelCase							):

				"""simple docstring"""


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


			def 			__lowerCAmelCase (    self							):

				"""simple docstring"""


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







			def 			__lowerCAmelCase (    self							):

				"""simple docstring"""


				cva.imshow('Output-Image' ,				self.img							)
				cva.imshow('Input-Image' ,				self.original_image							)
				cva.waitKey(50_00							)
				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()



# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# this script dumps information about the environment

import os
import platform
import sys


A											=     '3'

print('Python version:', sys.version)

print('OS platform:', platform.platform())
print('OS architecture:', platform.machine())

try:
		import torch

		print('Torch version:', torch.__version__)
		print('Cuda available:', torch.cuda.is_available())
		print('Cuda version:', torch.version.cuda)
		print('CuDNN version:', torch.backends.cudnn.version())
		print('Number of GPUs available:', torch.cuda.device_count())
except ImportError:
		print('Torch version:', None)

try:
		import transformers

		print('transformers version:', transformers.__version__)
except ImportError:
		print('transformers version:', None)
