Skimage Error: "NameError: name 'exposure' is not defined"

77 Views Asked by At

Im currently learning about HOG and Python. Im using a Python 3.10 and scikit-image 0.22.0. So im having a code like this:

from skimage import feature
import cv2
import numpy as np
import matplotlib as plt

img = cv2.imread('pic.jpg', cv2.IMREAD_UNCHANGED)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

hogImage = feature.hog(gray, orientations=9, pixels_per_cell=(8, 8),
    cells_per_block=(2, 2), transform_sqrt=True, block_norm="L2",
    visualize=True)

hogImage = exposure.rescale_intensity(hogImage, out_range=(0, 255))
hogImage = hogImage.astype("uint8")

plt.imshow(hogImage)

When i run this, the console show this error

Traceback (most recent call last):
  File "D:\Program Files\Python\Projects\main.py", line 13, in <module>
    hogImage = exposure.rescale_intensity(hogImage, out_range=(0, 255))
NameError: name 'exposure' is not defined

Process finished with exit code 1

How can i fix this error?

0

There are 0 best solutions below