当前位置: 首页>>代码示例>>Java>>正文


Java CaptureResult类代码示例

本文整理汇总了Java中android.hardware.camera2.CaptureResult的典型用法代码示例。如果您正苦于以下问题:Java CaptureResult类的具体用法?Java CaptureResult怎么用?Java CaptureResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CaptureResult类属于android.hardware.camera2包,在下文中一共展示了CaptureResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: detectFaces

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
private void detectFaces(CaptureResult captureResult) {
    Integer mode = captureResult.get(CaptureResult.STATISTICS_FACE_DETECT_MODE);

    if (isViewAvailable() && mode != null) {
        android.hardware.camera2.params.Face[] faces = captureResult.get(CaptureResult.STATISTICS_FACES);
        if (faces != null) {
            Log.i(TAG, "faces : " + faces.length + " , mode : " + mode);
            for (android.hardware.camera2.params.Face face : faces) {
                Rect faceBounds = face.getBounds();
                // Once processed, the result is sent back to the View
                presenterView.onFaceDetected(mapCameraFaceToCanvas(faceBounds, face.getLeftEyePosition(),
                        face.getRightEyePosition()));
            }
        }
    }
}
 
开发者ID:raulh82vlc,项目名称:Image-Detection-Samples,代码行数:17,代码来源:FDCamera2Presenter.java

示例2: checkState

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
private void checkState(CaptureResult result) {
    /*switch (mState) {
        case STATE_PREVIEW:
            // NOTHING
            break;
        case STATE_WAITING_CAPTURE:
            int afState = result.get(CaptureResult.CONTROL_AF_STATE);

            if (CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED == afState ||
                    CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED == afState
                    ||  CaptureResult.CONTROL_AF_STATE_PASSIVE_FOCUSED == afState
                    || CaptureResult.CONTROL_AF_STATE_PASSIVE_UNFOCUSED == afState) {
                //do something like save picture
            }
            break;
    }*/
}
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:18,代码来源:MyCamera2Fragment.java

示例3: toFile

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
/**
 * Generate a human-readable string of the given capture request and write
 * it to the given file.
 */
public static void toFile(String title, CameraMetadata<?> metadata, File file) {
    try {
        // Will append if the file already exists.
        FileWriter writer = new FileWriter(file, true);
        if (metadata instanceof CaptureRequest) {
            dumpMetadata(title, (CaptureRequest) metadata, writer);
        } else if (metadata instanceof CaptureResult) {
            dumpMetadata(title, (CaptureResult) metadata, writer);
        } else {
            writer.close();
            throw new IllegalArgumentException("Cannot generate debug data from type "
                    + metadata.getClass().getName());
        }
        writer.close();
    } catch (IOException ex) {
        Log.e(TAG, "Could not write capture data to file.", ex);
    }
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:23,代码来源:CaptureDataSerializer.java

示例4: stateFromCamera2State

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
/**
 * Convert reported camera2 AF state to OneCamera AutoFocusState.
 */
public static OneCamera.AutoFocusState stateFromCamera2State(int state) {
    switch (state) {
        case CaptureResult.CONTROL_AF_STATE_ACTIVE_SCAN:
            return OneCamera.AutoFocusState.ACTIVE_SCAN;
        case CaptureResult.CONTROL_AF_STATE_PASSIVE_SCAN:
            return OneCamera.AutoFocusState.PASSIVE_SCAN;
        case CaptureResult.CONTROL_AF_STATE_PASSIVE_FOCUSED:
            return OneCamera.AutoFocusState.PASSIVE_FOCUSED;
        case CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED:
            return OneCamera.AutoFocusState.ACTIVE_FOCUSED;
        case CaptureResult.CONTROL_AF_STATE_PASSIVE_UNFOCUSED:
            return OneCamera.AutoFocusState.PASSIVE_UNFOCUSED;
        case CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED:
            return OneCamera.AutoFocusState.ACTIVE_UNFOCUSED;
        default:
            return OneCamera.AutoFocusState.INACTIVE;
    }
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:22,代码来源:AutoFocusHelper.java

示例5: controlAFStateToString

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
/**
 * Utility function: converts CaptureResult.CONTROL_AF_STATE to String.
 */
private static String controlAFStateToString(int controlAFState) {
    switch (controlAFState) {
        case CaptureResult.CONTROL_AF_STATE_INACTIVE:
            return "inactive";
        case CaptureResult.CONTROL_AF_STATE_PASSIVE_SCAN:
            return "passive_scan";
        case CaptureResult.CONTROL_AF_STATE_PASSIVE_FOCUSED:
            return "passive_focused";
        case CaptureResult.CONTROL_AF_STATE_ACTIVE_SCAN:
            return "active_scan";
        case CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED:
            return "focus_locked";
        case CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED:
            return "not_focus_locked";
        case CaptureResult.CONTROL_AF_STATE_PASSIVE_UNFOCUSED:
            return "passive_unfocused";
        default:
            return "unknown";
    }
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:24,代码来源:AutoFocusHelper.java

示例6: onImageCaptured

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
@Override
public void onImageCaptured(Image image, TotalCaptureResult
        captureResult) {
    long timestamp = captureResult.get(CaptureResult.SENSOR_TIMESTAMP);

    // We should only capture the image if it's more recent than the
    // latest one. Synchronization is necessary since this method is
    // called on {@link #mImageSaverThreadPool}.
    synchronized (mLastCapturedImageTimestamp) {
        if (timestamp > mLastCapturedImageTimestamp.get()) {
            mLastCapturedImageTimestamp.set(timestamp);
        } else {
            // There was a more recent (or identical) image which has
            // begun being saved, so abort.
            return;
        }
    }

    mReadyStateManager.setInput(
            ReadyStateRequirement.CAPTURE_NOT_IN_PROGRESS, true);

    mSession.startEmpty();
    savePicture(image, mParams, mSession);
    mParams.callback.onPictureTaken(mSession);
    Log.v(TAG, "Image saved.  Frame number = " + captureResult.getFrameNumber());
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:27,代码来源:OneCameraZslImpl.java

示例7: process

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
private void process(CaptureResult captureResult) {
    switch (mCaptureState) {
        case STATE_PREVIEW:
            // Do nothing
            break;
        case STATE_WAIT_LOCK:
            mCaptureState = STATE_PREVIEW;
            Integer afState = captureResult.get(CaptureResult.CONTROL_AF_STATE);
            if(afState == CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED ||
                    afState == CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED) {
                Toast.makeText(getApplicationContext(), "AF Locked!", Toast.LENGTH_SHORT).show();
                startStillCaptureRequest();
            }
            break;
    }
}
 
开发者ID:mobapptuts,项目名称:android_camera2_api_video_app,代码行数:17,代码来源:Camera2VideoImageActivity.java

示例8: onCaptureProgressed

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
@Override
public void onCaptureProgressed(CameraCaptureSession session, CaptureRequest request,
                                CaptureResult partialResult) {
    Log.d(TAG, "mSessionCaptureCallback,  onCaptureProgressed");
    mSession = session;
    checkState(partialResult);
}
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:8,代码来源:MyCamera2Fragment.java

示例9: ImageSaver

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
private ImageSaver(Image image, File file, CaptureResult result,
                   CameraCharacteristics characteristics, Context context,
                   RefCountedAutoCloseable<ImageReader> reader) {
    mImage = image;
    mFile = file;
    mCaptureResult = result;
    mCharacteristics = characteristics;
    mContext = context;
    mReader = reader;
}
 
开发者ID:gengqifu,项目名称:361Camera,代码行数:11,代码来源:Camera2Fragment.java

示例10: qq

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
public void qq() {
    mPreviewRequestBuilder.set(CaptureRequest.CONTROL_EFFECT_MODE, CaptureResult.CONTROL_EFFECT_MODE_MONO);
    mPreviewRequest = mPreviewRequestBuilder.build();
    try {
        mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback, null);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:10,代码来源:CameraNew2.java

示例11: checkControlAfState

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
/**
 * Complain if CONTROL_AF_STATE is not present in result.
 * Could indicate bug in API implementation.
 */
public static boolean checkControlAfState(CaptureResult result) {
    boolean missing = result.get(CaptureResult.CONTROL_AF_STATE) == null;
    if (missing) {
        // throw new IllegalStateException("CaptureResult missing CONTROL_AF_STATE.");
        Log.e(TAG, "\n!!!! TotalCaptureResult missing CONTROL_AF_STATE. !!!!\n ");
    }
    return !missing;
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:13,代码来源:AutoFocusHelper.java

示例12: checkLensState

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
/**
 * Complain if LENS_STATE is not present in result.
 * Could indicate bug in API implementation.
 */
public static boolean checkLensState(CaptureResult result) {
    boolean missing = result.get(CaptureResult.LENS_STATE) == null;
    if (missing) {
        // throw new IllegalStateException("CaptureResult missing LENS_STATE.");
        Log.e(TAG, "\n!!!! TotalCaptureResult missing LENS_STATE. !!!!\n ");
    }
    return !missing;
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:13,代码来源:AutoFocusHelper.java

示例13: logExtraFocusInfo

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
public static void logExtraFocusInfo(CaptureResult result) {
    if(!checkControlAfState(result) || !checkLensState(result)) {
        return;
    }

    Object tag = result.getRequest().getTag();

    Log.v(TAG, String.format("af_state:%-17s  lens_foc_dist:%.3f  lens_state:%-10s  %s",
            controlAFStateToString(result.get(CaptureResult.CONTROL_AF_STATE)),
            result.get(CaptureResult.LENS_FOCUS_DISTANCE),
            lensStateToString(result.get(CaptureResult.LENS_STATE)),
            (tag == null) ? "" : "[" + tag +"]"
    ));
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:15,代码来源:AutoFocusHelper.java

示例14: lensStateToString

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
/**
 * Utility function: converts CaptureResult.LENS_STATE to String.
 */
private static String lensStateToString(int lensState) {
    switch (lensState) {
        case CaptureResult.LENS_STATE_MOVING:
            return "moving";
        case CaptureResult.LENS_STATE_STATIONARY:
            return "stationary";
        default:
            return "unknown";
    }
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:14,代码来源:AutoFocusHelper.java

示例15: onCaptureProgressed

import android.hardware.camera2.CaptureResult; //导入依赖的package包/类
@Override
public void onCaptureProgressed(CameraCaptureSession session, CaptureRequest request,
        final CaptureResult partialResult) {
    long frameNumber = partialResult.getFrameNumber();

    // Update mMetadata for whichever keys are present, if this frame is
    // supplying newer values.
    for (final Key<?> key : partialResult.getKeys()) {
        Pair<Long, Object> oldEntry = mMetadata.get(key);
        final Object oldValue = (oldEntry != null) ? oldEntry.second : null;

        boolean newerValueAlreadyExists = oldEntry != null
                && frameNumber < oldEntry.first;
        if (newerValueAlreadyExists) {
            continue;
        }

        final Object newValue = partialResult.get(key);
        mMetadata.put(key, new Pair<Long, Object>(frameNumber, newValue));

        // If the value has changed, call the appropriate listeners, if
        // any exist.
        if (oldValue == newValue || !mMetadataChangeListeners.containsKey(key)) {
            continue;
        }

        for (final MetadataChangeListener listener :
                mMetadataChangeListeners.get(key)) {
            Log.v(TAG, "Dispatching to metadata change listener for key: "
                    + key.toString());
            mListenerHandler.post(new Runnable() {
                    @Override
                public void run() {
                    listener.onImageMetadataChange(key, oldValue, newValue,
                            partialResult);
                }
            });
        }
    }
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:41,代码来源:ImageCaptureManager.java


注:本文中的android.hardware.camera2.CaptureResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。