Fail to import smbus in OpenCV?? [closed]
I am a newbie working on a project which requires the use of a PWM driver board (Adafruit PCA9685) and control it through data obtained from openCV. I'm using raspberry pi 2 and OpenCV 2.7 as my platform. Initially, I tested my PWM driver board with the official example code provided by Adafruit, and it worked perfectly. However, when I implant my code into OpenCV, error messages keep popping up.
Traceback (most recent call last):
File "HSV_servo.py", line 3, in <module>
from Adafruit_PWM_Servo_Driver import PWM
File "/home/pi/test/PWM_Servo/Adafruit_PWM_Servo_Driver.py", line 5, in <module>
from Adafruit_I2C import Adafruit_I2C
File "/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_PWM_Servo_Driver/Adafruit_I2C.py", line 3, in <module>
import smbus
ImportError: No module named smbus
It seems that openCV failed to recognize python-smbus, is there any solution??
My code for reference (not yet complete):
#!/usr/bin/python
from Adafruit_PWM_Servo_Driver import PWM
import time
#import necessary packages
from picamera.array import PiRGBArray
from picamera import PiCamera
import cv2
import numpy as np
import argparse
"It seems that openCV failed to recognize python-smbus," - that is wrong, it is your Adafruit_I2C module that wants smbus, not cv2
Would you kindly guide me how to import smbus for Adafruit_I2C in openCV environment? I can run my code written for Adafruit and opencv seperately, but I failed to import smbus for Adafruit in CV environment.... A little help would be really appreciated!
again, unfortunately, all of this is off-topic here
Sorry to ask again....where should I post this question? Clearly it's related to the working environment of Opencv....