【问题标题】:How to get length, height of object (image) in android camera?如何在android相机中获取对象(图像)的长度、高度?
【发布时间】:2014-03-19 08:37:31
【问题描述】:

我是相机新手,我想使用 android 相机获取原始对象的长度和高度。我尝试了以下代码:

double d22 = angle_of_top_object;
double d12 = Math.tan(Math.toRadians(d22));
Log.d("angle", roll_angle + "");
double d23 = 15 * d12;
tv.setText("Length:"+new DecimalFormat("##.####").format(d23)+" cm ");
Toast.makeText(CameraTestActivity.this, tv.getText().toString(), Toast.LENGTH_SHORT).show();
Log.i("Length", tv.getText().toString());

【问题讨论】:

  • 你知道物体离你的镜头有多远吗?

标签: android camera measurement


【解决方案1】:

您可以像这样使用并获得像这样的值... 你只是

添加您的视图名称,例如 Imageview、TextView 等...

int ht = viewName..getLayoutParams().height;
int ht = viewName..getLayoutParams().width;

【讨论】:

  • 我想要原始对象的长度和高度
猜你喜欢
  • 1970-01-01
  • 2018-04-29
  • 1970-01-01
  • 2011-06-08
  • 2015-02-09
  • 2021-08-15
  • 1970-01-01
  • 2013-01-03
  • 1970-01-01
相关资源
最近更新 更多