Skip to content
Snippets Groups Projects
Commit 45514dd8 authored by Aylen Ricca's avatar Aylen Ricca
Browse files

show chessboard reconstruction fixed

parent 74a9d9f8
No related branches found
No related tags found
No related merge requests found
package uy.edu.fing.chesstrack.modulomodelador;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import uy.edu.fing.chesstrack.modulovision.Calibracion;
import android.util.Log;
......@@ -42,8 +44,8 @@ public class Modelador {
int anchoEscaque = (int) Math.floor(ancho /(CANT_FILAS+2) );
Log.i(TAG, "largoEscaque= " + largoEscaque);
Log.i(TAG, "anchoEscaque= " + anchoEscaque);
for (int i = 0; i < 1; i++){
for (int j = 0; j < 1; j++){
for (int i = 0; i < CANT_FILAS; i++){
for (int j = 0; j < CANT_FILAS; j++){
int rowStart=(int)Math.floor(largoEscaque)+ i*largoEscaque;
int rowEnd = (int)Math.floor(largoEscaque)+i*largoEscaque + largoEscaque;
int colStart = (int)Math.floor(anchoEscaque)+j*anchoEscaque;
......@@ -57,14 +59,15 @@ public class Modelador {
Mat tmp = Mat.ones(Calibracion.getInstance().getImagenCalibrada().size(), CvType.CV_8UC4);
Mat subm ; //tmp.submat(new Rect(new Point(0,0) ,escaques[i][j].size()));
//escaques[i][j].copyTo(subm);
int pos_x = 15;
int pos_y = 15;
for (int i = 0; i < 1; i++){
for (int j = 0; j < 1; j++){
int pos_x = 0;
int pos_y = 0;
for (int i = 0; i < CANT_FILAS; i++){
for (int j = 0; j < CANT_FILAS; j++){
pos_x = (int) (escaques[i][j].size().width*i);
pos_y = (int) (escaques[i][j].size().height*j);
subm = tmp.submat(new Rect(new Point(pos_x,pos_y) ,escaques[i][j].size()));
escaques[i][j].copyTo(subm);
pos_x = (int) (escaques[i][j].size().width*i +1);
pos_y = (int) (escaques[i][j].size().height*j +1);
Core.putText(tmp, Integer.toString(i)+ "-" +Integer.toString(j), new Point(pos_x+1, pos_y+1),Core.FONT_HERSHEY_SIMPLEX, 0.3 , new Scalar(255,0,0));
}
}
return tmp;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment