<jupyter_start><jupyter_text>Creando un filtro "Edge Detection"  Importar librerias e imagen<jupyter_code>import matplotlib.pyplot as plt
import matplotlib.image as mpimg

import cv2
import numpy as np

%matplotlib inline

# Read in the image
image = mpimg.imread('images/curved_lane.jpg')

plt.imshow(image)<jupyter_output><empty_output><jupyter_text>Convert the image to grayscale<jupyter_code># Convertir imagen a grises
gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)

plt.imshow(gray, cmap='gray')<jupyter_output><empty_output><jupyter_text>Crear un custom kernel basado en los operadores sobel![title](images/filters.png)<jupyter_code># Create a custom kernel

# 3x3 array for edge detection
sobel_x = np.array([[ -1,  0,  1], 
                   [  -2,  0,  2], 
                   [  -1,  0,  1]])


sobel_y = np.array([[ -1, -2, -1], 
                   [   0,  0,  0], 
                   [   1,  2,  1]])


# Filter the image using filter2D, which has inputs: (grayscale image, bit-depth, kernel)  
filtered_image_y = cv2.filter2D(gray, -1, sobel_y)
filtered_image_x = cv2.filter2D(gray, -1, sobel_x)

plt.imshow(filtered_image_y, cmap='gray')
plt.imshow(filtered_image_x, cmap='gray')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12081632653061225, 'fraction_numerical': 0.025306122448979593, 'mean_word_length': 3.7890625, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '86100', 'license': 'Apache-2.0', 'n_tokens_mistral': 496, 'n_tokens_neox': 468, 'n_words': 107, 'path': 'work/.ipynb_checkpoints/5_0_edgte_custom-checkpoint.ipynb', 'repo_name': 'adawolfs/Computer-Vision-IAGT', 'size': '1225'}