我正在实现一个基于检测面部的项目,我想使用 Firebase Ml Kit 来检测面部。但是当我选择一张图像并搜索相机和图库图像并获得相同的图像对象结果时。我的问题是如何在 android 中获取对象的两个图像(可能不同,也可能相同)相同或不同。这是单个图像ML的java代码,我不知道如何将另一个图像ML与第一个图像ML进行比较,请你们有任何逻辑然后分享。
public class MainActivity extends AppCompatActivity {
TextView mText;
Button mButton;
ImageView mImageView;
ProgressBar mBar;
private GraphicOverlay mGraphicOverlay;
private static final String TAG = "FaceTracker";
private CameraSource mCameraSource = null;
private CameraSourcePreview mPreview;
private static final int RC_HANDLE_GMS = 9001;
// permission request codes need to be < 256
private static final int RC_HANDLE_CAMERA_PERM = 2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
PermissionCheck();
}
private void PermissionCheck() {
// Here, thisActivity is …Run Code Online (Sandbox Code Playgroud) android artificial-intelligence face-detection firebase-mlkit
I have just created a demo project for learning and the MVVM and how to use the Mvvm in our project. but I have found an error while running the project
error: cannot find symbol class ViewModel
error: package ViewModel does not exist
error: package ViewModel does not exist
error: package ViewModel does not exist
and here is my code
public class User extends BaseObservable {
String email,password;
boolean isDataValidate;
public String getEmail() {
return email;
}
public void setEmail(String …Run Code Online (Sandbox Code Playgroud) 我在使用Android Google Places API时遇到问题-自动完成功能。我使用了与Android Google Maps API相同的密钥,但它不是开放空间片段。它仅显示“地图”,但在打开“场所自动完成片段”时会打开并自动关闭,并显示PLACES_API_ACCESS_NOT_CONFIGURED错误。请帮助我解决此问题,并显示处理此问题的权利。这是我的清单XML:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyARQ78yaNEJH12aJLM1Y-112WY12p95ZOEGI"/>
Run Code Online (Sandbox Code Playgroud)
这是我的开放场所AutocolmpleteFragment的代码:
try {
Intent intent =
new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN)
.build(getActivity());
startActivityForResult(intent, 1);
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
// TODO: Handle the error.
}
Run Code Online (Sandbox Code Playgroud)
在这里,我获得位置响应的代码:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if (resultCode ==RESULT_OK) {
Place place = PlaceAutocomplete.getPlace(getActivity(), data);
onPlaceSelected(place,1);
bar.setVisibility(View.GONE);
autoCompleteTextViewPickup.setFocusable(true);
} else if (resultCode == PlaceAutocomplete.RESULT_ERROR) {
Status status = PlaceAutocomplete.getStatus(getActivity(), data);
this.onError(status,1);
bar.setVisibility(View.GONE);
autoCompleteTextViewPickup.setFocusable(true);
}
}
Run Code Online (Sandbox Code Playgroud)