Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Fix a crash when handling images with different width and height #97

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ protected void onCreate(Bundle savedInstanceState) {
final Button buttonRestart = findViewById(R.id.restartButton);
buttonRestart.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (mImagename == "deeplab.jpg")
if (mImagename.equals("deeplab.jpg"))
mImagename = "dog.jpg";
else if (mImagename.equals("dog.jpg"))
mImagename = "dog_landscape.jpg";
else
mImagename = "deeplab.jpg";
try {
Expand Down Expand Up @@ -130,8 +132,8 @@ public void run() {
int width = mBitmap.getWidth();
int height = mBitmap.getHeight();
int[] intValues = new int[width * height];
for (int j = 0; j < width; j++) {
for (int k = 0; k < height; k++) {
for (int j = 0; j < height; j++) {
for (int k = 0; k < width; k++) {
int maxi = 0, maxj = 0, maxk = 0;
double maxnum = -Double.MAX_VALUE;
for (int i = 0; i < CLASSNUM; i++) {
Expand Down
2 changes: 1 addition & 1 deletion ImageSegmentation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath 'com.android.tools.build:gradle:4.1.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion ImageSegmentation/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip