8000 python 3.12 support camera ecc. · Issue #64 · zayfod/pycozmo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

python 3.12 support camera ecc. #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
The0Cosmo opened this issue May 15, 2024 · 0 comments
Open

python 3.12 support camera ecc. #64

The0Cosmo opened this issue May 15, 2024 · 0 comments

Comments

@The0Cosmo
Copy link

the code wont work for the camera i am triyng in the version python 3.12 , 3.8

i am new at coding i tried this ai code dint worked pls someune give me a code that works like it got all the fuctions of the app becous i cant dowload it in android 14

import cv2
import pycozmo
import time

Initialize Cozmo client

cli = pycozmo.Client()

Connect to Cozmo

cli.start()
cli.connect()
cli.wait_for_robot()

Function to display camera feed

def display_camera_feed():
while True:
# Capture frame-by-frame
image = cli.camera.latest_image.raw_image

    # Convert image to RGB (OpenCV uses BGR)
    image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

    # Display the resulting frame
    cv2.imshow('Cozmo Camera', image)

    # Break the loop if 'q' is pressed
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# When everything is done, release the capture
cv2.destroyAllWindows()

Start a thread to display the camera feed

camera_thread = threading.Thread(target=display_camera_feed)
camera_thread.start()

Keep the program running for some time

time.sleep(30) # Adjust the time as needed

Disconnect from Cozmo

cli.disconnect()
cli.stop()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0