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


Java Size.getHeight方法代码示例

本文整理汇总了Java中android.util.Size.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Size.getHeight方法的具体用法?Java Size.getHeight怎么用?Java Size.getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.util.Size的用法示例。


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

示例1: collectRatioSizes

import android.util.Size; //导入方法依赖的package包/类
@Override
public void collectRatioSizes() {
    ratioSizeList.clear();
    CameraCharacteristics characteristics;
    StreamConfigurationMap map = null;
    try {
        characteristics = ((CameraManager) getContext().getSystemService(Context.CAMERA_SERVICE)).getCameraCharacteristics(Integer.toString(Integer.parseInt(getCameraId())));
        map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }

    Size[] outputSizes = map.getOutputSizes(SurfaceTexture.class);
    if (outputSizes != null) {
        List<Double> ratioList = new ArrayList<>();
        for (Size size : outputSizes) {
            double ratio = (double) size.getWidth() / (double) size.getHeight();
            if (!ratioList.contains(ratio)) {
                ratioList.add(ratio);
                ratioSizeList.add(new AspectRatio(ratio, size.getWidth(), size.getHeight()));
            }
        }
    }
}
 
开发者ID:team-supercharge,项目名称:SCCameraView,代码行数:25,代码来源:Camera2View.java

示例2: chooseOptimalSize

import android.util.Size; //导入方法依赖的package包/类
/**
 * Given {@code choices} of {@code Size}s supported by a camera, chooses the smallest one whose
 * width and height are at least as large as the respective requested values, and whose aspect
 * ratio matches with the specified value.
 *
 * @param choices     The list of sizes that the camera supports for the intended output class
 * @param width       The minimum desired width
 * @param height      The minimum desired height
 * @param aspectRatio The aspect ratio
 * @return The optimal {@code Size}, or an arbitrary one if none were big enough
 */
@SuppressLint("LongLogTag")
@DebugLog
private static Size chooseOptimalSize(
        final Size[] choices, final int width, final int height, final Size aspectRatio) {
    // Collect the supported resolutions that are at least as big as the preview Surface
    final List<Size> bigEnough = new ArrayList<Size>();
    for (final Size option : choices) {
        if (option.getHeight() >= MINIMUM_PREVIEW_SIZE && option.getWidth() >= MINIMUM_PREVIEW_SIZE) {
            Log.i(TAG, "Adding size: " + option.getWidth() + "x" + option.getHeight());
            bigEnough.add(option);
        } else {
            Log.i(TAG, "Not adding size: " + option.getWidth() + "x" + option.getHeight());
        }
    }

    // Pick the smallest of those, assuming we found any
    if (bigEnough.size() > 0) {
        final Size chosenSize = Collections.min(bigEnough, new CompareSizesByArea());
        Log.i(TAG, "Chosen size: " + chosenSize.getWidth() + "x" + chosenSize.getHeight());
        return chosenSize;
    } else {
        Log.e(TAG, "Couldn't find any suitable preview size");
        return choices[0];
    }
}
 
开发者ID:SimonCherryGZ,项目名称:face-landmark-android,代码行数:37,代码来源:CameraConnectionFragment.java

示例3: chooseOptimalSize

import android.util.Size; //导入方法依赖的package包/类
@SuppressLint("LongLogTag")
@DebugLog
private static Size chooseOptimalSize(
        final Size[] choices, final int width, final int height, final Size aspectRatio) {
    // Collect the supported resolutions that are at least as big as the preview Surface
    final List<Size> bigEnough = new ArrayList<Size>();
    for (final Size option : choices) {
        if (option.getHeight() >= MINIMUM_PREVIEW_SIZE && option.getWidth() >= MINIMUM_PREVIEW_SIZE) {
            Log.i(TAG, "Adding size: " + option.getWidth() + "x" + option.getHeight());
            bigEnough.add(option);
        } else {
            Log.i(TAG, "Not adding size: " + option.getWidth() + "x" + option.getHeight());
        }
    }

    // Pick the smallest of those, assuming we found any
    if (bigEnough.size() > 0) {
        final Size chosenSize = Collections.min(bigEnough, new ARMaskFragment.CompareSizesByArea());
        Log.i(TAG, "Chosen size: " + chosenSize.getWidth() + "x" + chosenSize.getHeight());
        return chosenSize;
    } else {
        Log.e(TAG, "Couldn't find any suitable preview size");
        return choices[0];
    }
}
 
开发者ID:SimonCherryGZ,项目名称:face-landmark-android,代码行数:26,代码来源:ARMaskFragment.java

示例4: getPreferredPreviewSize

import android.util.Size; //导入方法依赖的package包/类
public static Size getPreferredPreviewSize(Size[] sizes, int width, int height) {
    List<Size> collectorSizes = new ArrayList<>();
    for (Size option : sizes) {
        //找到长宽都大于指定宽高的size,把这些size放在List中
        if (width > height) {
            if (option.getWidth() > width && option.getHeight() > height) {
                collectorSizes.add(option);
            }
        } else {
            if (option.getHeight() > width && option.getWidth() > height) {
                collectorSizes.add(option);
            }
        }
    }
    if (collectorSizes.size() > 0) {
        return Collections.min(collectorSizes, new Comparator<Size>() {
            @Override
            public int compare(Size s1, Size s2) {
                return Long.signum(s1.getWidth() * s1.getHeight() - s2.getWidth() * s2.getHeight());
            }
        });
    }
    return sizes[0];
}
 
开发者ID:lazyparser,项目名称:xbot_head,代码行数:25,代码来源:Util.java

示例5: onPreviewSizeChosen

import android.util.Size; //导入方法依赖的package包/类
public void onPreviewSizeChosen(final Size size, final int rotation) {

    previewWidth = size.getWidth();
    previewHeight = size.getHeight();

    final Display display = getWindowManager().getDefaultDisplay();
    final int screenOrientation = display.getRotation();

    LOGGER.i("Sensor orientation: %d, Screen orientation: %d", rotation, screenOrientation);

    sensorOrientation = rotation + screenOrientation;

    LOGGER.i("Initializing at size %dx%d", previewWidth, previewHeight);
    rgbBytes = new int[previewWidth * previewHeight];
    rgbFrameBitmap = Bitmap.createBitmap(previewWidth, previewHeight, Bitmap.Config.ARGB_8888);
    croppedBitmap = Bitmap.createBitmap(INPUT_SIZE, INPUT_SIZE, Bitmap.Config.ARGB_8888);

    frameToCropTransform =
        ImageUtils.getTransformationMatrix(previewWidth, previewHeight, INPUT_SIZE, INPUT_SIZE,
            sensorOrientation, MAINTAIN_ASPECT);

    Matrix cropToFrameTransform = new Matrix();
    frameToCropTransform.invert(cropToFrameTransform);

    yuvBytes = new byte[3][];
  }
 
开发者ID:flipper83,项目名称:SortingHatAndroid,代码行数:27,代码来源:CameraActivity.java

示例6: chooseOptimalSize

import android.util.Size; //导入方法依赖的package包/类
/**
 * Given {@code choices} of {@code Size}s supported by a camera, choose the smallest one that
 * is at least as large as the respective texture view size, and that is at most as large as the
 * respective max size, and whose aspect ratio matches with the specified value. If such size
 * doesn't exist, choose the largest one that is at most as large as the respective max size,
 * and whose aspect ratio matches with the specified value.
 *
 * @param choices           The list of sizes that the camera supports for the intended output
 *                          class
 * @param textureViewWidth  The width of the texture view relative to sensor coordinate
 * @param textureViewHeight The height of the texture view relative to sensor coordinate
 * @param maxWidth          The maximum width that can be chosen
 * @param maxHeight         The maximum height that can be chosen
 * @param aspectRatio       The aspect ratio
 * @return The optimal {@code Size}, or an arbitrary one if none were big enough
 */
private static Size chooseOptimalSize(Size[] choices, int textureViewWidth,
                                      int textureViewHeight, int maxWidth, int maxHeight, Size aspectRatio) {
    // Collect the supported resolutions that are at least as big as the preview Surface
    List<Size> bigEnough = new ArrayList<>();
    // Collect the supported resolutions that are smaller than the preview Surface
    List<Size> notBigEnough = new ArrayList<>();
    int w = aspectRatio.getWidth();
    int h = aspectRatio.getHeight();
    for (Size option : choices) {
        if (option.getWidth() <= maxWidth && option.getHeight() <= maxHeight &&
                option.getHeight() == option.getWidth() * h / w) {
            if (option.getWidth() >= textureViewWidth &&
                    option.getHeight() >= textureViewHeight) {
                bigEnough.add(option);
            } else {
                notBigEnough.add(option);
            }
        }
    }

    // Pick the smallest of those big enough. If there is no one big enough, pick the
    // largest of those not big enough.
    if (bigEnough.size() > 0) {
        return Collections.min(bigEnough, new CompareSizesByArea());
    } else if (notBigEnough.size() > 0) {
        return Collections.max(notBigEnough, new CompareSizesByArea());
    } else {
        Log.e(TAG, "Couldn't find any suitable preview size");
        return choices[0];
    }
}
 
开发者ID:gengqifu,项目名称:361Camera,代码行数:48,代码来源:Camera2Fragment.java

示例7: chooseOptimalSize

import android.util.Size; //导入方法依赖的package包/类
/**
 * Given {@code choices} of {@code Size}s supported by a camera, chooses the smallest one whose
 * width and height are at least as large as the respective requested values, and whose aspect
 * ratio matches with the specified value.
 *
 * @param choices     The list of sizes that the camera supports for the intended output class
 * @param width       The minimum desired width
 * @param height      The minimum desired height
 * @param aspectRatio The aspect ratio
 * @return The optimal {@code Size}, or an arbitrary one if none were big enough
 */
private static Size chooseOptimalSize(
    final Size[] choices, final int width, final int height, final Size aspectRatio) {
  final int minWidth = Math.max(width, MINIMUM_PREVIEW_SIZE);
  final int minHeight = Math.max(height, MINIMUM_PREVIEW_SIZE);

  // Collect the supported resolutions that are at least as big as the preview Surface
  final List<Size> bigEnough = new ArrayList<Size>();
  final List<Size> tooSmall = new ArrayList<Size>();
  for (final Size option : choices) {
    if (option.getHeight() >= minHeight && option.getWidth() >= minWidth) {
      bigEnough.add(option);
    } else {
      tooSmall.add(option);
    }
  }
  LOGGER.i("Valid preview sizes: [" + TextUtils.join(", ", bigEnough) + "]");
  LOGGER.i("Rejected preview sizes: [" + TextUtils.join(", ", tooSmall) + "]");

  // Pick the smallest of those, assuming we found any
  if (bigEnough.size() > 0) {
    final Size chosenSize = Collections.min(bigEnough, new CompareSizesByArea());
    LOGGER.i("Chosen size: " + chosenSize.getWidth() + "x" + chosenSize.getHeight());
    return chosenSize;
  } else {
    LOGGER.e("Couldn't find any suitable preview size");
    return choices[0];
  }
}
 
开发者ID:jxtz518,项目名称:Tensorflow_Andriod_With_Audio_Output,代码行数:40,代码来源:CameraConnectionFragment.java

示例8: chooseVideoSize

import android.util.Size; //导入方法依赖的package包/类
/**
 * In this sample, we choose a video size with 3x4 aspect ratio. Also, we don't use sizes
 * larger than 1080p, since MediaRecorder cannot handle such a high-resolution video.
 *
 * @param choices The list of available sizes
 * @return The video size
 */
private static Size chooseVideoSize(Size[] choices) {
    for (Size size : choices) {
        if (size.getWidth() == size.getHeight() * 4 / 3 && size.getWidth() <= 1080) {
            return size;
        }
    }
    Log.e(TAG, "Couldn't find any suitable video size");
    return choices[choices.length - 1];
}
 
开发者ID:mywitness,项目名称:Camara2-Video-Demo-fixed,代码行数:17,代码来源:Camera2VideoFragment.java

示例9: chooseOptimalSize

import android.util.Size; //导入方法依赖的package包/类
/**
 * Given {@code choices} of {@code Size}s supported by a camera, choose the smallest one that
 * is at least as large as the respective texture view size, and that is at most as large as the
 * respective max size, and whose aspect ratio matches with the specified value. If such size
 * doesn't exist, choose the largest one that is at most as large as the respective max size,
 * and whose aspect ratio matches with the specified value.
 *
 * @param choices           The list of sizes that the camera supports for the intended output
 *                          class
 * @param textureViewWidth  The width of the texture view relative to sensor coordinate
 * @param textureViewHeight The height of the texture view relative to sensor coordinate
 * @param maxWidth          The maximum width that can be chosen
 * @param maxHeight         The maximum height that can be chosen
 * @param aspectRatio       The aspect ratio
 * @return The optimal {@code Size}, or an arbitrary one if none were big enough
 */
public static Size chooseOptimalSize(Size[] choices, int textureViewWidth,
                                      int textureViewHeight, int maxWidth, int maxHeight, Size aspectRatio) {
    // Collect the supported resolutions that are at least as big as the preview Surface
    List<Size> bigEnough = new ArrayList<>();
    // Collect the supported resolutions that are smaller than the preview Surface
    List<Size> notBigEnough = new ArrayList<>();
    int w = aspectRatio.getWidth();
    int h = aspectRatio.getHeight();
    for (Size option : choices) {
        if (option.getWidth() <= maxWidth && option.getHeight() <= maxHeight &&
                option.getHeight() == option.getWidth() * h / w) {
            if (option.getWidth() >= textureViewWidth &&
                    option.getHeight() >= textureViewHeight) {
                bigEnough.add(option);
            } else {
                notBigEnough.add(option);
            }
        }
    }

    // Pick the smallest of those big enough. If there is no one big enough, pick the
    // largest of those not big enough.
    if (bigEnough.size() > 0) {
        return Collections.min(bigEnough, new CompareSizesByArea());
    } else if (notBigEnough.size() > 0) {
        return Collections.max(notBigEnough, new CompareSizesByArea());
    } else {
        Log.e(TAG, "Couldn't find any suitable preview size");
        return choices[0];
    }
}
 
开发者ID:OkayCamera,项目名称:OkayCamera-Android,代码行数:48,代码来源:Utils.java

示例10: chooseOptimalSize

import android.util.Size; //导入方法依赖的package包/类
/**
 * Given {@code choices} of {@code Size}s supported by a camera, choose the smallest one that
 * is at least as large as the respective texture view size, and that is at most as large as the
 * respective max size, and whose aspect ratio matches with the specified value. If such size
 * doesn't exist, choose the largest one that is at most as large as the respective max size,
 * and whose aspect ratio matches with the specified value.
 *
 * @param choices           The list of sizes that the camera supports for the intended output
 *                          class
 * @param textureViewWidth  The width of the texture view relative to sensor coordinate
 * @param textureViewHeight The height of the texture view relative to sensor coordinate
 * @param maxWidth          The maximum width that can be chosen
 * @param maxHeight         The maximum height that can be chosen
 * @param aspectRatio       The aspect ratio
 * @return The optimal {@code Size}, or an arbitrary one if none were big enough
 */
private static Size chooseOptimalSize(Size[] choices, int textureViewWidth,
        int textureViewHeight, int maxWidth, int maxHeight, Size aspectRatio) {

    // Collect the supported resolutions that are at least as big as the preview Surface
    List<Size> bigEnough = new ArrayList<>();
    // Collect the supported resolutions that are smaller than the preview Surface
    List<Size> notBigEnough = new ArrayList<>();
    int w = aspectRatio.getWidth();
    int h = aspectRatio.getHeight();
    for (Size option : choices) {
        if (option.getWidth() <= maxWidth && option.getHeight() <= maxHeight &&
                option.getHeight() == option.getWidth() * h / w) {
            if (option.getWidth() >= textureViewWidth &&
                option.getHeight() >= textureViewHeight) {
                bigEnough.add(option);
            } else {
                notBigEnough.add(option);
            }
        }
    }

    // Pick the smallest of those big enough. If there is no one big enough, pick the
    // largest of those not big enough.
    if (bigEnough.size() > 0) {
        return Collections.min(bigEnough, new CompareSizesByArea());
    } else if (notBigEnough.size() > 0) {
        return Collections.max(notBigEnough, new CompareSizesByArea());
    } else {
        Log.e(TAG, "Couldn't find any suitable preview size");
        return choices[0];
    }
}
 
开发者ID:TongLi1992,项目名称:Camera_Calibration_Android,代码行数:49,代码来源:Camera2BasicFragment.java

示例11: chooseOptimalSize

import android.util.Size; //导入方法依赖的package包/类
/**
 * Given {@code choices} of {@code Size}s supported by a camera, choose the smallest one that
 * is at least as large as the respective texture view size, and that is at most as large as the
 * respective max size, and whose aspect ratio matches with the specified value. If such size
 * doesn't exist, choose the largest one that is at most as large as the respective max size,
 * and whose aspect ratio matches with the specified value.
 *
 * @param choices           The list of sizes that the camera supports for the intended output
 *                          class
 * @param textureViewWidth  The width of the texture view relative to sensor coordinate
 * @param textureViewHeight The height of the texture view relative to sensor coordinate
 * @param maxWidth          The maximum width that can be chosen
 * @param maxHeight         The maximum height that can be chosen
 * @param aspectRatio       The aspect ratio
 * @return The optimal {@code Size}, or an arbitrary one if none were big enough
 */
public static Size chooseOptimalSize(Size[] choices, int textureViewWidth,
                                      int textureViewHeight, int maxWidth, int maxHeight, Size aspectRatio) {

    // Collect the supported resolutions that are at least as big as the preview Surface
    List<Size> bigEnough = new ArrayList<>();
    // Collect the supported resolutions that are smaller than the preview Surface
    List<Size> notBigEnough = new ArrayList<>();
    int w = aspectRatio.getWidth();
    int h = aspectRatio.getHeight();
    for (Size option : choices) {
        if (option.getWidth() <= maxWidth && option.getHeight() <= maxHeight &&
                option.getHeight() == option.getWidth() * h / w) {
            if (option.getWidth() >= textureViewWidth &&
                    option.getHeight() >= textureViewHeight) {
                bigEnough.add(option);
            } else {
                notBigEnough.add(option);
            }
        }
    }

    // Pick the smallest of those big enough. If there is no one big enough, pick the
    // largest of those not big enough.
    if (bigEnough.size() > 0) {
        return Collections.min(bigEnough, new CompareSizesByArea());
    } else if (notBigEnough.size() > 0) {
        return Collections.max(notBigEnough, new CompareSizesByArea());
    } else {
        Log.e(TAG, "Couldn't find any suitable preview size");
        return choices[0];
    }
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:49,代码来源:CameraFragmentUtil.java

示例12: chooseOptimalSize

import android.util.Size; //导入方法依赖的package包/类
/**
 * Given {@code choices} of {@code Size}s supported by a camera, choose the smallest one that
 * is at least as large as the respective texture view size, and that is at most as large as the
 * respective max size, and whose aspect ratio matches with the specified value. If such size
 * doesn't exist, choose the largest one that is at most as large as the respective max size,
 * and whose aspect ratio matches with the specified value.
 *
 * @param choices           The list of sizes that the camera supports for the intended output
 *                          class
 * @param textureViewWidth  The width of the texture view relative to sensor coordinate
 * @param textureViewHeight The height of the texture view relative to sensor coordinate
 * @param maxWidth          The maximum width that can be chosen
 * @param maxHeight         The maximum height that can be chosen
 * @param aspectRatio       The aspect ratio
 * @return The optimal {@code Size}, or an arbitrary one if none were big enough
 */
private static Size chooseOptimalSize(Size[] choices, int textureViewWidth,
                                      int textureViewHeight, int maxWidth, int maxHeight, Size aspectRatio) {

    // Collect the supported resolutions that are at least as big as the preview Surface
    List<Size> bigEnough = new ArrayList<>();
    // Collect the supported resolutions that are smaller than the preview Surface
    List<Size> notBigEnough = new ArrayList<>();
    int w = aspectRatio.getWidth();
    int h = aspectRatio.getHeight();
    for (Size option : choices) {
        if (option.getWidth() <= maxWidth && option.getHeight() <= maxHeight &&
                option.getHeight() == option.getWidth() * h / w) {
            if (option.getWidth() >= textureViewWidth &&
                    option.getHeight() >= textureViewHeight) {
                bigEnough.add(option);
            } else {
                notBigEnough.add(option);
            }
        }
    }

    // Pick the smallest of those big enough. If there is no one big enough, pick the
    // largest of those not big enough.
    if (bigEnough.size() > 0) {
        return Collections.min(bigEnough, new CompareSizesByArea());
    } else if (notBigEnough.size() > 0) {
        return Collections.max(notBigEnough, new CompareSizesByArea());
    } else {
        MaoLog.getLogger("chooseOptimalSize").e("Couldn't find any suitable preview size");
        return choices[0];
    }
}
 
开发者ID:vipycm,项目名称:mao-android,代码行数:49,代码来源:Camera2Fragment.java

示例13: chooseOptimalSize

import android.util.Size; //导入方法依赖的package包/类
/**
 * Given {@code choices} of {@code Size}s supported by a camera, chooses the smallest one whose
 * width and height are at least as large as the respective requested values, and whose aspect
 * ratio matches with the specified value.
 *
 * @param choices The list of sizes that the camera supports for the intended output class
 * @param width The minimum desired width
 * @param height The minimum desired height
 * @param aspectRatio The aspect ratio
 * @return The optimal {@code Size}, or an arbitrary one if none were big enough
 */
private static Size chooseOptimalSize(final Size[] choices, final int width, final int height,
    final Size aspectRatio) {
  final int minWidth = Math.max(width, MINIMUM_PREVIEW_SIZE);
  final int minHeight = Math.max(height, MINIMUM_PREVIEW_SIZE);

  // Collect the supported resolutions that are at least as big as the preview Surface
  final List<Size> bigEnough = new ArrayList<Size>();
  final List<Size> tooSmall = new ArrayList<Size>();
  for (final Size option : choices) {
    if (option.getHeight() >= minHeight && option.getWidth() >= minWidth) {
      bigEnough.add(option);
    } else {
      tooSmall.add(option);
    }
  }
  LOGGER.i("Valid preview sizes: [" + TextUtils.join(", ", bigEnough) + "]");
  LOGGER.i("Rejected preview sizes: [" + TextUtils.join(", ", tooSmall) + "]");

  // Pick the smallest of those, assuming we found any
  if (bigEnough.size() > 0) {
    final Size chosenSize = Collections.min(bigEnough, new CompareSizesByArea());
    LOGGER.i("Chosen size: " + chosenSize.getWidth() + "x" + chosenSize.getHeight());
    return chosenSize;
  } else {
    LOGGER.e("Couldn't find any suitable preview size");
    return choices[0];
  }
}
 
开发者ID:flipper83,项目名称:SortingHatAndroid,代码行数:40,代码来源:CameraConnectionFragment.java

示例14: createNewRendererForCurrentType

import android.util.Size; //导入方法依赖的package包/类
@Override
public RsSurfaceRenderer createNewRendererForCurrentType(Size outputSize) {
    if (cameraPreviewRenderer == null) {
        cameraPreviewRenderer =
                new RsCameraPreviewRenderer(rs, outputSize.getWidth(), outputSize.getHeight());
        cameraPreviewRenderer.setDroppedFrameLogger(frameStats);
    }
    updateRsRenderer();
    return cameraPreviewRenderer;
}
 
开发者ID:lydia-schiff,项目名称:hella-renderscript,代码行数:11,代码来源:RsViewfinderActivity.java

示例15: onPreviewSizeChosen

import android.util.Size; //导入方法依赖的package包/类
public void onPreviewSizeChosen(final Size size) {
    final float textSizePx =
            TypedValue.applyDimension(
                    TypedValue.COMPLEX_UNIT_DIP, TEXT_SIZE_DIP, getResources().getDisplayMetrics());
    borderedText = new BorderedText(textSizePx);
    borderedText.setTypeface(Typeface.MONOSPACE);

    previewWidth = size.getWidth();
    previewHeight = size.getHeight();

    Log.i(TAG, String.format("Initializing cameraPreview at size %dx%d", previewWidth, previewHeight));
    rgbBytes = new int[previewWidth * previewHeight];
    rgbFrameBitmap = Bitmap.createBitmap(previewWidth, previewHeight, Bitmap.Config.ARGB_8888);
    croppedBitmap = Bitmap.createBitmap(mImageClassifier.getImageWidth(), mImageClassifier.getImageHeight(), Bitmap.Config.ARGB_8888);

    frameToCropTransform =
            ImageUtils.getTransformationMatrix(
                    previewWidth, previewHeight,
                    mImageClassifier.getImageWidth(), mImageClassifier.getImageHeight(),
                    90, true);

    cropToFrameTransform = new Matrix();
    frameToCropTransform.invert(cropToFrameTransform);

    yuvBytes = new byte[3][];

    addCallback(
            new OverlayView.DrawCallback() {
                @Override
                public void drawCallback(final Canvas canvas) {
                    renderDebug(canvas);
                }
            });
}
 
开发者ID:hpi-xnor,项目名称:android-image-classification,代码行数:35,代码来源:MainActivity.java


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