New issue
Advanced search Search tips

Issue 732807 link

Starred by 6 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

Add support for |focusDistance| to image capture

Project Member Reported by mcasas@chromium.org, Jun 13 2017

Issue description

Add support for manual focus distance to image capture, which 
was landed in [1], see [2].

[1] https://github.com/w3c/mediacapture-image/pull/175
[2] https://w3c.github.io/mediacapture-image/#mediatrackcapabilities-section
 
Miguel, I will like to take a shot at this.
Owner: rijubrat...@intel.com
Status: Started (was: Available)
Project Member

Comment 3 by bugdroid1@chromium.org, Sep 3

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3015459a9bf07f62ab7a8816ff88824568d87c04

commit 3015459a9bf07f62ab7a8816ff88824568d87c04
Author: Rijubrata Bhaumik <rijubrata.bhaumik@intel.com>
Date: Mon Sep 03 01:00:11 2018

[Image Capture] Add focusDistance constraint.

This CL adds focusDistance to ImageCapture API.
This was added to the spec in
https://github.com/w3c/mediacapture-image/pull/175

Layout tests and mock tests are updated to support the same.
Support for Android is added.

TEST= run the demo in https://codepen.io/rijuB/pen/NzWpxG
use slider to change focusDistance.

BUG=732807

Intent to Implement and Ship discussions:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/oNxzXaFY9c8

Change-Id: I9b7cbf3c85fd35741a8c7ed229910a996e14ee8f
Reviewed-on: https://chromium-review.googlesource.com/1124839
Reviewed-by: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Commit-Queue: Rijubrata Bhaumik <rijubrata.bhaumik@intel.com>
Cr-Commit-Position: refs/heads/master@{#588299}
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/media/capture/mojom/image_capture.mojom
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/media/capture/mojom/image_capture_types.cc
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/media/capture/video/android/java/src/org/chromium/media/PhotoCapabilities.java
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/media/capture/video/android/java/src/org/chromium/media/VideoCapture.java
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera.java
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/media/capture/video/android/photo_capabilities.cc
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/media/capture/video/android/photo_capabilities.h
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/media/capture/video/android/video_capture_device_android.cc
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/media/capture/video/fake_video_capture_device.cc
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/media/capture/video/fake_video_capture_device_unittest.cc
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/media/capture/video/file_video_capture_device.cc
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/WebKit/LayoutTests/external/wpt/mediacapture-image/ImageCapture-MediaTrackSupportedConstraints.html
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/WebKit/LayoutTests/external/wpt/mediacapture-image/MediaStreamTrack-applyConstraints-getSettings.html
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/WebKit/LayoutTests/external/wpt/mediacapture-image/MediaStreamTrack-applyConstraints.html
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/WebKit/LayoutTests/external/wpt/mediacapture-image/MediaStreamTrack-getCapabilities.html
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/WebKit/LayoutTests/external/wpt/mediacapture-image/MediaStreamTrack-getConstraints-fast.html
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/WebKit/LayoutTests/external/wpt/mediacapture-image/MediaStreamTrack-getSettings.html
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/WebKit/LayoutTests/external/wpt/resources/chromium/image_capture.mojom.js
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/WebKit/LayoutTests/external/wpt/resources/chromium/mock-imagecapture.js
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/blink/renderer/modules/imagecapture/image_capture.cc
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/blink/renderer/modules/mediastream/media_stream_track.cc
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/blink/renderer/modules/mediastream/media_track_capabilities.idl
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/blink/renderer/modules/mediastream/media_track_constraint_set.idl
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/blink/renderer/modules/mediastream/media_track_settings.idl
[modify] https://crrev.com/3015459a9bf07f62ab7a8816ff88824568d87c04/third_party/blink/renderer/modules/mediastream/media_track_supported_constraints.idl

Project Member

Comment 4 by bugdroid1@chromium.org, Sep 3

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a1e334b15b79c428727fcb4227ab80d70ca8cfaf

commit a1e334b15b79c428727fcb4227ab80d70ca8cfaf
Author: Rijubrata Bhaumik <rijubrata.bhaumik@intel.com>
Date: Mon Sep 03 06:07:13 2018

[ImageCapture] Add focusDistance constraint support on Linux/CrOS.

TEST= run the demo in https://codepen.io/rijuB/pen/BPyWzp
use slider to change focusDistance.

Tested using a brio-stream-4k-hd-webcam,
where we could change the focus distance in manual mode.

command line:
v4l2-ctl -d 1 --set-ctrl=focus_auto=0
v4l2-ctl -d 1 --set-ctrl=focus_absolute=100

GUI:
guvcview  --device=/dev/video1


BUG=732807

Intent to Implement and Ship discussions:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/oNxzXaFY9c8

Change-Id: I63143426ff89505c27026c4b97e54ac9afae4b0f
Reviewed-on: https://chromium-review.googlesource.com/1135134
Reviewed-by: Miguel Casas <mcasas@chromium.org>
Commit-Queue: Rijubrata Bhaumik <rijubrata.bhaumik@intel.com>
Cr-Commit-Position: refs/heads/master@{#588336}
[modify] https://crrev.com/a1e334b15b79c428727fcb4227ab80d70ca8cfaf/media/capture/video/linux/v4l2_capture_delegate.cc

Project Member

Comment 5 by bugdroid1@chromium.org, Oct 31

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/279257eaced7db1629db48823aef4df547858ecf

commit 279257eaced7db1629db48823aef4df547858ecf
Author: Rijubrata Bhaumik <rijubrata.bhaumik@intel.com>
Date: Wed Oct 31 08:49:47 2018

[Image Capture] Add browser_tests for focusDistance constraint.

This is a JavaScript based test which is skipped if focusDistance is not
supported. This test is run both on real cameras on some bots and also
against the FakeVideoCaptureDevice.

BUG=732807

Change-Id: I87be1cbf96aa79adcd539732f421bcfe69f92981
Reviewed-on: https://chromium-review.googlesource.com/c/1306498
Commit-Queue: Rijubrata Bhaumik <rijubrata.bhaumik@intel.com>
Reviewed-by: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604186}
[modify] https://crrev.com/279257eaced7db1629db48823aef4df547858ecf/content/browser/webrtc/webrtc_image_capture_browsertest.cc
[modify] https://crrev.com/279257eaced7db1629db48823aef4df547858ecf/content/test/data/media/image_capture_test.html
[modify] https://crrev.com/279257eaced7db1629db48823aef4df547858ecf/media/capture/video/fake_video_capture_device.cc
[modify] https://crrev.com/279257eaced7db1629db48823aef4df547858ecf/media/capture/video/fake_video_capture_device.h
[modify] https://crrev.com/279257eaced7db1629db48823aef4df547858ecf/media/capture/video/fake_video_capture_device_factory.cc
[modify] https://crrev.com/279257eaced7db1629db48823aef4df547858ecf/media/capture/video/fake_video_capture_device_unittest.cc

Has this shipped for Android yet? I have an Android 6.0 device and in canary (M72) I'm seeing focusDistance listed under getSupportedConstraints() but not being listed in track.getCapabilities(). The demo (https://codepen.io/rijuB/pen/NzWpxG) says focus distance isn't supported. Even if it was 'fixed focus', shouldn't it still be listed under track.getCapabilities() with an infinity to infinity range? Manual focus mode is listed under 'focusMode'.
Re #6: Thanks for the work on the spec. I checked Canary on my Samsung Galaxy S8+. The demo works fine there. Regarding fixed-focus, there was no guidance regarding infinity to infinity range, but we can see if we need to add anything as a note to implementers.
#7: Any way for me to confirm outside of Chrome that the device does or does not support manual focus? I'd be very surprised if it did not, and as mentioned, track.getCapabilitites() is reporting manual focus as a possible focus mode. If there's not ability to set focusDistance this doesn't make much sense.
I have used the native camera apps (samsung camera app or say Camera FV-5 Lite from app store, also Open camera), checked the Pro/ Manual mode and played around with  focusDistance/exposureTime, etc. 
You may want to check this test app [1].

[1] https://play.google.com/store/apps/details?id=pl.vipek.camera2_compatibility_test

Sign in to add a comment