Initial framework for
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
eee6185cdf
commit
4dd411c6d5
@ -1,6 +1,7 @@
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import readers.DDRReader;
|
import readers.DDRReader;
|
||||||
|
import readers.LoveLiveReader;
|
||||||
import readers.PopnReader;
|
import readers.PopnReader;
|
||||||
|
|
||||||
public class ArcadeReader {
|
public class ArcadeReader {
|
||||||
@ -56,6 +57,6 @@ public class ArcadeReader {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static void retrieveData(Path img) {
|
public static void retrieveData(Path img) {
|
||||||
new DDRReader().interpretBoxes(img);
|
new LoveLiveReader().interpretBoxes(img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -251,4 +251,10 @@ public class DDRReader extends Reader{
|
|||||||
//System.out.println(data[0]);
|
//System.out.println(data[0]);
|
||||||
//System.out.println(data[2]);
|
//System.out.println(data[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
String interpretOutput(String[] jp_data, String[] en_data) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
@ -79,18 +79,18 @@ public class LoveLiveReader extends Reader{
|
|||||||
case 9:{
|
case 9:{
|
||||||
final ColorRange TARGETCOLOR = new ColorRange(0,10,155,190,95,145);
|
final ColorRange TARGETCOLOR = new ColorRange(0,10,155,190,95,145);
|
||||||
final ColorRange SEEKINGCOLOR = new ColorRange(0,200,155,240,95,240);
|
final ColorRange SEEKINGCOLOR = new ColorRange(0,200,155,240,95,240);
|
||||||
final Color FINALCOLOR = Color.MAGENTA;
|
final Color FINALCOLOR = Color.RED;
|
||||||
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,SEEKINGCOLOR,FINALCOLOR,width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final ColorRange SEEKINGCOLOR2 = new ColorRange(255,255,0,0,255,255);
|
final ColorRange SEEKINGCOLOR2 = new ColorRange(255,255,0,0,0,0);
|
||||||
final Color FINALCOLOR2 = new Color(TRANSPARENT,true);
|
final Color FINALCOLOR2 = new Color(TRANSPARENT,true);
|
||||||
for (int x=0;x<width;x++) {
|
for (int x=0;x<width;x++) {
|
||||||
//30 pixels from top.
|
//30 pixels from top.
|
||||||
if (arr[30*width+x]==Color.MAGENTA.getRGB()) {
|
if (arr[30*width+x]==Color.RED.getRGB()) {
|
||||||
System.out.println("Start Jump: "+x);
|
System.out.println("Start Jump: "+x);
|
||||||
x=seek(arr,30*width+x,SEEKINGCOLOR2,FINALCOLOR2,width,x);
|
x=seek(arr,30*width+x,SEEKINGCOLOR2,FINALCOLOR2,width,x);
|
||||||
System.out.println("End Jump: "+x);
|
System.out.println("End Jump: "+x);
|
||||||
@ -98,7 +98,7 @@ public class LoveLiveReader extends Reader{
|
|||||||
}
|
}
|
||||||
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 (!col.equals(Color.MAGENTA)) {
|
if (!col.equals(Color.RED)) {
|
||||||
arr[i]=TRANSPARENT;
|
arr[i]=TRANSPARENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,6 +210,7 @@ public class LoveLiveReader extends Reader{
|
|||||||
trimAllData(en_data);
|
trimAllData(en_data);
|
||||||
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));
|
||||||
|
interpretOutput(ja_data,en_data);
|
||||||
g.dispose();
|
g.dispose();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -217,4 +218,35 @@ public class LoveLiveReader extends Reader{
|
|||||||
//System.out.println(data[0]);
|
//System.out.println(data[0]);
|
||||||
//System.out.println(data[2]);
|
//System.out.println(data[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
String interpretOutput(String[] jp_data,String[] en_data) {
|
||||||
|
//[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) {
|
||||||
|
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])) {
|
||||||
|
System.out.print("[");
|
||||||
|
for (int k=0;k<10;k++) {
|
||||||
|
if (k!=0) {
|
||||||
|
System.out.print(",");
|
||||||
|
}
|
||||||
|
System.out.print(en_data[i+k]);
|
||||||
|
}
|
||||||
|
System.out.print("]");
|
||||||
|
System.out.println(" belongs to region "+j+".");
|
||||||
|
accuracy[j]=Double.parseDouble(en_data[i+9]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
spacing+=readRegions.get(j).h+REGION_PADDING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i=0;i<jp_data.length;i+=10) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
@ -187,4 +187,10 @@ public class PopnReader extends Reader{
|
|||||||
//System.out.println(data[0]);
|
//System.out.println(data[0]);
|
||||||
//System.out.println(data[2]);
|
//System.out.println(data[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
String interpretOutput(String[] jp_data, String[] en_data) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
@ -6,8 +6,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
||||||
import javax.imageio.metadata.IIOInvalidTreeException;
|
|
||||||
|
|
||||||
public abstract class Reader{
|
public abstract class Reader{
|
||||||
int score;
|
int score;
|
||||||
int rank;
|
int rank;
|
||||||
@ -42,6 +40,7 @@ public abstract class Reader{
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
abstract String interpretOutput(String[] jp_data,String[] en_data);
|
||||||
void trimAllData(String[] data) {
|
void trimAllData(String[] data) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (int i=0;i<data.length;i++) {
|
for (int i=0;i<data.length;i++) {
|
||||||
|
@ -400,4 +400,10 @@ public class SoundVoltexReader extends Reader{
|
|||||||
//System.out.println(data[0]);
|
//System.out.println(data[0]);
|
||||||
//System.out.println(data[2]);
|
//System.out.println(data[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
String interpretOutput(String[] jp_data, String[] en_data) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
BIN
result.png
BIN
result.png
Binary file not shown.
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
@ -48,7 +48,7 @@ public class sigPlace {
|
|||||||
"%FOOTER", Paths.get(REFDIR,"FOOTER.html"))
|
"%FOOTER", Paths.get(REFDIR,"FOOTER.html"))
|
||||||
));
|
));
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
ArcadeReader.retrieveData(Paths.get("ddr1.jpg"));
|
ArcadeReader.retrieveData(Paths.get("lovelive1.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