Love live parsing getting closer for #1
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
95698211e9
commit
e32d9564bb
@ -100,6 +100,8 @@ public class LoveLiveReader extends Reader{
|
|||||||
Color col = new Color(arr[i],true);
|
Color col = new Color(arr[i],true);
|
||||||
if (!col.equals(Color.RED)) {
|
if (!col.equals(Color.RED)) {
|
||||||
arr[i]=TRANSPARENT;
|
arr[i]=TRANSPARENT;
|
||||||
|
} else {
|
||||||
|
arr[i]=Color.MAGENTA.getRGB();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
@ -120,18 +122,14 @@ public class LoveLiveReader extends Reader{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case 400:
|
case 402:{
|
||||||
case 401:
|
final ColorRange TARGETCOLOR = new ColorRange(80,120,100,130,100,140);
|
||||||
case 402:
|
final ColorRange SEEKINGCOLOR = new ColorRange(220,255,220,255,220,255);
|
||||||
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 Color FINALCOLOR = Color.MAGENTA;
|
||||||
for (int i=0;i<arr.length;i++) {
|
for (int i=0;i<arr.length;i++) {
|
||||||
Color col = new Color(arr[i],true);
|
Color col = new Color(arr[i],true);
|
||||||
if (TARGETCOLOR.colorInRange(col)) {
|
if (TARGETCOLOR.colorInRange(col)) {
|
||||||
seek(arr,i,SEEKINGCOLOR,FINALCOLOR,width);
|
seek(arr,i-width,SEEKINGCOLOR,FINALCOLOR,width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i=0;i<arr.length;i++) {
|
for (int i=0;i<arr.length;i++) {
|
||||||
@ -141,6 +139,38 @@ public class LoveLiveReader extends Reader{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
case 400:
|
||||||
|
case 401:
|
||||||
|
case 403:
|
||||||
|
case 404:{
|
||||||
|
final ColorRange TARGETCOLOR = new ColorRange(255,255,255,255,255,255);
|
||||||
|
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.RED)) {
|
||||||
|
arr[i]=TRANSPARENT;
|
||||||
|
} else {
|
||||||
|
arr[i]=Color.MAGENTA.getRGB();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,14 +228,15 @@ public class LoveLiveReader extends Reader{
|
|||||||
} else {
|
} else {
|
||||||
cutImg.setRGB(0,currentHeight,readRegions.get(i).w,readRegions.get(i).h,arr,0,readRegions.get(i).w);
|
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;
|
currentHeight+=readRegions.get(i).h+REGION_PADDING;
|
||||||
}
|
}
|
||||||
Path output = Paths.get("result.png");
|
Path output = Paths.get("result.png");
|
||||||
ImageIO.write(cutImg,"png",output.toFile());
|
ImageIO.write(cutImg,"png",output.toFile());
|
||||||
String dataString = readAllBoxes(output);
|
String dataString = readAllBoxes(output);
|
||||||
String[] data = dataString.split(Pattern.quote("\n"));
|
String[] data = dataString.split(Pattern.quote("\n"));
|
||||||
String[] ja_data = data[0].split(Pattern.quote(")"));
|
String[] ja_data = data[0].split(Pattern.quote(","));
|
||||||
String[] en_data = data[2].split(Pattern.quote(")"));
|
String[] en_data = data[2].split(Pattern.quote(","));
|
||||||
trimAllData(ja_data);
|
trimAllData(ja_data);
|
||||||
trimAllData(en_data);
|
trimAllData(en_data);
|
||||||
System.out.println(Arrays.toString(ja_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]
|
//[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.
|
//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()];
|
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;
|
int spacing=0;
|
||||||
for (int j=0;j<readRegions.size();j++) {
|
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&&
|
int midpoint=(Integer.parseInt(en_data[i+1])+Integer.parseInt(en_data[i+5]))/2;
|
||||||
accuracy[j]<Double.parseDouble(en_data[i+9])) {
|
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("[");
|
System.out.print("[");
|
||||||
for (int k=0;k<10;k++) {
|
for (int k=0;k<10;k++) {
|
||||||
if (k!=0) {
|
if (k!=0) {
|
||||||
|
@ -50,7 +50,7 @@ public abstract class Reader{
|
|||||||
sb.append(data[i].charAt(j));
|
sb.append(data[i].charAt(j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data[i]=sb.toString();
|
data[i]=sb.toString().trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
result.png
BIN
result.png
Binary file not shown.
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 38 KiB |
Loading…
x
Reference in New Issue
Block a user