0

so here is my code

import matplotlib.pyplot as plt
import numpy as np
import os
import cv2
#load data
data_directory = r"C:\Users\ikon\PycharmProjects\LogisticRegression\dataset\CnicData"
CATEGORIES = ['Cnic', 'noCnic']
for category in CATEGORIES:
    path = os.path.join(data_directory,category)
    for img in os.listdir(path):
        img_array = cv2.imread(os.path.join(path,img),
                               cv2.IMREAD_GRAYSCALE)
        IMG_SIZE = 50
        new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE))
        plt.imshow(img_array, cmap="gray")
        plt.show()
        break

my issue is whenever i use cv2.resize or .imread the error it gives is Cannot find reference 'imread' in '__init__.py' or ```Cannot find reference 'resize ' in 'init.py'````

i tried uninstalling and installing the library again but it does not work. actually i was trying to resize the image using IMG_SIZE but i saw that as soon as i output the picture it is not pixelated as it should be due to the given size kindly let me know if there is any missing information

Jeru Luke
  • 20,118
  • 13
  • 80
  • 87

0 Answers0