Unauthorized imports in python opencv samples

I have a problem running opt_flow.py in / opencv / samples / python 2. Everything is fine in / samples / python. But in python2, something seems to be missing.

Python version: 2.7.3 IDE: pyDev in Eclipse

running opt_flow.py from https://github.com/jonmarimba/OpenCVMirror/blob/ff81e19a7a12764c657e2765d69ef166065f5e61/opencv/samples/python2/opt_flow.py

The following are snippets of code:

import cv2, cv2.cv as cv import video from common import anorm2, draw_str from time import clock ... 

and errors appear.

  Description Resource Path Location Type Unresolved import: video optical_flow.py /practice/test line 9 PyDev Problem Unresolved import: draw_str optical_flow.py /practice/test line 10 PyDev Problem Unresolved import: anorm2 optical_flow.py /practice/test line 10 PyDev Problem 

that I did not find any appropriate solution to this error, can anyone help?

+6
source share
1 answer

I had the same problem, so the answer here is just to make others understand:

The opencv examples import other files into the same folder. The video.py file is in the same place where you found the sample that you used. If you copy one of the examples, you will also have to copy the other files it imports, including video.py, common.py, and others.

+15
source

Source: https://habr.com/ru/post/924994/


All Articles