Complete basic score reading for Love Live
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
be03f8849b
commit
1c0310c188
@ -102,9 +102,16 @@ class Box{
|
|||||||
}
|
}
|
||||||
class LoveLiveReader extends Reader{
|
class LoveLiveReader extends Reader{
|
||||||
final static int REGION_PADDING = 32;
|
final static int REGION_PADDING = 32;
|
||||||
|
List<Box> extraRegions = new ArrayList<>();
|
||||||
|
static int lastJump=0;
|
||||||
LoveLiveReader(){
|
LoveLiveReader(){
|
||||||
readRegions.add(new Box(713,401,232,50)); //score[0]
|
readRegions.add(new Box(713,401,232,50)); //score[0]
|
||||||
readRegions.add(new Box(613,290,65,36)); //rank[1]
|
readRegions.add(new Box(613,290,65,36)); //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]
|
||||||
|
extraRegions.add(new Box(65,840,250,53)); //bad outline[3]
|
||||||
|
extraRegions.add(new Box(65,920,250,53)); //miss outline[4]
|
||||||
readRegions.add(new Box(509,604,190,54)); //notes[2]
|
readRegions.add(new Box(509,604,190,54)); //notes[2]
|
||||||
readRegions.add(new Box(509,680,190,54)); //notes[3]
|
readRegions.add(new Box(509,680,190,54)); //notes[3]
|
||||||
readRegions.add(new Box(509,760,190,54)); //notes[4]
|
readRegions.add(new Box(509,760,190,54)); //notes[4]
|
||||||
@ -117,14 +124,20 @@ class LoveLiveReader extends Reader{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void seek(int[]arr,int i,ColorRange SEEKCOLOR,Color FINALCOLOR,int width) {
|
void seek(int[]arr,int i,ColorRange SEEKCOLOR,Color FINALCOLOR,int width) {
|
||||||
|
seek(arr,i,SEEKCOLOR,FINALCOLOR,width,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int seek(int[]arr,int i,ColorRange SEEKCOLOR,Color FINALCOLOR,int width,int farthestRight) {
|
||||||
arr[i]=FINALCOLOR.getRGB();
|
arr[i]=FINALCOLOR.getRGB();
|
||||||
|
int X = i%width;
|
||||||
for (int x=-1;x<=1;x++) {
|
for (int x=-1;x<=1;x++) {
|
||||||
for (int y=-1;y<=1;y++) {
|
for (int y=-1;y<=1;y++) {
|
||||||
if (SEEKCOLOR.colorInRange(new Color(arr[i+x+y*width]))) {
|
if (SEEKCOLOR.colorInRange(new Color(arr[i+x+y*width]))) {
|
||||||
seek(arr,i+x+y*width,SEEKCOLOR,FINALCOLOR,width);
|
farthestRight=seek(arr,i+x+y*width,SEEKCOLOR,FINALCOLOR,width,farthestRight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return X>farthestRight?X:farthestRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorFilter(int[] arr,int region,int width) {
|
void ColorFilter(int[] arr,int region,int width) {
|
||||||
@ -147,6 +160,93 @@ class LoveLiveReader extends Reader{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
|
case 8:{
|
||||||
|
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;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 9:{
|
||||||
|
final ColorRange TARGETCOLOR = new ColorRange(0,10,155,190,95,145);
|
||||||
|
final ColorRange SEEKINGCOLOR = new ColorRange(0,200,155,240,95,240);
|
||||||
|
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,SEEKINGCOLOR,FINALCOLOR,width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final ColorRange SEEKINGCOLOR2 = new ColorRange(255,255,0,0,255,255);
|
||||||
|
final Color FINALCOLOR2 = new Color(TRANSPARENT,true);
|
||||||
|
for (int x=0;x<width;x++) {
|
||||||
|
//30 pixels from top.
|
||||||
|
if (arr[30*width+x]==Color.MAGENTA.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)) {
|
||||||
|
arr[i]=TRANSPARENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
case 10:{
|
||||||
|
final ColorRange TARGETCOLOR = new ColorRange(240,255,30,50,0,5);
|
||||||
|
final ColorRange SEEKINGCOLOR = new ColorRange(180,255,10,120,0,120);
|
||||||
|
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,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;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i=0;i<arr.length;i++) {
|
||||||
|
Color col = new Color(arr[i],true);
|
||||||
|
if (!col.equals(Color.MAGENTA)) {
|
||||||
|
arr[i]=TRANSPARENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +278,32 @@ class LoveLiveReader extends Reader{
|
|||||||
//System.out.println(Arrays.toString(arr));
|
//System.out.println(Arrays.toString(arr));
|
||||||
ColorFilter(arr,i,readRegions.get(i).w);
|
ColorFilter(arr,i,readRegions.get(i).w);
|
||||||
//g.drawImage(originalImg, 0,currentHeight,readRegions.get(i).w,readRegions.get(i).h+currentHeight,readRegions.get(i).x, readRegions.get(i).y, readRegions.get(i).x+readRegions.get(i).w, readRegions.get(i).y+readRegions.get(i).h, null);
|
//g.drawImage(originalImg, 0,currentHeight,readRegions.get(i).w,readRegions.get(i).h+currentHeight,readRegions.get(i).x, readRegions.get(i).y, readRegions.get(i).x+readRegions.get(i).w, readRegions.get(i).y+readRegions.get(i).h, null);
|
||||||
|
int leftMost=readRegions.get(i).w;
|
||||||
|
for (int j=0;j<arr.length;j++) {
|
||||||
|
if (arr[j]==Color.MAGENTA.getRGB()&&j%readRegions.get(i).w<leftMost) {
|
||||||
|
leftMost=j%readRegions.get(i).w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i>=2&&i<=6) {
|
||||||
|
int[] arr2 = originalImg.getRGB(extraRegions.get(i-2).x, extraRegions.get(i-2).y, extraRegions.get(i-2).w, extraRegions.get(i-2).h, null, 0, extraRegions.get(i-2).w);
|
||||||
|
int rightMost=0;
|
||||||
|
ColorFilter(arr2,400+i-2,extraRegions.get(i-2).w);
|
||||||
|
for (int j=0;j<arr2.length;j++) {
|
||||||
|
if (arr2[j]==Color.MAGENTA.getRGB()&&j%extraRegions.get(i-2).w>rightMost) {
|
||||||
|
rightMost=j%extraRegions.get(i-2).w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//cutImg.setRGB(rightMost-leftMost,currentHeight,readRegions.get(i).w,readRegions.get(i).h,arr,0,readRegions.get(i).w);
|
||||||
|
cutImg.setRGB(0,currentHeight,extraRegions.get(i-2).w,extraRegions.get(i-2).h,arr2,0,extraRegions.get(i-2).w);
|
||||||
|
final int PADDING = 8;
|
||||||
|
for (int x=leftMost;x<readRegions.get(i).w;x++) {
|
||||||
|
for (int y=0;y<readRegions.get(i).h;y++) {
|
||||||
|
cutImg.setRGB(x+rightMost-leftMost+PADDING, y+currentHeight, arr[y*readRegions.get(i).w+x]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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);
|
||||||
|
}
|
||||||
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");
|
||||||
|
BIN
result.png
BIN
result.png
Binary file not shown.
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 40 KiB |
BIN
result.png.png
Normal file
BIN
result.png.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 167 KiB |
BIN
sigonasr2@projectdivar.com
Executable file
BIN
sigonasr2@projectdivar.com
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user