Nov-23-2018, 03:01 PM
(This post was last modified: Nov-23-2018, 03:01 PM by Shameendra.)
I am trying to access a folder "frames" which contains image files which i want to open with python. My code is:
However when I run this in Anaconda virtual environment, i get the following error:
Traceback (most recent call last):
File "trctocsv.py", line 19, in <module>
for n, image_file in enumerate(os.scandir(frames)):
NameError: name 'frames' is not defined
It seems "frames" folder can not be read by my script. Any suggestions how to resolve this?
import os
import matplotlib.pyplot as plt
import cv2
from matplotlib.widgets import RectangleSelector
#global constants
img = None
tl_list = []
br_list = []
object_list = []
#constants
image_folder = 'C:/Users/Angel of Darkness/Downloads/Desktop/Thesis/videos/1_05/frames'
savedir = 'annotations'
obj = 'red_hat'
if __name__ == '__main__':
for n, image_file in enumerate(os.scandir(frames)):
img = image_file
fig, ax = plt.subplots(1)
image = cv2.imread(image_file.path)
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
ax.imshow(image)
plt.show() However when I run this in Anaconda virtual environment, i get the following error:
Traceback (most recent call last):
File "trctocsv.py", line 19, in <module>
for n, image_file in enumerate(os.scandir(frames)):
NameError: name 'frames' is not defined
It seems "frames" folder can not be read by my script. Any suggestions how to resolve this?
