Accessing Webcam

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Mutive
Veteran
Posts: 344
Joined: Tue Nov 21, 2017 2:23 am
Completed: Eidolon, Minion!, Love Furever, Epilogue
Contact:

Accessing Webcam

#1 Post by Mutive »

Hi everyone!

I am currently fooling around with the idea of accessing a webcam through Renpy (the thought is that the characters can "see" you when your webcam is enabled).

To do this, I've been trying to utilize the cv2 module (https://opencv.org/) and have been trying to activate it using the 3rd party python modules as described here: https://www.renpy.org/doc/html/python.h ... d-packages

My code looks like this:

Code: Select all

A "Can I see you? Just for a little?"    

menu:
    "Yes":
        python hide:
            import cv2
            cap = cv2.VideoCapture(0)
            while(True):
                # Capture frame-by-frame
                ret, frame = cap.read()
                if cap.isOpened():
                    print("You're so gorgeous!")
                else:
                    print("Stop hiding from me!")
                # When everything done, release the capture
                cap.release()
                cv2.destroyAllWindows()
    "No":
        A "Oooh."
However, it is glitching out when it gets to the "import cv2" portion.

I suspect that I've installed cv2 incorrectly (I've downloaded it into the games/python-packages folder, but am not sure where/how to run the command

Code: Select all

pip install --target game/python-packages requests
in Renpy.

Can anyone help? (This isn't a necessary feature, but I do love the idea of the characters being able to "see" the player, if that makes any sense. Not to mention, being able to import additional Python modules is always super helpful!)
Enjoy Eidolon, my free to play game at: https://mutive.itch.io/eidolon, Minion! at: https://mutive.itch.io/minion or Epilogue at: https://mutive.itch.io/epilogue

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Accessing Webcam

#2 Post by rayminator »

right now it is not possible

never seen a game that does that

someone else wanted to do that as well

pytom said it is not possible to do with rempy

stated here
viewtopic.php?f=8&t=48593&p=480392&hilit=camera#p480392

Mutive
Veteran
Posts: 344
Joined: Tue Nov 21, 2017 2:23 am
Completed: Eidolon, Minion!, Love Furever, Epilogue
Contact:

Re: Accessing Webcam

#3 Post by Mutive »

Ah, good to know. :) Thanks for including the link!
Enjoy Eidolon, my free to play game at: https://mutive.itch.io/eidolon, Minion! at: https://mutive.itch.io/minion or Epilogue at: https://mutive.itch.io/epilogue

Post Reply

Who is online

Users browsing this forum: Alex, Google [Bot]