[Bug Fix] fix AllocateFaceDetectionResultFromJava error (#628)

* [Bug Fix] fix android app detail page errors

* [Android] fix realtime camera mode and shutter

* [Bug Fix] fix AllocateSegmentationResultFromJava error
This commit is contained in:
DefTruth
2022-11-18 11:12:16 +08:00
committed by GitHub
parent 8dd3e64227
commit 1609ce1bab
3 changed files with 6 additions and 18 deletions

View File

@@ -15,14 +15,14 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".detection.DetectionMainActivity"> <activity android:name=".facedet.FaceDetMainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".detection.DetectionSettingsActivity" android:name=".facedet.FaceDetSettingsActivity"
android:label="Settings"> android:label="Settings">
</activity> </activity>
</application> </application>

View File

@@ -352,30 +352,16 @@ public class SegmentationMainActivity extends Activity implements View.OnClickLi
@Override @Override
public void onStartTrackingTouch(SeekBar seekBar) { public void onStartTrackingTouch(SeekBar seekBar) {
} }
@Override @Override
public void onStopTrackingTouch(SeekBar seekBar) { public void onStopTrackingTouch(SeekBar seekBar) {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// if (TYPE == ALBUM_SELECT) {
// SystemClock.sleep(TIME_SLEEP_INTERVAL * 10); // 500ms
// detail(picBitmap);
// } else {
// SystemClock.sleep(TIME_SLEEP_INTERVAL * 10); // 500ms
// svPreview.onPause();
// detail(shutterBitmap);
// }
// }
// });
} }
}); });
} }
private void detail(Bitmap bitmap) { private void detail(Bitmap bitmap) {
predictor.predict(bitmap, true, 0.6f); predictor.predict(bitmap, true, 0.4f);
resultImage.setImageBitmap(bitmap); resultImage.setImageBitmap(bitmap);
resultNum = 1.0f; resultNum = 1.0f;
} }

View File

@@ -982,7 +982,9 @@ bool AllocateFaceDetectionResultFromJava(
if (j_landmarks_per_face > 0) { if (j_landmarks_per_face > 0) {
jobjectArray j_face_det_landmarks_float_arr = reinterpret_cast<jobjectArray>( jobjectArray j_face_det_landmarks_float_arr = reinterpret_cast<jobjectArray>(
env->GetObjectField(j_face_det_result_obj, j_face_det_landmarks_id_cc)); env->GetObjectField(j_face_det_result_obj, j_face_det_landmarks_id_cc));
for (int i = 0; i < len; ++i) { const int landmarks_len = env->GetArrayLength(j_face_det_landmarks_float_arr);
for (int i = 0; i < landmarks_len; ++i) {
auto j_landmark = reinterpret_cast<jfloatArray>( auto j_landmark = reinterpret_cast<jfloatArray>(
env->GetObjectArrayElement(j_face_det_landmarks_float_arr, i)); env->GetObjectArrayElement(j_face_det_landmarks_float_arr, i));
if (env->GetArrayLength(j_landmark) == 2) { if (env->GetArrayLength(j_landmark) == 2) {