Skip to content
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

Unusably low framerate on camera.html #20

Open
ajbouh opened this issue Feb 20, 2018 · 6 comments
Open

Unusably low framerate on camera.html #20

ajbouh opened this issue Feb 20, 2018 · 6 comments
Labels

Comments

@ajbouh
Copy link

ajbouh commented Feb 20, 2018

I'm seeing framerates that are either 1 or zero depending on the size of the polygon I draw on camera.html. This is using Chrome Dev Beta Version 66.0.3346.8 on a MacBook Pro (Retina, 15-inch, Mid 2014). Camera is a Logitech BRIO via USB.

I ran some basic profiling in Chrome and as expected it looks like a lot of time is spent in the compiled opencv code.

I'm wondering if I need to write some code that uses WebGL to analyze the frame or if there's another simpler approach here that will work.

Has much effort been put into performance yet? Any low hanging fruit I can help investigate?

@janpaul123
Copy link
Owner

@osnr is currently looking into doing the whole dot detection in shaders instead of in OpenCV.

For a quick fix you could consider limiting the resolution of the camera. 4k is probably overkill for now. I'd happily accept a PR that does that (and we can revert it when performance is good enough to support that resolution).

@janpaul123 janpaul123 added the bug label Feb 20, 2018
@ajbouh
Copy link
Author

ajbouh commented Feb 20, 2018 via email

@osnr
Copy link
Collaborator

osnr commented Feb 20, 2018

Another tip from JP: keep the camera window as a front tab in its window (I think keeping it focused might even be better?) Chrome will throttle background tabs and kill responsiveness.

Minimum viable resolution will definitely depend on camera and distance from papers, so it should probably be a slider or global constant or something.

@janpaul123
Copy link
Owner

I think my camera (Logitech C922) is 1280x720, which works fine.

@osnr would it be useful to share your progress so far if @ajbouh wants to play with it?

@osnr
Copy link
Collaborator

osnr commented Mar 7, 2018

@ajbouh I just got this working, see this branch: https://github.com/janpaul123/paperprograms/tree/osnr-regl-detect

Neither JP nor I have a 4K webcam, so I'd love to hear how well this works for you. I get about a 3x speedup for my 1080p camera.

@janpaul123
Copy link
Owner

Posted here now: #28

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

No branches or pull requests

3 participants