【发布时间】:2022-01-11 07:36:49
【问题描述】:
当条件为真时,我的计数器值不断增加,而不是只有一个值。如果角度大于 90 度,它会像 1、2、3、4、5 而不是 1 比 2 比 3 不断增加 肩=新浮动[] {landmarks.getLandmark(12).getX(),landmarks.getLandmark(12).getY()}; 肘=新浮动[] {landmarks.getLandmark(24).getX(),landmarks.getLandmark(24).getY()}; 手腕=新浮动[] {landmarks.getLandmark(15).getX(),landmarks.getLandmark(15).getY()}; 双角 = 计算角度(肩、肘、腕); System.out.println(角度);
runOnUiThread(new Runnable() {
@Override
public void run() {
String stage="down";
// Stuff that updates the UI
if (angle > 90) {
stage = "down";
tv.setText(stage);
}
if (angle <=90 ){
stage = "up";
tv.setText(stage);
doSomething();
System.out.println("This is"+counter);
}
}
});
// Note: If eye_presence is false, these landmarks are useless.
Log.v(
TAG,
"[TS:"
+ packet.getTimestamp()
+ "] #Landmarks for iris: "
+ landmarks.getLandmarkCount());
Log.v(TAG, getLandmarksDebugString(landmarks));
} catch (InvalidProtocolBufferException e) {
Log.e(TAG, "Couldn't Exception received - " + e);
return;
}
});
// }
}
public int doSomething(){
counter = counter +1;
tv2.setText(String.valueOf(counter));
System.out.println("This is bingo"+counter);
return (counter);
}
【问题讨论】: