@@ -1074,7 +1074,10 @@ public int smartSplitHelper(BufferedImage image) {
1074
1074
Color c2 = Util .getColor (image .getRGB (j + 1 , i ));
1075
1075
1076
1076
// Checks if the row of pixels is the same color, if not, moves 1 pixel down
1077
- if (!(c1 .getAlpha () == c2 .getAlpha () && c1 .getRed () == c2 .getRed () && c1 .getGreen () == c2 .getGreen () && c1 .getBlue () == c2 .getBlue ())) {
1077
+ if (!(c2 .getAlpha ()-10 <= c1 .getAlpha () && c1 .getAlpha () <= c2 .getAlpha ()+10 &&
1078
+ c2 .getRed ()-10 <= c1 .getRed () && c1 .getRed () <= c2 .getRed ()+10 &&
1079
+ c2 .getGreen ()-10 <= c1 .getGreen () && c1 .getGreen () <= c2 .getGreen ()+10 &&
1080
+ c2 .getBlue ()-10 <= c1 .getBlue () && c1 .getBlue () <= c2 .getBlue ()+10 )) {
1078
1081
break ;
1079
1082
}
1080
1083
// Otherwise, it saves the height to split, and moves to the next part
@@ -1116,12 +1119,13 @@ public int smartSplitHelper(BufferedImage image) {
1116
1119
1117
1120
// Waifu2X the image
1118
1121
public boolean waifuHelper (File f ) {
1122
+
1119
1123
// If the waifu2x.exe is not found
1120
1124
if (waifuPath .equalsIgnoreCase ("NOT FOUND" ) || (!denoiseBox .isSelected () && !scaleBox .isSelected ())) {
1121
1125
return false ;
1122
1126
}
1123
1127
1124
- int sf = (int ) scaleSlider .getValue ();
1128
+ int sf = (int ) Math . pow ( 2 , scaleSlider .getValue () );
1125
1129
String shf = scaleHeightField .getText ();
1126
1130
String swf = scaleWidthField .getText ();
1127
1131
@@ -1168,7 +1172,7 @@ public boolean waifuHelper(File f) {
1168
1172
cmd .add ("-o" );
1169
1173
cmd .add ("\" " + outputField .getText () + nameField .getText () + "_waifu." + fileOption + "\" " );
1170
1174
1171
- if (waifuPath .contains ("CAFFE " )) {
1175
+ if (waifuPath .contains ("caffe " )) {
1172
1176
// NOISE AND SCALE
1173
1177
cmd .add ("-m" );
1174
1178
if (denoiseBox .isSelected () && scaleBox .isSelected ()) {
@@ -1206,7 +1210,7 @@ else if (denoiseBox.isSelected() && !scaleBox.isSelected()) {
1206
1210
cmd .add ("--model_dir" );
1207
1211
cmd .add (new File (waifuField .getText ()).getParent () + File .separator + "models" + File .separator + modelOptions .getValue ());
1208
1212
}
1209
- else if (waifuPath .contains ("VULKAN " )) {
1213
+ else if (waifuPath .contains ("vulkan " )) {
1210
1214
if (denoiseBox .isSelected ()) {
1211
1215
cmd .add ("-n" );
1212
1216
cmd .add (((int ) denoiseSlider .getValue ()) + "" );
@@ -1237,14 +1241,21 @@ else if (waifuPath.contains("VULKAN")) {
1237
1241
Alert a = new Alert (Alert .AlertType .INFORMATION );
1238
1242
a .setHeaderText (null );
1239
1243
if (denoiseBox .isSelected () && scaleBox .isSelected ()) {
1240
- a .setContentText ("Image has been denoised with level " + (int ) denoiseSlider .getValue () + " and scaled by " + ( int ) Math . pow ( 2 , sf ) + "!" );
1244
+ a .setContentText ("Image has been denoised with level " + (int ) denoiseSlider .getValue () + " and scaled by " + sf + "!" );
1241
1245
} else if (denoiseBox .isSelected () && !scaleBox .isSelected ()) {
1242
1246
a .setContentText ("Image has been denoised with level " + (int ) denoiseSlider .getValue ());
1243
1247
} else if (!denoiseBox .isSelected () && scaleBox .isSelected ()) {
1244
1248
a .setContentText ("Image has been scaled by " + sf + "!" );
1245
1249
}
1246
1250
a .showAndWait ();
1247
1251
}
1252
+
1253
+ for (int i = 1 ; i < cmd .size (); i ++) {
1254
+ System .out .print (cmd + " " );
1255
+ }
1256
+ System .out .println ("END" );
1257
+
1258
+
1248
1259
return true ;
1249
1260
}
1250
1261
}
0 commit comments