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


Java VisionDetRet.getRight方法代码示例

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


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

示例1: testDetBitmapFace

import com.tzutalin.dlib.VisionDetRet; //导入方法依赖的package包/类
@Test
public void testDetBitmapFace() {
    FaceDet faceDet = new FaceDet(Constants.getFaceShapeModelPath());
    Bitmap bitmap = BitmapFactory.decodeFile("/sdcard/test.jpg");
    assertThat(bitmap, notNullValue());
    List<VisionDetRet> results = faceDet.detect(bitmap);
    for (final VisionDetRet ret : results) {
        String label = ret.getLabel();
        int rectLeft = ret.getLeft();
        int rectTop = ret.getTop();
        int rectRight = ret.getRight();
        int rectBottom = ret.getBottom();
        assertThat(label, is("face"));
        Assert.assertTrue(rectLeft > 0);
    }
    faceDet.release();
}
 
开发者ID:gicheonkang,项目名称:fast_face_android,代码行数:18,代码来源:FaceDetTest.java

示例2: testDetFace

import com.tzutalin.dlib.VisionDetRet; //导入方法依赖的package包/类
@Test
public void testDetFace() {
    Bitmap bitmap = BitmapFactory.decodeFile("/sdcard/test.jpg");
    assertThat(bitmap, notNullValue());
    FaceDet faceDet = new FaceDet(Constants.getFaceShapeModelPath());
    List<VisionDetRet> results = faceDet.detect("/sdcard/test.jpg");
    for (final VisionDetRet ret : results) {
        String label = ret.getLabel();
        int rectLeft = ret.getLeft();
        int rectTop = ret.getTop();
        int rectRight = ret.getRight();
        int rectBottom = ret.getBottom();
        assertThat(label, is("face"));
        Assert.assertTrue(rectLeft > 0);
    }
    faceDet.release();
}
 
开发者ID:gicheonkang,项目名称:fast_face_android,代码行数:18,代码来源:FaceDetTest.java

示例3: testDetBitmapFaceLandmarkDect

import com.tzutalin.dlib.VisionDetRet; //导入方法依赖的package包/类
@Test
public void testDetBitmapFaceLandmarkDect() {
    Bitmap bitmap = BitmapFactory.decodeFile("/sdcard/test.jpg");
    assertThat(bitmap, notNullValue());
    FaceDet faceDet = new FaceDet(Constants.getFaceShapeModelPath());
    List<VisionDetRet> results = faceDet.detect(bitmap);
    for (final VisionDetRet ret : results) {
        String label = ret.getLabel();
        int rectLeft = ret.getLeft();
        int rectTop = ret.getTop();
        int rectRight = ret.getRight();
        int rectBottom = ret.getBottom();
        ArrayList<Point> landmarks = ret.getFaceLandmarks();
        assertThat(label, is("face"));
        Assert.assertTrue(landmarks.size() > 0);
        Assert.assertTrue(rectLeft > 0);
    }
    faceDet.release();
}
 
开发者ID:gicheonkang,项目名称:fast_face_android,代码行数:20,代码来源:FaceDetTest.java

示例4: testDetFaceLandmark

import com.tzutalin.dlib.VisionDetRet; //导入方法依赖的package包/类
@Test
public void testDetFaceLandmark() {
    FaceDet faceDet = new FaceDet(Constants.getFaceShapeModelPath());
    List<VisionDetRet> results = faceDet.detect("/sdcard/test.jpg");
    for (final VisionDetRet ret : results) {
        String label = ret.getLabel();
        int rectLeft = ret.getLeft();
        int rectTop = ret.getTop();
        int rectRight = ret.getRight();
        int rectBottom = ret.getBottom();
        ArrayList<Point> landmarks = ret.getFaceLandmarks();
        assertThat(label, is("face"));
        Assert.assertTrue(landmarks.size() > 0);
        Assert.assertTrue(rectLeft > 0);
    }
    faceDet.release();
}
 
开发者ID:gicheonkang,项目名称:fast_face_android,代码行数:18,代码来源:FaceDetTest.java

示例5: testFacialLandmark

import com.tzutalin.dlib.VisionDetRet; //导入方法依赖的package包/类
@Test
public void testFacialLandmark() {
    PedestrianDet peopleDet = new PedestrianDet();
    List<VisionDetRet> results = peopleDet.detect("/sdcard/test.bmp");
    for (final VisionDetRet ret : results) {
        String label = ret.getLabel();
        int rectLeft = ret.getLeft();
        int rectTop= ret.getTop();
        int rectRight = ret.getRight();
        int rectBottom = ret.getBottom();
    }
}
 
开发者ID:gicheonkang,项目名称:fast_face_android,代码行数:13,代码来源:DLibFunctionsTest.java

示例6: drawRect

import com.tzutalin.dlib.VisionDetRet; //导入方法依赖的package包/类
@DebugLog
protected BitmapDrawable drawRect(String path, List<VisionDetRet> results, int color) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inSampleSize = 1;
    Bitmap bm = BitmapFactory.decodeFile(path, options);
    android.graphics.Bitmap.Config bitmapConfig = bm.getConfig();
    // set default bitmap config if none
    if (bitmapConfig == null) {
        bitmapConfig = android.graphics.Bitmap.Config.ARGB_8888;
    }
    // resource bitmaps are imutable,
    // so we need to convert it to mutable one
    bm = bm.copy(bitmapConfig, true);
    int width = bm.getWidth();
    int height = bm.getHeight();
    // By ratio scale
    float aspectRatio = bm.getWidth() / (float) bm.getHeight();

    final int MAX_SIZE = 512;
    int newWidth = MAX_SIZE;
    int newHeight = MAX_SIZE;
    float resizeRatio = 1;
    newHeight = Math.round(newWidth / aspectRatio);
    if (bm.getWidth() > MAX_SIZE && bm.getHeight() > MAX_SIZE) {
        Timber.tag(TAG).d("Resize Bitmap");
        bm = getResizedBitmap(bm, newWidth, newHeight);
        resizeRatio = (float) bm.getWidth() / (float) width;
        Timber.tag(TAG).d("resizeRatio " + resizeRatio);
    }

    // Create canvas to draw
    Canvas canvas = new Canvas(bm);
    Paint paint = new Paint();
    paint.setColor(color);
    paint.setStrokeWidth(2);
    paint.setStyle(Paint.Style.STROKE);
    // Loop result list
    for (VisionDetRet ret : results) {
        Rect bounds = new Rect();
        bounds.left = (int) (ret.getLeft() * resizeRatio);
        bounds.top = (int) (ret.getTop() * resizeRatio);
        bounds.right = (int) (ret.getRight() * resizeRatio);
        bounds.bottom = (int) (ret.getBottom() * resizeRatio);
        canvas.drawRect(bounds, paint);
        // Get landmark
        ArrayList<Point> landmarks = ret.getFaceLandmarks();
        for (Point point : landmarks) {
            int pointX = (int) (point.x * resizeRatio);
            int pointY = (int) (point.y * resizeRatio);
            canvas.drawCircle(pointX, pointY, 2, paint);
        }
    }

    return new BitmapDrawable(getResources(), bm);
}
 
开发者ID:gicheonkang,项目名称:fast_face_android,代码行数:56,代码来源:MainActivity.java


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