





import math
import os

import cva
import numpy as np

_UpperCAmelCase										=					255.0




def 			lowerCAmelCase_			(				UpperCamelCase_       ,		UpperCamelCase_	)  ->		float:
       UpperCamelCase_ 							=	np.mean((original - contrast) ** 2	)
       if mse == 0:
              return 100

       return 20 * math.logaa(PIXEL_MAX / math.sqrt(UpperCamelCase_	)	)




def 			lowerCAmelCase_			(				)  ->		None:
       UpperCamelCase_ 							=	os.path.dirname(os.path.realpath(UpperCamelCase_	)	)
       # Loading images (original image and compressed image)
       UpperCamelCase_ 							=	cva.imread(os.path.join(UpperCamelCase_       ,		"image_data/original_image.png"	)	)
       UpperCamelCase_ 							=	cva.imread(os.path.join(UpperCamelCase_       ,		"image_data/compressed_image.png"	)       ,		1	)

       UpperCamelCase_ 							=	cva.imread(os.path.join(UpperCamelCase_       ,		"image_data/PSNR-example-base.png"	)	)
       UpperCamelCase_ 							=	cva.imread(
           os.path.join(UpperCamelCase_       ,		"image_data/PSNR-example-comp-10.jpg"	)       ,		1	)

       # Value expected: 29.73dB
       print("-- First Test --"	)
       print(F'''PSNR value is {peak_signal_to_noise_ratio(UpperCamelCase_       ,		UpperCamelCase_	)} dB'''	)

       # # Value expected: 31.53dB (Wikipedia Example)
       print("\n-- Second Test --"	)
       print(F'''PSNR value is {peak_signal_to_noise_ratio(UpperCamelCase_       ,		UpperCamelCase_	)} dB'''	)


if __name__ == "__main__":
     main()









"""simple docstring"""




UpperCamelCase											=     [
    [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0],
    [0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
]






def 							lowerCAmelCase			(   UpperCamelCase_:				int  ,			UpperCamelCase_:				int  ,			UpperCamelCase_:				int  ,			UpperCamelCase_:				int       )							->				bool:







  '''simple docstring'''







  return 0 <= row < rows and 0 <= col < cols






def 							lowerCAmelCase			(   UpperCamelCase_:				int  ,			UpperCamelCase_:				int  ,			UpperCamelCase_:				set  ,			UpperCamelCase_:				list[list[int]]       )							->				int:







  '''simple docstring'''







  _a					      =						len(UpperCamelCase_       )
  _a					      =						len(mat[0]       )
  if is_safe(UpperCamelCase_  ,			UpperCamelCase_  ,			UpperCamelCase_  ,			UpperCamelCase_       ) and (row, col) not in seen and mat[row][col] == 1:
    seen.add((row, col)       )
    return (
        1
        + depth_first_search(row + 1  ,			UpperCamelCase_  ,			UpperCamelCase_  ,			UpperCamelCase_       )
        + depth_first_search(row - 1  ,			UpperCamelCase_  ,			UpperCamelCase_  ,			UpperCamelCase_       )
        + depth_first_search(UpperCamelCase_  ,			col + 1  ,			UpperCamelCase_  ,			UpperCamelCase_       )
        + depth_first_search(UpperCamelCase_  ,			col - 1  ,			UpperCamelCase_  ,			UpperCamelCase_       )
    )
  else:
    return 0






def 							lowerCAmelCase			(   UpperCamelCase_:				list[list[int]]       )							->				int:







  '''simple docstring'''







  _a					      =						set()

  _a					      =						0
  for row, line in enumerate(UpperCamelCase_       ):
    for col, item in enumerate(UpperCamelCase_       ):
      if item == 1 and (row, col) not in seen:
        # Maximizing the area
        _a					      =						max(UpperCamelCase_  ,			depth_first_search(UpperCamelCase_  ,			UpperCamelCase_  ,			UpperCamelCase_  ,			UpperCamelCase_       )       )
  return max_area


if __name__ == "__main__":
     import doctest

     print(find_max_area(matrix))  # Output -> 6
     doctest.testmod()


