Skip to content

Instantly share code, notes, and snippets.

View burakiren's full-sized avatar

Burak burakiren

View GitHub Profile
@burakiren
burakiren / HitTest.java
Created November 24, 2020 12:13
Hit Test
//Pass the click event to the ARFrame object and generate the hit detection result.
List<ARHitResult> hitResults = arFrame.hitTest(motionEvent);
//Create an anchor at the detected hit location to enable the AR Engine to continuously track the location.
for (ARHitResult arHitResult : hitResults) {
arHitResult.createAnchor();
}
@burakiren
burakiren / HandleResult.java
Created November 24, 2020 12:12
Handle Result
//Obtain a frame of data from ARSession.
ARFrame arFrame = mArSession.update();
//Obtain the ARCamera object from the ARFrame object. The ARCamera object can obtain the projection matrix of the camera to render the window.
ARCamera arCamera = arFrame.getCamera();
//Obtain all trackable planes from ARSession.
Collection<ARPlane> arPlanes = mArSession.getAllTrackables(ARPlane.class);
@burakiren
burakiren / ArSessionCreate.java
Created November 24, 2020 12:11
Create Ar Session
//Create an ARSession.
mArSession = new ARSession(this);
//Select a specific Config to initialize the ARSession based on the application scenario.
ARWorldTrackingConfig config = new ARWorldTrackingConfig(mArSession);
mArSession.configure(config);
mArSession.resume();
@burakiren
burakiren / ArEngineControl.java
Created November 24, 2020 12:10
arengine control
boolean isInstallArEngineApk = AREnginesApk.isAREngineApkReady(this);
if (!isInstallArEngineApk) {
// ConnectAppMarketActivity.class is the activity for redirecting to AppGallery.
startActivity(new Intent(this, com.huawei.arengine.demos.common.ConnectAppMarketActivity.class));
isRemindInstall = true;
}
@burakiren
burakiren / isSamePerson.kt
Created November 23, 2020 13:56
HiAi_isSamePerson
try {
Float confidence = mFaceCompareResult.isSamePerson();
boolean samePerson = mFaceCompareResult.getSocre();
} catch (Exception e) {
e.printStackTrace();
}
@burakiren
burakiren / FaceComparator.kt
Created November 23, 2020 13:55
FaceComparator
FaceComparator mFaceComparator = new FaceComparator(mContext);
VisionImage image1 = null;
VisionImage image2 = null;
if (bitmapFirst != null) {
image1 = VisionImage.fromBitmap(bitmapFirst);
}
if (bitmapSecond != null) {
image2 = VisionImage.fromBitmap(bitmapSecond);
}
@burakiren
burakiren / visionbase_init.kt
Created November 23, 2020 13:51
visionbase init
VisionBase.init(MainActivity.this, new ConnectionCallback(){
@Override
public void onServiceConnect(){
Log.i(LOG_TAG, "onServiceConnect");
}
@Override
public void onServiceDisconnect(){
Log.i(LOG_TAG, "onServiceDisconnect");
}
@burakiren
burakiren / imports.kt
Created November 23, 2020 13:49
HiAi imports
import com.huawei.hiai.vision.visionkit.common.Frame;//Load the frame class.
import com.huawei.hiai.vision.face.FaceComparator;//Load the face comparison class.
import com.huawei.hiai.vision.visionkit.face.FaceCompareResult;//Load the face comparison result class.
import com.huawei.hiai.vision.common.VisionBase;//Load the static class for connecting to the service.
import com.huawei.hiai.vision.common.ConnectionCallback;//Load the callback for connecting to the service.
import com.huawei.hiai.vision.common.VisionImage;//Load the VisionImage class.
import com.huawei.hiai.vision.visionkit.face.FaceCompareConfiguration;//Load the facial comparison configuration class.
@burakiren
burakiren / ExampleFragment
Created November 13, 2020 07:37
MVI - ExampleFragment
public class ExampleFragment extends Fragment implements ExampleView {
@BindView(R.id.userData) TextView userData;
@BindView(R.id.loadingView) View loadingView;
@BindView(R.id.errorView) TextView errorView;
@BindView(R.id.emptyView) View emptyView;
@Override public Observable<String> showUserDataIntent() {
return "";
}
@Override public void render(ExampleViewState viewState) {
@burakiren
burakiren / ExampleView
Created November 13, 2020 07:36
MVI - ExampleView
interface ExampleView : MvpView {
/** * Emits button clicks as Observables */
fun showUserDataIntent(): Observable<Unit>
/** * Render the state in the UI */
fun render(state: ExampleViewState)
}