Fixing OpenCV Image Not Found Error During Preprocessing for Tissue Sample Recognition

Still based on my project image recognition system that can analyze images of tissue samples, identify malignancies, and predict possible symptoms and causes. How do i preprocess the captured images to make them suitable for model inference?, am currently using my pc camera to test the model and also using VS code for IDE

My aim is to capture and preprocess images for further analysis. But I keep on encountering this error
    OpenCV Error: Image not found

Here's my code (the script below uses my pc camera)
    import cv2
    import numpy as np
    
    img = cv2.imread('tissue_sample.jpg')
    
    gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  
    resized_img = cv2.resize(gray_img, (224, 224))
  
    normalized_img = resized_img / 255.0
Was this page helpful?