-
Notifications
You must be signed in to change notification settings - Fork 66
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
fps? #16
Comments
I'm not sure as this library was not developed to record many frames in a second, more like a frame every now and then |
This is something for you to test out as it depends on system configuration. I've only ever tested this on Windows, I may get to do it on a mac at some point. On Windows I recall the fastest pixel array retrieval taking around 10ms, that would mean 100fps if you don't count in any image processing at all (i.e. if you only need the pixels). I thought this was slow though and it was impossible to multithread the retrieval due to the Windows API. I think it's almost guaranteed to work better on mac and linux. If speed is what you're looking for, you shouldn't use this package directly, rather, take a look at lines 30 to 51 for the darwin implementation and copy what you need. |
100fps is probably good enough. I was thinking of putting this in front of something like the MAME emulator and pipe the images to an AI engine. There's a github repo somewhere that does exactly this but it is specific to MAME and also uses python. |
Might be a little late to the party but for people just wanting to know: Testing setup:Laptop: M2 macbook air (16GB of ram if it matters)Tested in golang: go version go1.21.6 darwin/arm64Tested in goland IDEScreenshot duration: 105MS Interesting discovery:It appears when doing this in a loop over 100 iterations it appears that the average time to take a screenshot appears to be Code used for testing: screen.go package capture
import (
"github.com/vova616/screenshot"
"image"
)
func Capture() (image.Image, error) {
img, err := screenshot.CaptureScreen()
if err != nil {
return nil, err
}
myImg := image.Image(img)
return myImg, nil
} screen_test.go package capture
import (
"testing"
"time"
)
func TestCapture(t *testing.T) {
beginTime := time.Now()
_, err := Capture()
if err != nil {
t.Error("Capture failed: ", err)
}
elapsed := time.Since(beginTime)
t.Logf("Capture took %s", elapsed)
} |
what kind of fps can I expect on a relatively decent mac?
The text was updated successfully, but these errors were encountered: