LaserWeb / LaserWeb4

Collaborative effort on the next version of LaserWeb / CNCWeb
GNU Affero General Public License v3.0
711 stars 192 forks source link

UI: Webcam Support #30

Closed ghost closed 7 years ago

ghost commented 8 years ago

Action: Port / Rewrite functionality from LW3 + Enhancement

Present Source: https://github.com/LaserWeb/LaserWeb3/blob/master/public/js/viewer.js#L40-L81 and https://github.com/LaserWeb/LaserWeb3/blob/master/public/js/viewer.js#L434-L490

Desired result: Top down bed view to line up operations, but also investigate functionality with USB microscope webcams for edge detections / stock sizing / zero point finding

jorgerobles commented 7 years ago

@DarklyLabs I've updated the test bench with number fields to fine grain the transformation. Dropped FOV as certainly is not working (I will try to contact @jywarren for further research)

About resolution, this is a tricky part as getUserMedia is not stable on all browsers. As example, https://webrtchacks.github.io/WebRTC-Camera-Resolution/ comes with a patchy way to get the real resolutions supported by chrome. Only to say I've got a FullHD camera and only gets 640x480 on the test.

ghost commented 7 years ago

@jorgerobles The fields are perfect. Well done. The next step would be to implement this into LW4 so we can start to use to controls to check against artwork and material .

It would be ideal to store these values into a 'machine profile'.

With respect to resolution, since we will be using a known camera and resolution, is it possible to define the resolution and store this in the machine profile?

jorgerobles commented 7 years ago

@DarklyLabs I've moved the test interface to LW4. About resolution, please do a quick scan on https://webrtchacks.github.io/WebRTC-Camera-Resolution/ and post the CSV, thanks!

ghost commented 7 years ago

@jorgerobles Looking good. One feature you had in the regltest version was the ability to turn on/off the persoective distortion. This made it really easy to initially setup the draggable controls onto the undistorted image. Can this be included?

The webrtc link did not correctly detect the real resolutions for our camera. I have attached the csv in case it is useful: gumResTestExport.csv.zip

jorgerobles commented 7 years ago

Yes, don't worry will be :)

jorgerobles commented 7 years ago

@DarklyLabs could you run https://webrtchacks.github.io/WebRTC-Camera-Resolution/ on Full Scan? Thanks!

ghost commented 7 years ago

@tbfleming Is there any chance you could assist @jorgerobles in adding the camera display underlay to the workspace?

tbfleming commented 7 years ago

I created #139 to answer his porting questions.

jorgerobles commented 7 years ago

@DarklyLabs I've partial success on workspace video check it out :) No effects yet, though.

ghost commented 7 years ago

@jorgerobles Yeah! Well done. It seems to be displaying well. Thank you.

ghost commented 7 years ago

@jorgerobles Any progress on implementing the distortions onto the webspace canvas?

jorgerobles commented 7 years ago

@DarklyLabs not yet :frowning_face:

ghost commented 7 years ago

@jorgerobles It looks like the latest dev-es6 branch prevents us from selecting the resolution we require for our camera. It limits us to 640x480, which is incorrect for our need.

Can you change this back to what how it was working previously by allowing us to select the resolution we required?

jorgerobles commented 7 years ago

@DarklyLabs I've spent past whole week hunting bugs for getUserMedia. I've tested all the cameras I've got (An 1080 HD zalman, a Logitech 270, a endoscopic chinese one) to consistently check the resolutions. It's definitely a webrtc implementation (Chrome hardware). No matter what sometimes the camera did not get the resolution properly, nor honor constraints in two different canvases. The previous version is equally borked, maybe we have to put a timeout to try the camera stuff after a while, seems chrome browser does not have the capabilities in the first time. This is very frustrating. All I can do is take another round of camera issues. What camera have you got? (I will bet for an OV5640 )

00-no_camera_installed

01-zalman_camera_plugged_refresh

02-dropdown

03-ultra_low

04-low_high_webrtc_bug

PS. I'm not pissed off. Just explaining :smile:

jorgerobles commented 7 years ago

@DarklyLabs Maybe your resolution is not listed and so the get stripped. Please run https://webrtchacks.github.io/WebRTC-Camera-Resolution/ at full scan

image

ghost commented 7 years ago

@jorgerobles I can appreciate how frustrating this must be and really want to thank you for sticking with it. We will run this scan again today and let you know the results. We ran it yesterday and it did not detect the correct camera setting correctly. We will try a different computer today.

ghost commented 7 years ago

@jorgerobles Looks like the link above doesn't work with this camera. It errors out. The camera we have is a USB2, 5 megapixel (2592x1944)

ghost commented 7 years ago

Any chance you can ship one of those exact ones to Jorge? Might make dev easier than the back and forth of testing on your side and coding on his?

On Mar 1, 2017 1:54 AM, "DarklyLabs" notifications@github.com wrote:

@jorgerobles https://github.com/jorgerobles Looks like the link above doesn't work with this camera. It errors out. The camera we have is a USB2, 5 megapixel (2592x1944)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/LaserWeb4/issues/30#issuecomment-283199812, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr2zJ4NFyLYgCi0UU2cmkASeVAmte9ks5rhLOdgaJpZM4Ku2XI .

ghost commented 7 years ago

@openhardwarecoza good idea @jorgerobles can you email me your address and contact number.

jorgerobles commented 7 years ago

@DarklyLabs Done :)

ghost commented 7 years ago

@jorgerobles We have just run a firmware update on our camera and it is now passing the webrtc-camera-resolution test with 1920x1080.

Browser Device Res Name Ratio Ask Actual Status chrome 56 PC Camera (058f:3830) 1920x1080 16:9 1920x1080 1920x1080 pass

Any ideas why this resolution isn't offered through LW?

jorgerobles commented 7 years ago

@DarklyLabs That resolution is supported https://github.com/LaserWeb/LaserWeb4/blob/dev-es6/src/lib/video-capture.js#L8 And so, my camera does https://github.com/LaserWeb/LaserWeb4/issues/30#issuecomment-282959462

The only thing I wonder is if we have to put a sleep between camera resolution detection, but is now using promises to it should take the time the chrome<->hardware needs.

The other thing I could do is just no forbid any resolution, skipping all detection. If a resolution change does throw an Overconstraint error then disable the option.

ghost commented 7 years ago

@jorgerobles Not sure what is involved from your end, but it may be worthwhile trying.

jorgerobles commented 7 years ago

@DarklyLabs Hmm.. I will go for not forbid resolution first. I will branch and send you the git to your tests.

jorgerobles commented 7 years ago

@DarklyLabs https://github.com/LaserWeb/LaserWeb4/tree/video_tests

ghost commented 7 years ago

@jorgerobles Can you explain how to use this version? When we select the camera it sits there with a spinning cursor on the video resolution field. Tried to enter a resolution but it still sat there.

jorgerobles commented 7 years ago

@DarklyLabs Shame on me. I pushed the branch too fast. Is now fixed.

I have to find a way to get if the resolution changes are really true or are Chrome-Faked. I've observed no verified changes are done when you choose higher resolutions. :frowning_face:

jorgerobles commented 7 years ago

@DarklyLabs, @openhardwarecoza, Sorry, I give up.

Have no way to consistently prove the resolutions obtained are true. We should ditch the resolution combo, because does nothing real as far as I tested. Has been so long fighting with this issue, maybe we can reopen in later this year, with a new perspective.

Also @tbfleming, I have no clue of WebGL, and I would personally appreciate if you could translate the remaining effects from REGL to LWGL, thanks.

ghost commented 7 years ago

@jorgerobles @tbfleming We have been testing our camera and working with the manufacturer for the last few days. It looks like under windows, the resolutions are reported correctly but there is a problem under OSX for the camera.

With the current functionality you have in dev-es6, all that is missing for us is to have the effects from setup view applied to the viewport view.

This will at least allow our users to use their camera, even if its low resolution at the moment.

jorgerobles commented 7 years ago

Going fresh. videoport