Make constraints on the darker pixels lower.

secondmonitor
sigonasr2 4 years ago
parent 4f76f2b9bb
commit dc2692d749
  1. BIN
      DivaBot/DivaBot.jar
  2. 8
      DivaBot/calibration_data.txt
  3. BIN
      DivaBot/capture.png
  4. BIN
      DivaBot/capture_2.png
  5. BIN
      DivaBot/capture_3.png
  6. BIN
      DivaBot/capture_4.png
  7. BIN
      DivaBot/capture_5.png
  8. BIN
      DivaBot/rectangle0.png
  9. BIN
      DivaBot/rectangle1.png
  10. BIN
      DivaBot/rectangle2.png
  11. BIN
      DivaBot/rectangle3.png
  12. BIN
      DivaBot/rectangle4.png
  13. 24
      DivaBot/src/sig/Calibrator.java
  14. 7
      DivaBot/src/sig/DrawCanvas.java
  15. 15
      DivaBot/src/sig/MyRobot.java
  16. BIN
      DivaBot/typeface2.png

Binary file not shown.

@ -1,4 +1,4 @@
470 768
198 504
1529 1548
791 940

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 KiB

After

Width:  |  Height:  |  Size: 531 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 KiB

After

Width:  |  Height:  |  Size: 531 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 910 KiB

After

Width:  |  Height:  |  Size: 530 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 906 KiB

After

Width:  |  Height:  |  Size: 530 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 899 KiB

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

@ -165,9 +165,9 @@ public class Calibrator{
//ImageIO.write(miniImg,"png",new File("capture_3_"+System.nanoTime()+".png")); //ImageIO.write(miniImg,"png",new File("capture_3_"+System.nanoTime()+".png"));
Color col = new Color(miniImg.getRGB(0, 0)); Color col = new Color(miniImg.getRGB(0, 0));
System.out.println("Checking "+col); System.out.println("Checking "+col);
if (!(col.getRed()>=55&&col.getRed()<=90&& if (!(col.getRed()>=40&&col.getRed()<=90&&
col.getGreen()>=25&&col.getGreen()<=55&& col.getGreen()>=10&&col.getGreen()<=55&&
col.getBlue()>=55&&col.getBlue()<=90)) { col.getBlue()>=40&&col.getBlue()<=90)) {
//This is the max X. Calibration on this side good. //This is the max X. Calibration on this side good.
MyRobot.ENDDRAG.x--; MyRobot.ENDDRAG.x--;
System.out.println("End at "+MyRobot.STARTDRAG.x); System.out.println("End at "+MyRobot.STARTDRAG.x);
@ -196,9 +196,9 @@ public class Calibrator{
//ImageIO.write(miniImg,"png",new File("capture_4_"+System.nanoTime()+".png")); //ImageIO.write(miniImg,"png",new File("capture_4_"+System.nanoTime()+".png"));
Color col = new Color(miniImg.getRGB(0, 0)); Color col = new Color(miniImg.getRGB(0, 0));
System.out.println("Checking "+col); System.out.println("Checking "+col);
if (!(col.getRed()>=55&&col.getRed()<=90&& if (!(col.getRed()>=40&&col.getRed()<=90&&
col.getGreen()>=25&&col.getGreen()<=55&& col.getGreen()>=10&&col.getGreen()<=55&&
col.getBlue()>=55&&col.getBlue()<=90)) { col.getBlue()>=40&&col.getBlue()<=90)) {
//This is the max Y. Calibration on this side good. //This is the max Y. Calibration on this side good.
MyRobot.ENDDRAG.y--; MyRobot.ENDDRAG.y--;
System.out.println("End at "+MyRobot.ENDDRAG.y); System.out.println("End at "+MyRobot.ENDDRAG.y);
@ -290,9 +290,9 @@ public class Calibrator{
//ImageIO.write(miniImg,"png",new File("capture_3_"+System.nanoTime()+".png")); //ImageIO.write(miniImg,"png",new File("capture_3_"+System.nanoTime()+".png"));
Color col = new Color(miniImg.getRGB(0, 0)); Color col = new Color(miniImg.getRGB(0, 0));
System.out.println("Checking "+col); System.out.println("Checking "+col);
if ((col.getRed()>=55&&col.getRed()<=90&& if ((col.getRed()>=40&&col.getRed()<=90&&
col.getGreen()>=25&&col.getGreen()<=55&& col.getGreen()>=10&&col.getGreen()<=55&&
col.getBlue()>=55&&col.getBlue()<=90)) { col.getBlue()>=40&&col.getBlue()<=90)) {
//This is the max X. Calibration on this side good. //This is the max X. Calibration on this side good.
MyRobot.ENDDRAG.y=MyRobot.ENDDRAG.y-i; MyRobot.ENDDRAG.y=MyRobot.ENDDRAG.y-i;
MyRobot.ENDDRAG.x++; MyRobot.ENDDRAG.x++;
@ -323,9 +323,9 @@ public class Calibrator{
//ImageIO.write(miniImg,"png",new File("capture_4_"+System.nanoTime()+".png")); //ImageIO.write(miniImg,"png",new File("capture_4_"+System.nanoTime()+".png"));
Color col = new Color(miniImg.getRGB(0, 0)); Color col = new Color(miniImg.getRGB(0, 0));
System.out.println("Checking "+col); System.out.println("Checking "+col);
if ((col.getRed()>=55&&col.getRed()<=90&& if ((col.getRed()>=40&&col.getRed()<=90&&
col.getGreen()>=25&&col.getGreen()<=55&& col.getGreen()>=10&&col.getGreen()<=55&&
col.getBlue()>=55&&col.getBlue()<=90)) { col.getBlue()>=40&&col.getBlue()<=90)) {
MyRobot.ENDDRAG.x=MyRobot.ENDDRAG.x-i; MyRobot.ENDDRAG.x=MyRobot.ENDDRAG.x-i;
//This is the max Y. Calibration on this side good. //This is the max Y. Calibration on this side good.
System.out.println("End at "+MyRobot.ENDDRAG.y); System.out.println("End at "+MyRobot.ENDDRAG.y);

@ -91,9 +91,9 @@ public class DrawCanvas extends JPanel implements KeyListener,ComponentListener,
public void run() { public void run() {
while (true) { while (true) {
displayTimer++; displayTimer++;
MyRobot.p.repaint(0, 0, MyRobot.p.getWidth(),MyRobot.p.getHeight()); MyRobot.p.repaint();
try { try {
Thread.sleep(10000); Thread.sleep(1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -126,7 +126,7 @@ public class DrawCanvas extends JPanel implements KeyListener,ComponentListener,
artist = obj.getString("artist");*/ artist = obj.getString("artist");*/
if (MyRobot.p.songname!=null) { if (MyRobot.p.songname!=null) {
SongInfo currentSong = SongInfo.getByTitle(MyRobot.p.songname); SongInfo currentSong = SongInfo.getByTitle(MyRobot.p.songname);
FileUtils.writetoFile(new String[] {MyRobot.p.songname}, "testencode.txt"); //FileUtils.writetoFile(new String[] {MyRobot.p.songname}, "testencode.txt");
if (currentSong!=null) { if (currentSong!=null) {
if (currentSong.rating.has(difficulty)) { if (currentSong.rating.has(difficulty)) {
difficultyRating = currentSong.rating.getDouble(difficulty); difficultyRating = currentSong.rating.getDouble(difficulty);
@ -134,6 +134,7 @@ public class DrawCanvas extends JPanel implements KeyListener,ComponentListener,
romanizedname = currentSong.romanized_name; romanizedname = currentSong.romanized_name;
englishname = currentSong.english_name; englishname = currentSong.english_name;
artist = currentSong.artist; artist = currentSong.artist;
MyRobot.p.repaint();
JSONObject obj = FileUtils.readJsonFromUrl("http://45.33.13.215:4501/bestplay/"+MyRobot.USERNAME+"/"+URLEncoder.encode(MyRobot.p.songname, StandardCharsets.UTF_8.toString()).replaceAll("\\+", "%20")+"/"+difficulty); JSONObject obj = FileUtils.readJsonFromUrl("http://45.33.13.215:4501/bestplay/"+MyRobot.USERNAME+"/"+URLEncoder.encode(MyRobot.p.songname, StandardCharsets.UTF_8.toString()).replaceAll("\\+", "%20")+"/"+difficulty);
if (obj.has("cool")) { if (obj.has("cool")) {
bestPlay = new Result(MyRobot.p.songname,difficulty,obj.getInt("cool"),obj.getInt("fine"),obj.getInt("safe"),obj.getInt("sad"),obj.getInt("worst"),(float)obj.getDouble("percent")); bestPlay = new Result(MyRobot.p.songname,difficulty,obj.getInt("cool"),obj.getInt("fine"),obj.getInt("safe"),obj.getInt("sad"),obj.getInt("worst"),(float)obj.getDouble("percent"));

@ -129,7 +129,7 @@ public class MyRobot{
static Point STARTDRAG = null; static Point STARTDRAG = null;
static Point ENDDRAG = null; static Point ENDDRAG = null;
int lastcool,lastfine,lastsafe,lastsad,lastworst,lastcombo,lastscore; int lastcool=-1,lastfine=-1,lastsafe=-1,lastsad=-1,lastworst=-1,lastcombo=-1,lastscore=-1;
float lastpercent; float lastpercent;
boolean lastfail; boolean lastfail;
long lastSongSelectTime = System.currentTimeMillis(); long lastSongSelectTime = System.currentTimeMillis();
@ -294,7 +294,7 @@ public class MyRobot{
if (checkSongSelect()) { if (checkSongSelect()) {
if (!overlayHidden) { if (!overlayHidden) {
overlayHidden=true; overlayHidden=true;
p.repaint(0, 0, 1400, 1000); MyRobot.p.repaint();
} }
GetCurrentSong(); GetCurrentSong();
GetCurrentDifficulty(); GetCurrentDifficulty();
@ -318,7 +318,7 @@ public class MyRobot{
} else { } else {
if (overlayHidden) { if (overlayHidden) {
overlayHidden=false; overlayHidden=false;
p.repaint(0, 0, 1400, 1000); MyRobot.p.repaint();
} }
if ((selectedSong!=null && difficulty!=null)) { if ((selectedSong!=null && difficulty!=null)) {
if (OnResultsScreen() && !recordedResults && !recordingResults && results.size()==0) { if (OnResultsScreen() && !recordedResults && !recordingResults && results.size()==0) {
@ -480,8 +480,8 @@ public class MyRobot{
Color c2 = new Color(MYROBOT.createScreenCapture(new Rectangle(31,196,40,40)).getRGB(0, 0)); Color c2 = new Color(MYROBOT.createScreenCapture(new Rectangle(31,196,40,40)).getRGB(0, 0));
Color c3 = new Color(MYROBOT.createScreenCapture(new Rectangle(483,256,40,40)).getRGB(0, 0)); Color c3 = new Color(MYROBOT.createScreenCapture(new Rectangle(483,256,40,40)).getRGB(0, 0));
//System.out.println(c1+"/"+c2+"/"+c3); //System.out.println(c1+"/"+c2+"/"+c3);
return c1.getRed()>=254 && c1.getGreen()>=254 && c1.getBlue()>=254 && c2.getRed()==16 && c2.getGreen()==222 && c2.getBlue()==202 && return c1.getRed()>=250 && c1.getGreen()>=250 && c1.getBlue()>=250 && c2.getRed()>=10 && c2.getRed()<=25 && c2.getGreen()>=200 && c2.getGreen()<=240 && c2.getBlue()>=180 && c2.getBlue()<=220 &&
c3.getRed()>=219 && c3.getRed()<=255 && c3.getGreen()>=213 && c3.getGreen()<=255 && c3.getBlue()>=160 && c3.getBlue()<=220; c3.getRed()>=200 && c3.getRed()<=255 && c3.getGreen()>=200 && c3.getGreen()<=255 && c3.getBlue()>=140 && c3.getBlue()<=220;
} }
private void GetCurrentDifficulty() { private void GetCurrentDifficulty() {
@ -744,6 +744,7 @@ public class MyRobot{
RunTest("test29.png",354,112,4,3,43,67.73f,"EXEX","HS",55,331060,true); RunTest("test29.png",354,112,4,3,43,67.73f,"EXEX","HS",55,331060,true);
RunTest("test30.png",390,90,8,9,22,74.95f,"N","HS",82,326560,false); RunTest("test30.png",390,90,8,9,22,74.95f,"N","HS",82,326560,false);
RunTest("test31.png",329,69,8,1,34,72.15f,"EX","HS",40,358760,false); RunTest("test31.png",329,69,8,1,34,72.15f,"EX","HS",40,358760,false);
RunTest("test32.png",0,1,1,0,57,0.57f,"EX","HS",1,1890,true);
RunTest("testimage.png",371,40,3,4,3,97.63f,"EX","HS",233,523750,false); RunTest("testimage.png",371,40,3,4,3,97.63f,"EX","HS",233,523750,false);
RunTest("testimage2.png",942,71,1,0,3,97.02f,"EXEX","",714,951020,false); RunTest("testimage2.png",942,71,1,0,3,97.02f,"EXEX","",714,951020,false);
RunTest("testimage3.png",546,52,0,0,0,101.77f,"EX","",598,567430,false); RunTest("testimage3.png",546,52,0,0,0,101.77f,"EX","",598,567430,false);
@ -842,14 +843,14 @@ public class MyRobot{
public static boolean checkSongSelect() throws IOException { public static boolean checkSongSelect() throws IOException {
Color c = new Color(MYROBOT.createScreenCapture(new Rectangle(845,638,1,1)).getRGB(0, 0)); Color c = new Color(MYROBOT.createScreenCapture(new Rectangle(845,638,1,1)).getRGB(0, 0));
onSongSelect = (c.getRed()>=30 && c.getRed()<=45 && c.getGreen()>=85 && c.getGreen()<=90 && c.getBlue()>=205 && c.getBlue()<=230); onSongSelect = (c.getRed()>=15 && c.getRed()<=45 && c.getGreen()>=75 && c.getGreen()<=90 && c.getBlue()>=200 && c.getBlue()<=230);
if (onSongSelect) { if (onSongSelect) {
FUTURETONE=false; FUTURETONE=false;
} else } else
{ {
c = new Color(MYROBOT.createScreenCapture(new Rectangle(743,173,1,1)).getRGB(0, 0)); c = new Color(MYROBOT.createScreenCapture(new Rectangle(743,173,1,1)).getRGB(0, 0));
if (!onSongSelect&&(c.getRed()>=165&&c.getRed()<=185&&c.getGreen()<=10&&c.getBlue()>=185&&c.getBlue()<=200)) { if (!onSongSelect&&(c.getRed()>=160&&c.getRed()<=185&&c.getGreen()<=15&&c.getBlue()>=170&&c.getBlue()<=200)) {
FUTURETONE=true; FUTURETONE=true;
onSongSelect=true; onSongSelect=true;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Loading…
Cancel
Save