theRAPTLab / gsgo

GEM-STEP Foundation repo migrated from GitLab June 2023
1 stars 1 forks source link

Feature: WebCam - [merged] #718

Closed benloh closed 1 year ago

benloh commented 2 years ago

Merges dev-bl/webcam -> dev-next

WebCam

This adds a background div behind the simulation render with a video stream from a camera attached to the server.

Currently only tested on Chrome. You'll need to allow permissions to access the camera. You should be able to select the camera source using Chrome's "Privacy and security" > "Site settings" > "Camera".

Activating

The "WebCam" checkbox on Main (navbar) will turn the camera on and off.

Calibration

When the camera is on, you can use the sliders to change:

To Test

  1. Connect a webcam to your server computer (or you can use the built-in camera)
  2. Start Chrome
  3. In Chrome settings "Privacy and security" > "Site settings" > "Camera"...
  4. ...select the camera you want to use.
  5. ...click "Sites can ask to use your camera"
  6. You'll probably also want to set up and run either pozyx or ptrack for calibration purposes.
  7. npm run gem
  8. Go to http://localhost/app/login and select a simple project with no background sprites
  9. Go to Main
  10. Click the "WebCam" checkbox.
  11. If you see The user denied permission to access the web camera. in the web console, then you did not enable the camera correctly.
  12. You'll probably be asked for permission to access the camera: "http://localhost wants to: > Use your camera". Click "Allow"
  13. After about a second the stream should start.
  14. Move a Pozyx tag or PTrack object/person onto the play area. Generally it's easiest to set up 3 points for comparison.
  15. Use the sliders at the bottom of the screen to adjust the video to map to the person/objects.
  16. Your settings will be saved with the project so that next time you load the project, the project will retain the same calibration. The project will also remember if the WebCam checkbox was on or off.

If you want to test background sprites, currently the solution is to edit the initScript for the background sprite, adding the line: prop alpha setTo 0.5. For some reason setting it in the blueprint does not currently work. Looking into that.

Known Issues / To Do

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

requested review from @jdanish

benloh commented 2 years ago

In GitLab by @jdanish on Sep 14, 2022, 14:36

I think we need the video on the back layer so that we can move things around, etc. But I'll verify with Noel once I can test.

benloh commented 2 years ago

added 3 commits

Compare with previous version

benloh commented 2 years ago

added 3 commits

Compare with previous version

benloh commented 2 years ago

added 2 commits

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

marked the checklist item Figure out how to set alpha on background sprites so video will show through as completed

benloh commented 2 years ago

marked the checklist item initScript works, but not setting it in blueprint as completed

benloh commented 2 years ago

marked the checklist item @jdanish Decide if having video on back layer is OK (e.g. you have to adjust background sprites), or if you want video on the top layer and give up the ability to select and interact with the agents. as completed

benloh commented 2 years ago

@jdanish Setting the alpha property in the blueprint for any background sprites does actually work. You just need to keep in mind that hovering over any sprite makes it opaque. This was necessary to make the selection outline be visible.

So if this works for Noel, this PR should be ready.

benloh commented 2 years ago

In GitLab by @jdanish on Sep 15, 2022, 15:20

Awesome. He should be testing it soon.

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 2 commits

Compare with previous version

benloh commented 2 years ago

Merging.

benloh commented 2 years ago

mentioned in commit b8fd6b8369e9f3df4e6eca5792b68cff1df8204d