第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

能檢測(cè)出有多少?gòu)埬槪悄槻慨?huà)不出框框 源碼在下面,大家?guī)臀铱纯?,急急?/h1>

canva.drawLine(x - w / 2, y - h / 2, x - w / 2, y + h / 2, mPaint);
canva.drawLine(x - w / 2, y - h / 2, x + w / 2, y - h / 2, mPaint);
canva.drawLine(x + w / 2, y - h / 2, x + w / 2, y + h / 2, mPaint);
canva.drawLine(x - w / 2, y + h / 2, x + w / 2, y + h / 2, mPaint);

mPhotoImg = bitmap;

正在回答

4 回答

你要把mPaint的setColor()中的參數(shù)改成 0xffffffff(一共8個(gè)f),6個(gè)f的話并不是沒(méi)有框,而是因?yàn)槭峭该鞯乃钥床灰?jiàn)。另外setStrokeWidth(30)有些過(guò)大了,改小一點(diǎn)比較好。

0 回復(fù) 有任何疑惑可以回復(fù)我~

我跟你一樣畫(huà)不出矩形框,請(qǐng)問(wèn)你解決了嗎?

0 回復(fù) 有任何疑惑可以回復(fù)我~

這是mainActivity的代碼

0 回復(fù) 有任何疑惑可以回復(fù)我~

import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.facepp.error.FaceppParseException;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

? ?private static final int PICK_CODE = 0 * 110;
? ?private ImageView mPhoto;
? ?private Button mGetImage;
? ?private Button mDetect;
? ?private TextView mTip;
? ?private View mWaitting;
? ?private String mCurrentPhotoSrt;
? ?private Bitmap mPhotoImg;
? ?private Paint mPaint;

? ?protected void onCreate(Bundle savedInstanceState) {
? ? ? ?super.onCreate(savedInstanceState);
? ? ? ?setContentView(R.layout.activity_main);
? ? ? ?initViews();
? ? ? ?initEvents();
? ? ? ?mPaint = new Paint();

? ?}

? ?private void initEvents() {
? ? ? ?mGetImage.setOnClickListener(this);
? ? ? ?mDetect.setOnClickListener(this);
? ?}

? ?private void initViews() {
? ? ? ?mPhoto = (ImageView) findViewById(R.id.id_photo);
? ? ? ?mGetImage = (Button) findViewById(R.id.id_getImage);
? ? ? ?mDetect = (Button) findViewById(R.id.id_detect);
? ? ? ?mTip = (TextView) findViewById(R.id.id_tip);
? ? ? ?mWaitting = findViewById(R.id.id_waitting);
? ?}


? ?protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
? ? ? ?if (requestCode == PICK_CODE) {
? ? ? ? ? ?if (intent != null) {
? ? ? ? ? ? ? ?Uri uri = intent.getData();
? ? ? ? ? ? ? ?Cursor cursor = getContentResolver().query(uri, null, null, null, null);
? ? ? ? ? ? ? ?cursor.moveToFirst();
? ? ? ? ? ? ? ?int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
? ? ? ? ? ? ? ?mCurrentPhotoSrt = cursor.getString(idx);
? ? ? ? ? ? ? ?cursor.close();
? ? ? ? ? ? ? ?resizePhtot();
? ? ? ? ? ? ? ?mPhoto.setImageBitmap(mPhotoImg);
? ? ? ? ? ? ? ?mTip.setText("Click Detect ==>");
? ? ? ? ? ?}
? ? ? ?}
? ? ? ?super.onActivityResult(requestCode, resultCode, intent);
? ?}

? ?private void resizePhtot() {
? ? ? ?BitmapFactory.Options options = new BitmapFactory.Options();
? ? ? ?options.inJustDecodeBounds = true;
? ? ? ?BitmapFactory.decodeFile(mCurrentPhotoSrt, options);
? ? ? ?double ratio = Math.max(options.outWidth * 1.0d / 1024f, options.outHeight * 1.0d / 1024f);
? ? ? ?options.inSampleSize = (int) Math.ceil(ratio);
? ? ? ?options.inJustDecodeBounds = false;
? ? ? ?mPhotoImg = BitmapFactory.decodeFile(mCurrentPhotoSrt, options);

? ?}

? ?private static final int MSG_SUCESS = 0x111;
? ?private static final int MSG_ERROR = 0x112;
? ?private Handler mHandler = new Handler() {
? ? ? ?@Override

? ? ? ?public void handleMessage(Message msg) {
? ? ? ? ? ?switch (msg.what) {
? ? ? ? ? ? ? ?case MSG_SUCESS:

? ? ? ? ? ? ? ? ? ?mWaitting.setVisibility(View.GONE);
? ? ? ? ? ? ? ? ? ?JSONObject rs = (JSONObject) msg.obj;
? ? ? ? ? ? ? ? ? ?prepareRsBitmap(rs);
? ? ? ? ? ? ? ? ? ?mPhoto.setImageBitmap(mPhotoImg);
? ? ? ? ? ? ? ? ? ?break;
? ? ? ? ? ? ? ?case MSG_ERROR:
? ? ? ? ? ? ? ? ? ?mWaitting.setVisibility(View.GONE);
? ? ? ? ? ? ? ? ? ?String errorMsg = (String) msg.obj;
? ? ? ? ? ? ? ? ? ?if (TextUtils.isEmpty(errorMsg)) {

? ? ? ? ? ? ? ? ? ? ? ?mTip.setText("Error.");

? ? ? ? ? ? ? ? ? ?} else {
? ? ? ? ? ? ? ? ? ? ? ?mTip.setText(errorMsg);
? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ?break;
? ? ? ? ? ?}
? ? ? ? ? ?super.handleMessage(msg);
? ? ? ?}
? ?};

? ?private void prepareRsBitmap(JSONObject rs)

? ?{
? ? ? ?Bitmap bitmap = Bitmap.createBitmap(mPhotoImg.getWidth(), mPhotoImg.getHeight(), mPhotoImg.getConfig());
? ? ? ?Canvas canva = new Canvas(bitmap);
? ? ? ?canva.drawBitmap(mPhotoImg, 0, 0, null);

? ? ? ?try {
? ? ? ? ? ?JSONArray faces = rs.getJSONArray("face");
? ? ? ? ? ?int faceCount = faces.length();
? ? ? ? ? ?mTip.setText("find" + faceCount);
? ? ? ? ? ?for (int i = 0; i < faceCount; i++) {
? ? ? ? ? ? ? ?JSONObject face = faces.getJSONObject(i);
? ? ? ? ? ? ? ?JSONObject posObj = face.getJSONObject("position");
? ? ? ? ? ? ? ?float x = (float) posObj.getJSONObject("center").getDouble("x");
? ? ? ? ? ? ? ?float y = (float) posObj.getJSONObject("center").getDouble("y");
? ? ? ? ? ? ? ?float w = (float) posObj.getDouble("width");
? ? ? ? ? ? ? ?float h = (float) posObj.getDouble("height");
? ? ? ? ? ? ? ?x = x / 100 * bitmap.getWidth();
? ? ? ? ? ? ? ?y = y / 100 * bitmap.getHeight();
? ? ? ? ? ? ? ?w = w / 100 * bitmap.getWidth();
? ? ? ? ? ? ? ?h = h / 100 * bitmap.getHeight();
? ? ? ? ? ? ? ?mPaint.setColor(0xffffff);
? ? ? ? ? ? ? ?mPaint.setStrokeWidth(30);
? ? ? ? ? ? ? ?//畫(huà)BOX
? ? ? ? ? ? ? ?canva.drawLine(x - w / 2, y - h / 2, x - w / 2, y + h / 2, mPaint);
? ? ? ? ? ? ? ?canva.drawLine(x - w / 2, y - h / 2, x + w / 2, y - h / 2, mPaint);
? ? ? ? ? ? ? ?canva.drawLine(x + w / 2, y - h / 2, x + w / 2, y + h / 2, mPaint);
? ? ? ? ? ? ? ?canva.drawLine(x - w / 2, y + h / 2, x + w / 2, y + h / 2, mPaint);

? ? ? ? ? ? ? ?mPhotoImg = bitmap;


? ? ? ? ? ?}
? ? ? ?} catch (JSONException e) {
? ? ? ? ? ?e.printStackTrace();
? ? ? ?}

? ?}


? ?public void onClick(View view) {
? ? ? ?switch (view.getId()) {
? ? ? ? ? ?case R.id.id_getImage:
? ? ? ? ? ? ? ?Intent intent = new Intent(Intent.ACTION_PICK);
? ? ? ? ? ? ? ?intent.setType("image/*");
? ? ? ? ? ? ? ?startActivityForResult(intent, PICK_CODE);

? ? ? ? ? ? ? ?break;
? ? ? ? ? ?case R.id.id_detect:
? ? ? ? ? ? ? ?mWaitting.setVisibility(View.VISIBLE);
? ? ? ? ? ? ? ?FaceppDetect.detect(mPhotoImg, new FaceppDetect.CallBack() {
? ? ? ? ? ? ? ? ? ?@Override
? ? ? ? ? ? ? ? ? ?public void success(JSONObject result) {
? ? ? ? ? ? ? ? ? ? ? ?Message msg = Message.obtain();
? ? ? ? ? ? ? ? ? ? ? ?msg.what = MSG_SUCESS;
? ? ? ? ? ? ? ? ? ? ? ?msg.obj = result;
? ? ? ? ? ? ? ? ? ? ? ?mHandler.sendMessage(msg);


? ? ? ? ? ? ? ? ? ?}

? ? ? ? ? ? ? ? ? ?@Override
? ? ? ? ? ? ? ? ? ?public void error(FaceppParseException exception) {
? ? ? ? ? ? ? ? ? ? ? ?Message msg = Message.obtain();
? ? ? ? ? ? ? ? ? ? ? ?msg.what = MSG_SUCESS;
? ? ? ? ? ? ? ? ? ? ? ?msg.obj = exception.getErrorMessage();
? ? ? ? ? ? ? ? ? ? ? ?mHandler.sendMessage(msg);

? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ?});

? ? ? ? ? ? ? ?break;
? ? ? ?}
? ?}
}

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
How-old 刷臉神器
  • 參與學(xué)習(xí)       31536    人
  • 解答問(wèn)題       160    個(gè)

通過(guò)第三方本課程教大家實(shí)現(xiàn)人臉識(shí)別,通過(guò)案例講解原理

進(jìn)入課程

能檢測(cè)出有多少?gòu)埬?,但是臉部?huà)不出框框 源碼在下面,大家?guī)臀铱纯?,急急?/h1> 我要回答 關(guān)注問(wèn)題

微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)