Implement ranking reading for love live images (#3)
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
79ccb0fcdf
commit
a6063fa21c
@ -21,7 +21,7 @@ public class LoveLiveReader extends Reader{
|
||||
static int lastJump=0;
|
||||
public LoveLiveReader(){
|
||||
addRegion(new Box(713,401,232,50),NUMBER); //score[0]
|
||||
addRegion(new Box(613,290,65,36)); //rank[1]
|
||||
addRegion(new Box(867,710,286,156)); //rank[1]
|
||||
extraRegions.add(new Box(65,604,250,53)); //perfect outline[0]
|
||||
extraRegions.add(new Box(65,680,250,53)); //great outline[1]
|
||||
extraRegions.add(new Box(65,760,250,53)); //good outline[2]
|
||||
@ -179,6 +179,21 @@ public class LoveLiveReader extends Reader{
|
||||
}break;
|
||||
}
|
||||
}
|
||||
boolean checkRank(ColorRange range,int[] arr) {
|
||||
return checkRank(range,arr,4096);
|
||||
}
|
||||
|
||||
boolean checkRank(ColorRange range,int[] arr,int amt) {
|
||||
int colorCount=0;
|
||||
for (int j=0;j<arr.length;j++) {
|
||||
Color col = new Color(arr[j],true);
|
||||
if (range.colorInRange(col)) {
|
||||
colorCount++;
|
||||
}
|
||||
}
|
||||
System.out.println("Found "+colorCount+" pixels.");
|
||||
return colorCount>amt;
|
||||
}
|
||||
|
||||
public void interpretBoxes(Path img){
|
||||
/*String dataString = readAllBoxes(img);
|
||||
@ -217,6 +232,40 @@ public class LoveLiveReader extends Reader{
|
||||
subRegion.setRGB(0,0,readRegions.get(i).w,readRegions.get(i).h,arr,0,readRegions.get(i).w);
|
||||
ImageIO.write(subRegion,"png",new File("sub.png"));
|
||||
cutImg.setRGB(0,currentHeight,readRegions.get(i).w,readRegions.get(i).h,arr,0,readRegions.get(i).w);
|
||||
if (i==1) {
|
||||
final ColorRange dRange = new ColorRange(130,160,130,190,200,250);
|
||||
final ColorRange cRange = new ColorRange(50,200,180,230,10,115);
|
||||
final ColorRange bRange = new ColorRange(240,252,0,140,150,200);
|
||||
final ColorRange aRange = new ColorRange(180,230,40,200,230,250);
|
||||
final ColorRange sRange = new ColorRange(245,255,150,255,0,100);
|
||||
Color col = new Color(subRegion.getRGB(269, 19),true);
|
||||
System.out.println(col);
|
||||
final ColorRange sssRange = new ColorRange(245,255,60,190,0,150);
|
||||
Color col2 = new Color(subRegion.getRGB(228, 19),true);
|
||||
final ColorRange ssRange = new ColorRange(245,255,60,190,0,150);
|
||||
System.out.println(col2);
|
||||
if (checkRank(dRange,arr)) {
|
||||
rank=6;/*D*/
|
||||
} else
|
||||
if (checkRank(cRange,arr)) {
|
||||
rank=5;/*C*/
|
||||
} else
|
||||
if (checkRank(bRange,arr)) {
|
||||
rank=4;/*B*/
|
||||
} else
|
||||
if (checkRank(aRange,arr)) {
|
||||
rank=3;/*A*/
|
||||
} else
|
||||
if (sssRange.colorInRange(col)) {
|
||||
rank=0;/*SSS*/
|
||||
} else
|
||||
if (ssRange.colorInRange(col2)) {
|
||||
rank=1;/*SS*/
|
||||
} else
|
||||
if (checkRank(sRange,arr)) {
|
||||
rank=2;/*S*/
|
||||
}
|
||||
}
|
||||
String val = interpretImage(subRegion,i);
|
||||
sig_data[counter++]=val;
|
||||
//System.out.println(i+": "+currentHeight+"-"+(currentHeight+readRegions.get(i).h+REGION_PADDING));
|
||||
|
@ -38,14 +38,17 @@ public abstract class Reader{
|
||||
String parseOutCommas(String str) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean insideStr = false;
|
||||
char escapeChar = '\'';
|
||||
for (int i=0;i<str.length();i++) {
|
||||
if (i>0) {
|
||||
if (str.charAt(i)=='\''&&str.charAt(i-1)!='\\') {
|
||||
insideStr=!insideStr;
|
||||
if (!insideStr) {
|
||||
if (str.charAt(i)=='\''||str.charAt(i)=='"') {
|
||||
insideStr=true;
|
||||
escapeChar=str.charAt(i);
|
||||
}
|
||||
} else {
|
||||
if (str.charAt(i)==escapeChar) {
|
||||
insideStr=false;
|
||||
}
|
||||
} else
|
||||
if (str.charAt(i)=='\'') {
|
||||
insideStr=!insideStr;
|
||||
}
|
||||
if (insideStr&&str.charAt(i)==',') {
|
||||
sb.append('،');
|
||||
|
BIN
result.png
BIN
result.png
Binary file not shown.
Before ![]() (image error) Size: 33 KiB After ![]() (image error) Size: 83 KiB ![]() ![]() |
@ -81,7 +81,7 @@ public class sigPlace {
|
||||
final static int TRANSPARENT = new Color(0,0,0,0).getRGB();
|
||||
|
||||
public static void main(String[] args) {
|
||||
String fontName = "sdvx_largeScore";
|
||||
/*String fontName = "sdvx_largeScore";
|
||||
String value = "301";
|
||||
Path f = Paths.get("sdvx1.png");
|
||||
BufferedImage img;
|
||||
@ -115,8 +115,8 @@ public class sigPlace {
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
//ArcadeReader.retrieveData(Paths.get("lovelive2.png"));
|
||||
}*/
|
||||
ArcadeReader.retrieveData(Paths.get("lovelive8.png"));
|
||||
/* Path secretFile = Paths.get(".clientsecret");
|
||||
List<String> data;
|
||||
try {
|
||||
|
BIN
sub.png
BIN
sub.png
Binary file not shown.
Before ![]() (image error) Size: 683 B After ![]() (image error) Size: 572 B ![]() ![]() |
Loading…
x
Reference in New Issue
Block a user