【问题标题】:Is there a programmatic way to detect if the camera has an optical zoom?是否有一种编程方式来检测相机是否具有光学变焦功能?
【发布时间】:2013-09-17 17:24:57
【问题描述】:

似乎有一些带有光学变焦功能的 Android 设备,例如

  • 三星 S4 Zoom (OS 4.2)
  • Altek A14 和 A16(操作系统 2.3.5)

有没有办法以编程方式检测到这一点?

由于相机通常需要几秒钟来初始化,因此在我的应用程序中有一些流程,我会在预期用户即将使用它的情况下启动相机(因此当他们实际按下我的应用程序内时,应用程序会感觉更快相机按钮)。如果相机有光学变焦,那么我不想这样做,因为镜头会滑出并惹恼用户。

如果我必须将这些设备列入黑名单,是否有人知道所有具有光学变焦功能的 Android 设备的列表,最好是它们的 Build.MANUFACTURERBuild.PRODUCT 字符串?

如果有帮助,这里是我最近购买的 S4 Zoom 的 Camera.Parameters:

{preferred-preview-size-for-video=704x528, factory-af-led-lv-limit=-1,-1, zoom=0, factory-af-scan-limit=-1,-1, max-num-detected-faces-hw=0, continuous-mode=off, zoom-supported=true, metering=center, whitebalance=auto, scene-mode=auto, jpeg-quality=1, factory-testno=0, factory-af-diff-check=-1,-1, preview-format-values=yuv420sp,yuv420p, best-mode=off, red-eye-fix=fail, jpeg-thumbnail-quality=100, preview-format=yuv420sp, low-light-mode=off, zoom-action=zoom-stop, face-detection=off, video-size-values=1920x1080,1280x720,800x450,768x512,640x480,320x240,176x144, factory-zoom-slope-check-data=-1,-1, preview-size=960x540, focal-length=4.300000, flash-charging=0, factory-cap-range=-1,-1, factory-iris-range=-1,-1, flash-mode-values=off,auto,red-eye,on,fillin,slow,red-eye-fix, preview-frame-rate-values=30,15, factory-af-scan-range=-1,-1, max-num-metering-areas=0, preview-frame-rate=30, focus-mode-values=auto,infinity,macro,fixed,face-detection,continuous,continuous-picture,continuous-video,manual,multi,touch,object-tracking, jpeg-thumbnail-width=224, video-size=0x0, scene-mode-values=auto,portrait,landscape,night,beach,snow,sunset,fireworks,sports,party,candlelight,dusk-dawn,fall-color,back-light,text, preview-fps-range-values=(7000,30000), jpeg-thumbnail-size-values=224x126,160x120,192x128,0x0, zoom-ratios=100,120,140,160,180,220,310,420,560,790,1000, preview-size-values=960x540,768x512,704x576,704x528,640x524,640x480,320x240, smart-scene-detection=0, factory-zoom-range-check-data=-1,-1, factory-af-led-range=-1,-1,-1,-1, picture-size-values=4608x2592,3264x2448,4608x3456,4608x3072,4096x2304,3960x2640,3648x2736,2592x1944,2304x1728,1984x1488,1920x1080,1024x768,960x720,640x480, preview-fps-range=7000,30000, auto-whitebalance-lock=false, min-exposure-compensation=-6, antibanding=off, max-num-focus-areas=1, vertical-view-angle=46.3, factory-wb-value=-1,-1,-1,-1, zoom-ring=-1, horizontal-view-angle=67, video-stabilization-supported=false, jpeg-thumbnail-height=126, continuous-fps=, focus-mode=auto, factory-sc-speedtime=-1,-1, factory-gyro-range-data=-1,-1,-1,-1, auto-whitebalance-lock-supported=true, video-frame-format=yuv420sp, max-num-detected-faces-sw=0, picture-format-values=jpeg, wb-k=-1, max-exposure-compensation=6, factory-ois-range-data=-1,-1,-1,-1,-1,-1,-1, focus-areas=(0,0,0,0,0), exposure-compensation=0, exposure-compensation-step=0.33, flash-mode=off, flash-standby=off, auto-exposure-lock=false, wb-custom=-1,-1, effect-values=none,mono,negative,sepia,antique,point-blue,point-red,point-yellow,warm,cold, factory-punt-range-data=-1,-1,-1, factory-vib-range-data=-1,-1,-1,-1,-1,-1, picture-size=4608x2592, max-zoom=10, factory-gain-liveview-range=-1,-1, effect=none, blink=fail, whitebalance-values=auto,fluorescent-h,fluorescent-l,daylight,cloudy-daylight,custom,temperature,incandescent,prohibition,horizon,ledlight, picture-format=jpeg, focus-distances=0.15,1.20,Infinity, factory-flash-range=-1,-1, raw-save=0, auto-exposure-lock-supported=true, curr_zoom_level=0, hdr-mode=0, antibanding-values=60hz,off}

仅供参考,它将其 Build.PRODUCT 报告为 mproject3gub

【问题讨论】:

  • 也许您可以从可通过Camera.Parameters(例如焦距)查询的可用数据中得出光学变焦的存在。也许这些制造商稍微调整了 API 并在 Camera.Parameters 中添加了新的检测方法。您可以尝试通过反射为字段和方法迭代该类。
  • 您目前是否可以使用具有光学变焦功能的设备?

标签: android android-camera


【解决方案1】:

有没有办法以编程方式检测到这一点?

不通过公共 API,例如 Camera.Parameters

理论上,所有此类制造商都可能对一些未记录的 API 进行了标准化,例如 Camera.Parameters 中的一些未记录值。从理论上讲,我也有可能会自发地重新长出我丢失的头发。我不会指望这些都是真的。

有谁知道所有带有光学变焦功能的 Android 设备的列表,最好是它们的 Build.MANUFACTURER 和 Build.PRODUCT 字符串

我怀疑是否存在,考虑到我所知道的一台具有光学变焦功能的设备(三星 Galaxy 相机)报告的 Build.PRODUCT 值 (gd1wifiue) 显示在整个 Internet 上的总共五个页面上截至撰写本文时,已由 Google 编制索引,包括此页面。请注意,我还没有拿到 Galaxy 相机,因此报告给我的值可能不正确。

【讨论】:

  • 该网站声称按设备显示构建值:gfxbench.com/…
  • @DanJ:是的,但我看不到在那个网站上,他们指出设备是否具有光学变焦功能。
  • 对不起,我不清楚 - 我只是指 Build.PRODUCT 值。它显示了 S4 Zoom 的 3 个值:mproject3gub、mproject3gxx、mproject3gzs。
  • 仅供参考,我买了一个新的 S4 Zoom(下面的链接),它确认 Build.PRODUCT 是 mproject3gub amazon.com/Samsung-Galaxy-Unlocked-Camera-Smartphone/dp/…(抱歉,我原来的评论不正确)
【解决方案2】:

此方法可能会有所帮助: Camera.Parameters.isZoomSupported():

公共布尔isZoomSupported()

如果支持缩放,则返回 true。应用程序应该在使用其他缩放方法之前调用它。

(在 API 级别 8 中添加)

编辑:

此方法包括数码变焦和光学变焦

【讨论】:

  • 抱歉,这包括数码变焦和光学变焦。
  • 好的,如果你这么说的话。我应该删除这个答案吗?
  • 这取决于你。在这里找到答案并没有什么特别的危害。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-02-19
  • 2019-05-13
  • 2012-08-26
  • 1970-01-01
  • 2012-03-30
  • 2017-09-18
  • 2023-04-01
相关资源
最近更新 更多