ITG Number Parsing (#1)
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
7004f21e0c
commit
729432a693
@ -59,6 +59,6 @@ public class ArcadeReader {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static void retrieveData(Path img) {
|
public static void retrieveData(Path img) {
|
||||||
new DDRReader().interpretBoxes(img);
|
new ITGReader().interpretBoxes(img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package readers;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@ -32,6 +33,7 @@ public class ITGReader extends Reader{
|
|||||||
addRegion(new Box(344,393,266,36)); //playstyle[9]
|
addRegion(new Box(344,393,266,36)); //playstyle[9]
|
||||||
addRegion(new Box(277,174,324,171)); //grade[10]
|
addRegion(new Box(277,174,324,171)); //grade[10]
|
||||||
addRegion(new Box(632,106,656,43)); //songname[11]
|
addRegion(new Box(632,106,656,43)); //songname[11]
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorFilter(int[] arr,int region,int width) {
|
void ColorFilter(int[] arr,int region,int width) {
|
||||||
@ -82,7 +84,7 @@ public class ITGReader extends Reader{
|
|||||||
case 11:{
|
case 11:{
|
||||||
process(arr,width,
|
process(arr,width,
|
||||||
180,255,180,255,180,255,
|
180,255,180,255,180,255,
|
||||||
130,255,130,255,130,255);
|
150,255,150,255,150,255);
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,7 +142,7 @@ public class ITGReader extends Reader{
|
|||||||
System.out.println(Arrays.toString(ja_data));
|
System.out.println(Arrays.toString(ja_data));
|
||||||
System.out.println(Arrays.toString(en_data));
|
System.out.println(Arrays.toString(en_data));
|
||||||
System.out.println(Arrays.toString(sig_data));
|
System.out.println(Arrays.toString(sig_data));
|
||||||
interpretOutput(ja_data,en_data);
|
//interpretOutput(ja_data,en_data);
|
||||||
g.dispose();
|
g.dispose();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -152,17 +154,32 @@ public class ITGReader extends Reader{
|
|||||||
private String interpretImage(BufferedImage cutImg, int i) {
|
private String interpretImage(BufferedImage cutImg, int i) {
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0:{
|
case 0:{
|
||||||
Font f = Font.FONT_DDR_SCORE;
|
Font f = Font.FONT_ITG_EX;
|
||||||
List<Glyph> glyphs = Glyph.split(cutImg);
|
List<Glyph> glyphs = Glyph.split(cutImg);
|
||||||
if (glyphs.size()==9) {
|
glyphs.remove(glyphs.size()-3);
|
||||||
//This is a 1,000,000 score.
|
String res = f.convertGlyphs(glyphs);
|
||||||
glyphs.remove(5);
|
return res.substring(0,res.length()-2)+"."+res.substring(res.length()-2,res.length());
|
||||||
glyphs.remove(1);
|
|
||||||
} else
|
|
||||||
if (glyphs.size()>4) {
|
|
||||||
//This is a XXX,XXX score.
|
|
||||||
glyphs.remove(3);
|
|
||||||
}
|
}
|
||||||
|
case 7:{
|
||||||
|
Font f = Font.FONT_ITG_PCT;
|
||||||
|
List<Glyph> glyphs = Glyph.split(cutImg);
|
||||||
|
glyphs.remove(glyphs.size()-3);
|
||||||
|
String res = f.convertGlyphs(glyphs);
|
||||||
|
return res.substring(0,res.length()-2)+"."+res.substring(res.length()-2,res.length());
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
case 6:{
|
||||||
|
Font f = Font.FONT_ITG_NOTECOUNT;
|
||||||
|
List<Glyph> glyphs = Glyph.split(cutImg);
|
||||||
|
return f.convertGlyphs(glyphs);
|
||||||
|
}
|
||||||
|
case 8:{
|
||||||
|
Font f = Font.FONT_ITG_DIFF;
|
||||||
|
List<Glyph> glyphs = Glyph.split(cutImg);
|
||||||
return f.convertGlyphs(glyphs);
|
return f.convertGlyphs(glyphs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ public abstract class Reader{
|
|||||||
for (int y=-1;y<=1;y++) {
|
for (int y=-1;y<=1;y++) {
|
||||||
int newX=(i+x+y*width)%width;
|
int newX=(i+x+y*width)%width;
|
||||||
int newY=(i+x+y*width)/width;
|
int newY=(i+x+y*width)/width;
|
||||||
if (newX>=0&&newY>=0&&newX<=width&&newY<=arr.length/width) {
|
if (newX>=0&&newY>=0&&newX<width&&newY<arr.length/width) {
|
||||||
Color col = new Color(arr[i+x+y*width]);
|
Color col = new Color(arr[i+x+y*width]);
|
||||||
if (!col.equals(Color.MAGENTA)&&SEEKCOLOR.colorInRange(col)) {
|
if (!col.equals(Color.MAGENTA)&&SEEKCOLOR.colorInRange(col)) {
|
||||||
farthestRight=seek(arr,i+x+y*width,SEEKCOLOR,FINALCOLOR,width,farthestRight);
|
farthestRight=seek(arr,i+x+y*width,SEEKCOLOR,FINALCOLOR,width,farthestRight);
|
||||||
|
BIN
result.png
BIN
result.png
Binary file not shown.
Before Width: | Height: | Size: 174 KiB After Width: | Height: | Size: 8.1 KiB |
@ -115,7 +115,7 @@ public class sigPlace {
|
|||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}*/
|
}*/
|
||||||
ArcadeReader.retrieveData(Paths.get("ddr5.png"));
|
ArcadeReader.retrieveData(Paths.get("itg11.png"));
|
||||||
/* Path secretFile = Paths.get(".clientsecret");
|
/* Path secretFile = Paths.get(".clientsecret");
|
||||||
List<String> data;
|
List<String> data;
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user