I followed this website (https://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-opencv-and-python/) to set my picamera, but I have a problem with the picamera module. I did install the picamera module, and this picture is from pip freeze.
https://imgur.com/a/3y5b2rO
You can see I have picamera 1.13 already, but when I try test_image.py, it says "No module named ‘picamera'".
https://imgur.com/a/XMEXwXJ
I have uninstalled and installed many times, but the error still exist. How do I fix this?
test_image.py
# import the necessary packages
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2
# initialize the camera and grab a reference to the raw camera capture
camera = PiCamera()
rawCapture = PiRGBArray(camera)
# allow the camera to warmup
time.sleep(0.1)
# grab an image from the camera
camera.capture(rawCapture, format="bgr")
image = rawCapture.array
# display the image on screen and wait for a keypress
cv2.imshow("Image", image)
cv2.waitKey(0)
for python3 you have to just try this below commands.keep in mind that you need to open terminal in home directory.
sudo -H apt install python3-picamera
sudo -H pip3 install --upgrade picamera[array]
let me know if it works!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With