Search in sources :

Example 1 with CornerDetector

use of br.edu.ifspsaocarlos.sdm.kifurecorder.processing.cornerDetector.CornerDetector in project kifu-recorder by leonardost.

the class RecordGameActivity method initializeProcessing.

private void initializeProcessing() {
    Intent i = getIntent();
    String blackPlayer = i.getStringExtra("blackPlayer");
    String whitePlayer = i.getStringExtra("whitePlayer");
    String komi = i.getStringExtra("komi");
    boardDimension = i.getIntExtra("boardDimension", -1);
    int[] foundBoardCorners = i.getIntArrayExtra("boardPositionInImage");
    stoneDetector.setBoardDimension(boardDimension);
    game = new Game(boardDimension, blackPlayer, whitePlayer, komi);
    lastDetectedBoard = new Board(boardDimension);
    timeOfLastBoardDetection = SystemClock.elapsedRealtime();
    timeSinceLastBoardChange = 0;
    timeOfLastImageProcessing = SystemClock.elapsedRealtime();
    originalBoardCorners = new Corner[4];
    originalBoardCorners[0] = new Corner(foundBoardCorners[0], foundBoardCorners[1]);
    originalBoardCorners[1] = new Corner(foundBoardCorners[2], foundBoardCorners[3]);
    originalBoardCorners[2] = new Corner(foundBoardCorners[4], foundBoardCorners[5]);
    originalBoardCorners[3] = new Corner(foundBoardCorners[6], foundBoardCorners[7]);
    boardCorners = new Corner[4];
    boardCorners[0] = new Corner(foundBoardCorners[0], foundBoardCorners[1]);
    boardCorners[1] = new Corner(foundBoardCorners[2], foundBoardCorners[3]);
    boardCorners[2] = new Corner(foundBoardCorners[4], foundBoardCorners[5]);
    boardCorners[3] = new Corner(foundBoardCorners[6], foundBoardCorners[7]);
    cornerDetector = new CornerDetector[4];
    for (int cornerIndex = 0; cornerIndex < 4; cornerIndex++) {
        cornerDetector[cornerIndex] = new CornerDetector();
        cornerDetector[cornerIndex].setCorner(boardCorners[cornerIndex]);
        cornerDetector[cornerIndex].setCornerIndex(cornerIndex + 1);
    }
    processBoardCorners();
}
Also used : Game(br.edu.ifspsaocarlos.sdm.kifurecorder.models.Game) Board(br.edu.ifspsaocarlos.sdm.kifurecorder.models.Board) Corner(br.edu.ifspsaocarlos.sdm.kifurecorder.processing.cornerDetector.Corner) Intent(android.content.Intent) Point(org.opencv.core.Point) MatOfPoint(org.opencv.core.MatOfPoint) CornerDetector(br.edu.ifspsaocarlos.sdm.kifurecorder.processing.cornerDetector.CornerDetector)

Aggregations

Intent (android.content.Intent)1 Board (br.edu.ifspsaocarlos.sdm.kifurecorder.models.Board)1 Game (br.edu.ifspsaocarlos.sdm.kifurecorder.models.Game)1 Corner (br.edu.ifspsaocarlos.sdm.kifurecorder.processing.cornerDetector.Corner)1 CornerDetector (br.edu.ifspsaocarlos.sdm.kifurecorder.processing.cornerDetector.CornerDetector)1 MatOfPoint (org.opencv.core.MatOfPoint)1 Point (org.opencv.core.Point)1