public static void main(String args[]) {
        abTrajectory ar = new abTrajectory();

        ImageSegFrame frame = null;
        GameStateExtractor gameStateExtractor = new GameStateExtractor();
        TrajectoryPlanner trajectory = new TrajectoryPlanner();

        while (true) {
            // capture image
            BufferedImage screenshot = ar.doScreenShot();
            final int nHeight = screenshot.getHeight();
            final int nWidth = screenshot.getWidth();

            System.out.println("captured image of size " + nWidth + "-by-" + nHeight);

            // extract game state
            GameStateExtractor.GameState state = gameStateExtractor.getGameState(screenshot);
            if (state != GameStateExtractor.GameState.PLAYING) {
                continue;
            }

            // process image
            VisionMBR vision = new VisionMBR(screenshot);
            List<Rectangle> pigs = vision.findPigsMBR();
            List<Rectangle> redBirds = vision.findRedBirdsMBRs();

            Rectangle sling = vision.findSlingshotMBR();
            if (sling == null) {
                System.out.println("...could not find the slingshot");
                continue;
            }
           // System.out.println("...found " + pigs.size() + " pigs and " + redBirds.size() + " birds");
            System.out.println("...found slingshot at " + sling.toString());

            // convert screenshot to grey scale and draw bounding boxes
            screenshot = VisionUtils.convert2grey(screenshot);
            VisionUtils.drawBoundingBoxes(screenshot, pigs, Color.GREEN);
            VisionUtils.drawBoundingBoxes(screenshot, redBirds, Color.PINK);
            VisionUtils.drawBoundingBox(screenshot, sling, Color.ORANGE);

            // find active bird
            Rectangle activeBird = trajectory.findActiveBird(redBirds);
            if (activeBird == null) {
                System.out.println("...could not find active bird");
                continue;
            }

            trajectory.plotTrajectory(screenshot, sling, activeBird);

            // show image
            if (frame == null) {
                frame = new ImageSegFrame("trajectory", screenshot);
            } else {
                frame.refresh(screenshot);
            }

            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
            }
        }
    }