Well I would read up on canvas -> google search
Find a reference and tutorial that makes sense to you, there are many.
And the adjust the idea in this example to your needs. I will add this is all quickly put together and is by no means the only way of doing things.
Update
version 1. initial version
video_Camera_Browser_Stream_ImageCapture_v1.hype.zip (15.8 KB)
Live demo updated to v1
https://markosx.com/httpshypetests/camerastreamSnap/v1
version 2. example showing one way of how to increase capture image size.
video_Camera_Browser_Stream_ImageCapture_v2.hypetemplate.zip (26.0 KB)
Full details for v2 in post below
Live demo updated to v2 ( 28-01-23 )
v2 demo live demo