




'''simple docstring'''







from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey
from numpy import array, dot, pad, ravel, uinta, zeros






def 						_lowercase						(      lowercase_		,				lowercase_    ):



		'''simple docstring'''







		_snake_case			,       _snake_case      			=			image.shape
		_snake_case      			=			cols - block_size[1] + 1
		_snake_case      			=			rows - block_size[0] + 1
		_snake_case      			=			zeros((dst_height * dst_width, block_size[1] * block_size[0])    )
		_snake_case      			=			0
		for i in range(0		,				_SCREAMING_SNAKE_CASE    ):
				for j in range(0		,				_SCREAMING_SNAKE_CASE    ):
						_snake_case      			=			ravel(image[i : i + block_size[0], j : j + block_size[1]]    )
						_snake_case      			=			window
						row += 1

		return image_array






def 						_lowercase						(      lowercase_		,				lowercase_    ):



		'''simple docstring'''







		_snake_case			,       _snake_case      			=			image.shape[0], image.shape[1]
		_snake_case      			=			filter_kernel.shape[0]
		_snake_case      			=			k_size // 2
		# Pads image with the edge values of array.
		_snake_case      			=			pad(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE		,				mode="edge"    )

		# im2col, turn the k_size*k_size pixels into a row and np.vstack all rows
		_snake_case      			=			imacol(_SCREAMING_SNAKE_CASE		,				(k_size, k_size)    )

		#  turn the kernel into shape(k*k, 1)
		_snake_case      			=			ravel(_SCREAMING_SNAKE_CASE    )
		# reshape and get the dst image
		_snake_case      			=			dot(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE    ).reshape(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE    )
		return dst


if __name__ == "__main__":
						# read original image
						_lowerCamelCase				:		Optional[int]				      =    imread(R'../image_data/lena.jpg')
						# turn image in gray scale value
						_lowerCamelCase				:		Any				      =    cvtColor(img, COLOR_BGR2GRAY)
						# Laplace operator
						_lowerCamelCase				:		Tuple				      =    array([[0, 1, 0], [1, -4, 1], [0, 1, 0]])
						_lowerCamelCase				:		Optional[int]				      =    img_convolve(gray, Laplace_kernel).astype(uinta)
						imshow('Laplacian', out)
						waitKey(0)










def 				UpperCAmelCase__		(					_SCREAMING_SNAKE_CASE :						float  ,					_SCREAMING_SNAKE_CASE :						float					)->float:
      _lowerCAmelCase			      =	float()
      try:
            _lowerCAmelCase			      =	mass * acceleration
      except Exception:
            return -0.0
      return force


if __name__ == "__main__":
    import doctest

    # run doctest
    doctest.testmod()

    # demo
    UpperCAmelCase_          =				12.5
    UpperCAmelCase_          =				1_0
    UpperCAmelCase_          =				newtons_second_law_of_motion(mass, acceleration)
    print("The force is ", force, "N")