Parse all DDR zones
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
e659127cef
commit
1a10316b37
@ -33,7 +33,7 @@ public class DDRReader extends Reader{
|
||||
readRegions.add(new Box(104,80,171,88)); //grade[13]
|
||||
readRegions.add(new Box(335,185,185,18)); //songname[14]
|
||||
|
||||
extraRegions.add(new Box(115,170,43,11)); //score text[0]
|
||||
extraRegions.add(new Box(115,150,43,31)); //score text[0]
|
||||
extraRegions.add(new Box(147,246,118,18)); //max combo text[1]
|
||||
extraRegions.add(new Box(179,270,88,15)); //marvelous text[2]
|
||||
extraRegions.add(new Box(198,290,68,14)); //perfect text[3]
|
||||
@ -49,10 +49,129 @@ public class DDRReader extends Reader{
|
||||
|
||||
void ColorFilter(int[] arr,int region,int width) {
|
||||
switch (region) {
|
||||
case 999:{
|
||||
case 0:{
|
||||
process(arr,width,
|
||||
240,255,100,130,0,10,
|
||||
240,255,100,255,0,100);
|
||||
240,255,240,255,240,255,
|
||||
200,255,200,255,200,255);
|
||||
}break;
|
||||
case 400:{
|
||||
process(arr,width,
|
||||
180,255,180,255,180,255,
|
||||
170,255,170,255,170,255);
|
||||
}break;
|
||||
case 1:{
|
||||
process(arr,width,
|
||||
180,255,180,255,180,255,
|
||||
70,255,70,255,70,255);
|
||||
}break;
|
||||
case 401:{
|
||||
process(arr,width,
|
||||
240,255,240,255,240,255,
|
||||
130,255,130,255,130,255);
|
||||
}break;
|
||||
case 2:{
|
||||
process(arr,width,
|
||||
0,50,0,50,0,50,
|
||||
0,160,0,160,0,160);
|
||||
}break;
|
||||
case 402:{
|
||||
process(arr,width,
|
||||
50,120,50,120,50,120,
|
||||
0,170,0,160,0,140);
|
||||
}break;
|
||||
case 3:{
|
||||
process(arr,width,
|
||||
0,50,0,50,0,50,
|
||||
0,160,0,160,0,160);
|
||||
}break;
|
||||
case 403:{
|
||||
process(arr,width,
|
||||
60,100,50,100,0,40,
|
||||
0,150,0,150,0,70);
|
||||
}break;
|
||||
case 4:{
|
||||
process(arr,width,
|
||||
0,50,0,50,0,50,
|
||||
0,160,0,160,0,160);
|
||||
}break;
|
||||
case 404:{
|
||||
process(arr,width,
|
||||
10,50,50,170,0,50,
|
||||
0,80,0,115,0,90);
|
||||
}break;
|
||||
case 5:{
|
||||
process(arr,width,
|
||||
0,50,0,50,0,50,
|
||||
0,160,0,160,0,160);
|
||||
}break;
|
||||
case 405:{
|
||||
process(arr,width,
|
||||
30,80,60,110,70,140,
|
||||
0,110,0,130,0,160);
|
||||
}break;
|
||||
case 6:{
|
||||
process(arr,width,
|
||||
0,50,0,50,0,50,
|
||||
0,160,0,160,0,160);
|
||||
}break;
|
||||
case 406:{
|
||||
process(arr,width,
|
||||
50,100,20,70,0,40,
|
||||
0,130,0,110,0,90);
|
||||
}break;
|
||||
case 7:{
|
||||
process(arr,width,
|
||||
0,50,0,50,0,50,
|
||||
0,160,0,160,0,160);
|
||||
}break;
|
||||
case 407:{
|
||||
process(arr,width,
|
||||
40,70,20,50,20,70,
|
||||
0,110,0,90,0,100);
|
||||
}break;
|
||||
case 8:{
|
||||
process(arr,width,
|
||||
190,255,190,255,190,255,
|
||||
140,255,140,255,140,255);
|
||||
}break;
|
||||
case 408:{
|
||||
process(arr,width,
|
||||
200,255,200,255,0,90,
|
||||
180,255,170,255,0,90);
|
||||
}break;
|
||||
case 9:{
|
||||
process(arr,width,
|
||||
0,50,0,50,0,50,
|
||||
0,160,0,160,0,160);
|
||||
}break;
|
||||
case 409:{
|
||||
process(arr,width,
|
||||
160,200,200,240,240,255,
|
||||
150,200,170,210,240,255);
|
||||
}break;
|
||||
case 10:{
|
||||
process(arr,width,
|
||||
0,50,0,50,0,50,
|
||||
0,160,0,160,0,160);
|
||||
}break;
|
||||
case 410:{
|
||||
process(arr,width,
|
||||
240,255,180,200,220,255,
|
||||
240,255,150,210,220,255);
|
||||
}break;
|
||||
case 11:{
|
||||
process(arr,width,
|
||||
190,255,190,255,190,255,
|
||||
140,255,140,255,140,255);
|
||||
}break;
|
||||
case 411:{
|
||||
processBrightness(arr,width,
|
||||
300,275);
|
||||
}break;
|
||||
case 12:{
|
||||
process(arr,width,
|
||||
190,255,190,255,190,255,
|
||||
140,255,140,255,140,255);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@ -72,7 +191,7 @@ public class DDRReader extends Reader{
|
||||
for (int i=0;i<readRegions.size();i++) {
|
||||
regionHeights+=readRegions.get(i).h+REGION_PADDING;
|
||||
if (readRegions.get(i).w>maxWidth) {
|
||||
maxWidth=readRegions.get(i).w;
|
||||
maxWidth=readRegions.get(i).w*2;
|
||||
}
|
||||
}
|
||||
try {
|
||||
|
||||
@ -64,12 +64,33 @@ public abstract class Reader{
|
||||
int X = i%width;
|
||||
for (int x=-1;x<=1;x++) {
|
||||
for (int y=-1;y<=1;y++) {
|
||||
if (x>=0&&y>=0&&x<=width&&y<=arr.length/width) {
|
||||
Color col = new Color(arr[i+x+y*width]);
|
||||
if (!col.equals(Color.MAGENTA)&&SEEKCOLOR.colorInRange(col)) {
|
||||
farthestRight=seek(arr,i+x+y*width,SEEKCOLOR,FINALCOLOR,width,farthestRight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return X>farthestRight?X:farthestRight;
|
||||
}
|
||||
void seekThreshold(int[]arr,int i,int threshold,Color FINALCOLOR,int width) {
|
||||
seekThreshold(arr,i,threshold,FINALCOLOR,width,0);
|
||||
}
|
||||
|
||||
int seekThreshold(int[]arr,int i,int threshold,Color FINALCOLOR,int width,int farthestRight) {
|
||||
arr[i]=FINALCOLOR.getRGB();
|
||||
int X = i%width;
|
||||
for (int x=-1;x<=1;x++) {
|
||||
for (int y=-1;y<=1;y++) {
|
||||
if (x>=0&&y>=0&&x<=width&&y<=arr.length/width) {
|
||||
Color col = new Color(arr[i+x+y*width]);
|
||||
if (!col.equals(Color.MAGENTA)&&colorIsBright(col, threshold)) {
|
||||
farthestRight=seekThreshold(arr,i+x+y*width,threshold,FINALCOLOR,width,farthestRight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return X>farthestRight?X:farthestRight;
|
||||
}
|
||||
void process(int[]arr,int width,int a,int b,int c,int d,int e,int f,int g,int h,int ii,int j,int k,int l) {
|
||||
@ -89,4 +110,22 @@ public abstract class Reader{
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean colorIsBright(Color col,int brightnessThreshold) {
|
||||
return col.getRed()+col.getBlue()+col.getGreen()>brightnessThreshold;
|
||||
}
|
||||
void processBrightness(int[]arr,int width,int threshold1,int threshold2) {
|
||||
final Color FINALCOLOR = Color.MAGENTA;
|
||||
for (int i=0;i<arr.length;i++) {
|
||||
Color col = new Color(arr[i],true);
|
||||
if (colorIsBright(col, threshold1)) {
|
||||
seekThreshold(arr,i,threshold2,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
result.png
BIN
result.png
Binary file not shown.
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 39 KiB |
Loading…
x
Reference in New Issue
Block a user