summaryrefslogtreecommitdiff
path: root/java/tests/Refocus/src/com/android/rs/test/DepthImage.java
blob: cc7c53a159dc42fe8687ff141ef620150ad84965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.android.rs.refocus;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;


import android.os.AsyncTask;
import android.support.v8.renderscript.Allocation;
import android.support.v8.renderscript.RenderScript;

import java.io.IOException;
import java.io.InputStream;

/**
 * Created by hoford on 5/15/15.
 */
public class DepthImage {
    private final String mFormat;
    private final double mFar;
    private final double mNear;
    private final Bitmap mDepthBitmap;
    private final double mBlurAtInfinity;
    private final double mFocalDistance;
    private final double mDepthOfFiled;
    private final double mFocalPointX;
    private final double mFocalPointY;
    private final DepthTransform mDepthTransform;
    public DepthImage(Context context, Uri data) throws IOException {
        InputStream input = context.getContentResolver().openInputStream(data);
        XmpDepthDecode decode = new XmpDepthDecode(input);
        mFormat = decode.getFormat();
        mFar = decode.getFar();
        mNear = decode.getNear();
        mDepthBitmap = decode.getDepthBitmap();
        mBlurAtInfinity = decode.getBlurAtInfinity();
        mFocalDistance = decode.getFocalDistance();
        mDepthOfFiled = decode.getDepthOfField();
        mFocalPointX = decode.getFocalPointX();
        mFocalPointY = decode.getFocalPointY();
        input = context.getContentResolver().openInputStream(data);
        mDepthTransform = decode.getDepthTransform();
    }

    public Bitmap getDepthBitmap() {
        return mDepthBitmap;
    }

    public DepthTransform getDepthTransform() { return mDepthTransform; }

    public String getFormat() {
        return mFormat;
    }

    public double getFar() {
        return mFar;
    }

    public double getNear() {
        return mNear;
    }

    public double getBlurAtInfinity() {
        return mBlurAtInfinity;
    }

    public double getFocalDistance() {
        return mFocalDistance;
    }

    public double getDepthOfField() {return mDepthOfFiled; }

    public double getFocalPointX() {
        return mFocalPointX;
    }

    public double getFocalPointY() {
        return mFocalPointY;
    }
}