Computer Vision Scripting Help

GPC2 script programming for Titan Two. Code examples, questions, requests.

Computer Vision Scripting Help

Postby kjlivezey2000 » Sun Apr 12, 2020 9:57 pm

How I would go about making a script that can scan the video output for a specific pixel or picture? Or a script that looks at a specific area of the video output for that pixel or picture? I'm a bit new to using the computer vision, I have it set up where I can see the video output using my Elgato HD60S in GTuner, but I don't know how to use that in any scripts. I believe its the GCV scripts that I need to learn how to make.
User avatar
kjlivezey2000
Staff Sergeant
Staff Sergeant
 
Posts: 10
Joined: Wed Jan 29, 2020 10:16 pm

Re: Computer Vision Scripting Help

Postby Mad » Sun Apr 12, 2020 10:21 pm

Check out the existing scripts in the online resource, you can find them in the "Misc" section.

Blank GCV script example:
Code: Select all
import os
import cv2
 
class GCVWorker:
    def __init__(self, width, height):
        os.chdir(os.path.dirname(__file__))
        if width != 1920 or height != 1080:
            print("WARNING: This GCV script is optimized for 1920x1080 resolution")
        self.gcvdata = bytearray([0xFF, 0xFF, 0xFF, 0xFF, 0xFF])
 
    def __del__(self):
        del self.gcvdata
 
    def process(self, frame):
        return (frame, None)


gcv_ready() https://www.consoletuner.com/wiki/index ... :gcv_ready
gcv_read() https://www.consoletuner.com/wiki/index ... 2:gcv_read
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Computer Vision Scripting Help

Postby kjlivezey2000 » Sun Apr 12, 2020 10:56 pm

So would I put this code in a GPC script? Or do I need to open a GCV script? I'm not sure how to do that if that's the case.
User avatar
kjlivezey2000
Staff Sergeant
Staff Sergeant
 
Posts: 10
Joined: Wed Jan 29, 2020 10:16 pm

Re: Computer Vision Scripting Help

Postby Chaka » Mon Apr 13, 2020 1:17 am

Put it into a gcv script
User avatar
Chaka
Master Sergeant
Master Sergeant
 
Posts: 36
Joined: Tue Feb 05, 2019 4:18 am

Re: Computer Vision Scripting Help

Postby xnorsis » Fri Jul 23, 2021 6:13 pm

How does the gsv script look like with the gsv file?

Also how to I select the script in the computer vision tab drop down?

Doesn't seem to be there?
User avatar
xnorsis
Private First Class
Private First Class
 
Posts: 2
Joined: Mon Jul 19, 2021 5:03 am

Re: Computer Vision Scripting Help

Postby Mad » Sat Jul 24, 2021 9:29 pm

xnorsis wrote:Also how to I select the script in the computer vision tab drop down?

Doesn't seem to be there?

You need to save the script in a folder and set it as your working directory.
step 4: viewtopic.php?f=15&t=15147
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 53 guests