Skip to content

Commit

Permalink
[TF] kill more mlkit
Browse files Browse the repository at this point in the history
  • Loading branch information
thermatk committed Jul 7, 2024
1 parent caec541 commit 67e98df
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@

import androidx.annotation.Nullable;

import com.google.mlkit.common.MlKitException;
import com.google.mlkit.vision.common.InputImage;
import com.google.mlkit.vision.label.ImageLabeling;
import com.google.mlkit.vision.label.defaults.ImageLabelerOptions;
import com.google.mlkit.vision.segmentation.subject.Subject;
import com.google.mlkit.vision.segmentation.subject.SubjectSegmentation;
import com.google.mlkit.vision.segmentation.subject.SubjectSegmenter;
import com.google.mlkit.vision.segmentation.subject.SubjectSegmenterOptions;

import org.checkerframework.checker.units.qual.A;
import org.telegram.messenger.AndroidUtilities;
Expand Down Expand Up @@ -828,6 +820,7 @@ public void segmentImage(Bitmap source, int orientation, int containerWidth, int
sourceBitmap = source;
this.orientation = orientation;
detectedEmoji = null;
/*
segment(source, orientation, subjects -> {
final ArrayList<SegmentedObject> finalObjects = new ArrayList<>();
Expand Down Expand Up @@ -903,21 +896,21 @@ public void segmentImage(Bitmap source, int orientation, int containerWidth, int
});
});
}, whenEmpty);
}, whenEmpty);*/
}

private static class SubjectMock {
public Bitmap bitmap;
public int startX, startY, width, height;
public static SubjectMock of(Subject subject) {
/*public static SubjectMock of(Subject subject) {
SubjectMock m = new SubjectMock();
m.bitmap = subject.getBitmap();
m.startX = subject.getStartX();
m.startY = subject.getStartY();
m.width = subject.getWidth();
m.height = subject.getHeight();
return m;
}
}*/
public static SubjectMock mock(Bitmap source) {
SubjectMock m = new SubjectMock();
m.width = m.height = (int) (Math.min(source.getWidth(), source.getHeight()) * .4f);
Expand All @@ -929,7 +922,7 @@ public static SubjectMock mock(Bitmap source) {
}
}

private void segment(Bitmap bitmap, int orientation, Utilities.Callback<List<SubjectMock>> whenDone, Utilities.Callback<SegmentedObject> whenEmpty) {
/*private void segment(Bitmap bitmap, int orientation, Utilities.Callback<List<SubjectMock>> whenDone, Utilities.Callback<SegmentedObject> whenEmpty) {
segmentingLoading = true;
SubjectSegmenter segmenter = SubjectSegmentation.getClient(
new SubjectSegmenterOptions.Builder()
Expand Down Expand Up @@ -988,7 +981,7 @@ private void segment(Bitmap bitmap, int orientation, Utilities.Callback<List<Sub
Emoji.getEmojiDrawable(defaultReactions.get(i).reaction);
}
}

*/
private void createSegmentImagePath(SegmentedObject object, int containerWidth, int containerHeight) {
int imageWidth = object.getImage().getWidth();
int imageHeight = object.getImage().getHeight();
Expand Down Expand Up @@ -1234,9 +1227,6 @@ public void clean() {
isThanosInProgress = false;
}

public static boolean isWaitingMlKitError(Exception e) {
return e instanceof MlKitException && e.getMessage() != null && e.getMessage().contains("segmentation optional module to be downloaded");
}

public void setCurrentAccount(int account) {
if (currentAccount != account) {
Expand Down

0 comments on commit 67e98df

Please sign in to comment.