【问题标题】:Low Pass Filter android低通滤波器安卓
【发布时间】:2015-10-13 03:20:35
【问题描述】:

我正在尝试从该站点调整低通滤波器: Low Pass Filter

我的问题是我不知道下面这行的目标是什么:

int rotation = Compatibility.getRotation(this);

为了搜索这方面的信息,我进行了很多谷歌搜索,但没有运气。有人知道它是做什么的吗?

见下面的代码:

@Override
public void onSensorChanged(SensorEvent evt) {
    if (evt.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
        gravSensorVals = lowPass(evt.values.clone(), gravSensorVals);
    } else if (evt.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) {
        magSensorVals = lowPass(evt.values.clone(), magSensorVals);
    }
    if (gravSensorVals != null && magSensorVals != null) {
        SensorManager.getRotationMatrix(RTmp, I, gravSensorVals, magSensorVals);
        int rotation = Compatibility.getRotation(this);
        if (rotation == 1) {
            SensorManager.remapCoordinateSystem(RTmp, SensorManager.AXIS_X, SensorManager.AXIS_MINUS_Z, Rot);
        } else {
            SensorManager.remapCoordinateSystem(RTmp, SensorManager.AXIS_Y, SensorManager.AXIS_MINUS_Z, Rot);
        }
        SensorManager.getOrientation(Rot, results);
        UIARView.azimuth = (float)(((results[0]*180)/Math.PI)+180);
        UIARView.pitch = (float)(((results[1]*180/Math.PI))+90);
        UIARView.roll = (float)(((results[2]*180/Math.PI)));
        radarMarkerView.postInvalidate();
    }
}

【问题讨论】:

    标签: android filter


    【解决方案1】:

    来自 android 文档:here,它将检查设备方向。因此,1 的值为 ROTATION_90。设备逆时针旋转 90 度。

    【讨论】:

    • 但我在 Compatibility 关键字上遇到编译错误...这是一个 android 类吗?
    • 不,这是增强现实课程的一部分。在 android 你必须使用 view.getDisplay.getRotation();反而。 github.com/Bhide/AugmentedRealityView/blob/master/ARView/src/…
    • 好的,我想这段代码 int rotation=Compatibility.getRotation(this),我不需要下面的条件,因为我只想过滤加速度计和磁场值。通过应用lowPass函数就足够了,对吧?
    • 另外我认为,在我只想过滤噪声的情况下,没有必要在sensormanger上应用remapCoordinateSystem,对吧?
    猜你喜欢
    • 2012-05-03
    • 1970-01-01
    • 2014-07-29
    • 2011-05-29
    • 2019-04-29
    • 2015-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多