|
|
|
@ -100,6 +100,8 @@ public class LoveLiveReader extends Reader{ |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (!col.equals(Color.RED)) { |
|
|
|
|
arr[i]=TRANSPARENT; |
|
|
|
|
} else { |
|
|
|
|
arr[i]=Color.MAGENTA.getRGB(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
@ -120,24 +122,52 @@ public class LoveLiveReader extends Reader{ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case 402:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(80,120,100,130,100,140); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(220,255,220,255,220,255); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i-width,SEEKINGCOLOR,FINALCOLOR,width); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (!col.equals(Color.MAGENTA)) { |
|
|
|
|
arr[i]=TRANSPARENT; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case 400: |
|
|
|
|
case 401: |
|
|
|
|
case 402: |
|
|
|
|
case 403: |
|
|
|
|
case 404:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(255,255,255,255,255,255); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(240,255,240,255,240,255); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(220,255,220,255,220,255); |
|
|
|
|
final Color FINALCOLOR = Color.RED; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,FINALCOLOR,width); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
final ColorRange SEEKINGCOLOR2 = new ColorRange(255,255,0,0,0,0); |
|
|
|
|
final Color FINALCOLOR2 = new Color(TRANSPARENT,true); |
|
|
|
|
for (int x=0;x<width;x++) { |
|
|
|
|
//30 pixels from top.
|
|
|
|
|
if (arr[30*width+x]==Color.RED.getRGB()) { |
|
|
|
|
System.out.println("Start Jump: "+x); |
|
|
|
|
x=seek(arr,30*width+x,SEEKINGCOLOR2,FINALCOLOR2,width,x); |
|
|
|
|
System.out.println("End Jump: "+x); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (!col.equals(Color.MAGENTA)) { |
|
|
|
|
if (!col.equals(Color.RED)) { |
|
|
|
|
arr[i]=TRANSPARENT; |
|
|
|
|
} else { |
|
|
|
|
arr[i]=Color.MAGENTA.getRGB(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
@ -198,14 +228,15 @@ public class LoveLiveReader extends Reader{ |
|
|
|
|
} else { |
|
|
|
|
cutImg.setRGB(0,currentHeight,readRegions.get(i).w,readRegions.get(i).h,arr,0,readRegions.get(i).w); |
|
|
|
|
} |
|
|
|
|
//System.out.println(i+": "+currentHeight+"-"+(currentHeight+readRegions.get(i).h+REGION_PADDING));
|
|
|
|
|
currentHeight+=readRegions.get(i).h+REGION_PADDING; |
|
|
|
|
} |
|
|
|
|
Path output = Paths.get("result.png"); |
|
|
|
|
ImageIO.write(cutImg,"png",output.toFile()); |
|
|
|
|
String dataString = readAllBoxes(output); |
|
|
|
|
String[] data = dataString.split(Pattern.quote("\n")); |
|
|
|
|
String[] ja_data = data[0].split(Pattern.quote(")")); |
|
|
|
|
String[] en_data = data[2].split(Pattern.quote(")")); |
|
|
|
|
String[] ja_data = data[0].split(Pattern.quote(",")); |
|
|
|
|
String[] en_data = data[2].split(Pattern.quote(",")); |
|
|
|
|
trimAllData(ja_data); |
|
|
|
|
trimAllData(en_data); |
|
|
|
|
System.out.println(Arrays.toString(ja_data)); |
|
|
|
@ -224,11 +255,12 @@ public class LoveLiveReader extends Reader{ |
|
|
|
|
//[6, 0, 218, 0, 218, 48, 6, 48, 32 5 4 1 5, 0.9670235803680689]
|
|
|
|
|
//For each data point we want to first see if it's within the correct rectangular bounds and from there parse it as such.
|
|
|
|
|
double accuracy[] = new double[readRegions.size()]; |
|
|
|
|
for (int i=0;i<en_data.length;i+=11) { |
|
|
|
|
for (int i=0;i<en_data.length;i+=10) { |
|
|
|
|
int spacing=0; |
|
|
|
|
for (int j=0;j<readRegions.size();j++) { |
|
|
|
|
if (Integer.parseInt(en_data[i+1])>=spacing&&Integer.parseInt(en_data[i+5])<=spacing+readRegions.get(j).h&& |
|
|
|
|
accuracy[j]<Double.parseDouble(en_data[i+9])) { |
|
|
|
|
int midpoint=(Integer.parseInt(en_data[i+1])+Integer.parseInt(en_data[i+5]))/2; |
|
|
|
|
if (midpoint>=spacing&&midpoint<=spacing+readRegions.get(j).h+REGION_PADDING |
|
|
|
|
/*&&accuracy[j]<Double.parseDouble(en_data[i+9]) Only for jp string testing.*/) { |
|
|
|
|
System.out.print("["); |
|
|
|
|
for (int k=0;k<10;k++) { |
|
|
|
|
if (k!=0) { |
|
|
|
|