text_plain_output_1.png
import cv2

import matplotlib.pyplot as plt

import os

path = '/kaggle/input/fruit-images-for-object-detection/train_zip/train'
fileslst = os.listdir(path)
imgs = []
for fle in fileslst:
    if fle.endswith('.jpg'):
        imgs.append(fle)
img = cv2.imread('/kaggle/input/fruit-images-for-object-detection/train_zip/train/' + imgs[1])
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.imshow(img)
img = cv2.cvtColor(img, cv2.COLOR_RGB2HSV)
plt.subplot(231)
plt.imshow(img[:, :, 0])
plt.subplot(232)
plt.imshow(img[:, :, 1])
plt.subplot(233)
plt.imshow(img[:, :, 2])
imgedg = []
imgedg0 = cv2.Canny(img[:, :, 0], 120, 200)
imgedg1 = cv2.Canny(img[:, :, 1], 120, 200)
imgedg2 = cv2.Canny(img[:, :, 2], 120, 200)
plt.subplot(234)
plt.imshow(imgedg0)
plt.subplot(235)
plt.imshow(imgedg1)
plt.subplot(236)
plt.imshow(imgedg2)