# Define the kernel matrix for blurring kernel_blur= np.array([[1/9, 1/9, 1/9], [1/9, 1/9, 1/9], [1/9, 1/9, 1/9]])
# Apply the emboss filter Blurry_Image = cv2.filter2D(image, -1, kernel_blur)
# Display the original and processed images cv2.imshow('Original Image', image) cv2.imshow('Blurry Image', Blurry_image) cv2.waitKey(0) cv2.destroyAllWindows()
# Open the video file video = cv2.VideoCapture('video.mp4')
# Get the video's frame width and height width = int(video.get(cv2.CAP_PROP_FRAME_WIDTH)) height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT))
# Create a video writer object output_file = 'output.mp4' video_writer = cv2.VideoWriter(output_file, cv2.VideoWriter_fourcc(*'mp4v'), 30, (width, height))
# Loop through each frame of the video whileTrue: # Read the current frame ret, frame = video.read()
# If the frame was not successfully read, end the loop ifnot ret: break Edge_detection_Matrix = np.array([[-1, -1, -1], [-1, 8, -1], [-1, -1, -1]]) # Apply the filter to the current frame result = cv2.filter2D(frame, -1, Emboss_Matrix)
# Write the frame to the video file video_writer.write(result)
# Show the current frame cv2.imshow('Result', result)
# Wait for key press if cv2.waitKey(1) == ord('q'): break
# Release the video reader and writer, and close all windows video.release() video_writer.release() cv2.destroyAllWindows()
# Save the result video to a specific file path output_path = 'path/to/save/output.mp4' cv2.imwrite(output_path, result)