You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to annotate over frames coming out of mlx90640 thermal camera using OpenCV. It is connected to the GPIO of the raspberry pi using I2C interface protocol. Seems like Opencv can recognize USB cams out of box but not i2c is it so? When I run my python code(with only import of cv2 ) to get annotated video output , I get an index error when using 1 or 0. This is maybe because in the code the object, source expects the camera to be connected serially through USB and not connected directly onto the raspberry pi module via i2c. Any thoughts on how to achieve this? If there is any code statements or component part that may be of use to solve this problem that will help a lot.
Here is the python code for this using opencv on raspberry pi:
import cv2
Use source = 0 to specify the web cam as the video source, OR
specify the pathname to a video file to read.
source = 1
Create a video capture object from the VideoCapture Class.
Enter a while loop to read and display the video frames one at a time.
while True:
# Read one frame at a time using the video capture object.
has_frame, frame = video_cap.read()
if not has_frame:
break
# Display the current frame in the named window.
cv2.imshow(win_name, frame)
# Use the waitKey() function to monitor the keyboard for user input.
# key = cv2.waitKey(0) will display the window indefinitely until any key i$
# key = cv2.waitKey(1) will display the window for 1 ms
key = cv2.waitKey(0)
# The return value of the waitKey() function indicates which key was presse$
# You can use this feature to check if the user selected the `q` key to qui$
if key == ord('Q') or key == ord('q') or key == 27:
# Exit the loop.
video_cap.release()
cv2.destroyWindow(win_name)
Thanks.
The text was updated successfully, but these errors were encountered:
Exauce-belayi
changed the title
MLX90640 raspberry pi connection using I2C interface
MLX90640 raspberry pi connection using I2C interface Opencv
Sep 29, 2021
Hello,
I would like to annotate over frames coming out of mlx90640 thermal camera using OpenCV. It is connected to the GPIO of the raspberry pi using I2C interface protocol. Seems like Opencv can recognize USB cams out of box but not i2c is it so? When I run my python code(with only import of cv2 ) to get annotated video output , I get an index error when using 1 or 0. This is maybe because in the code the object, source expects the camera to be connected serially through USB and not connected directly onto the raspberry pi module via i2c. Any thoughts on how to achieve this? If there is any code statements or component part that may be of use to solve this problem that will help a lot.
Here is the python code for this using opencv on raspberry pi:
import cv2
Use source = 0 to specify the web cam as the video source, OR
specify the pathname to a video file to read.
source = 1
Create a video capture object from the VideoCapture Class.
video_cap = cv2.VideoCapture(source)
Create a named window for the video display.
win_name = 'Video Preview'
cv2.namedWindow(win_name)
Enter a while loop to read and display the video frames one at a time.
while True:
# Read one frame at a time using the video capture object.
has_frame, frame = video_cap.read()
if not has_frame:
break
# Display the current frame in the named window.
cv2.imshow(win_name, frame)
video_cap.release()
cv2.destroyWindow(win_name)
Thanks.
The text was updated successfully, but these errors were encountered: