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

fixed get escaque

parent 3da089f0
No related branches found
No related tags found
No related merge requests found
......@@ -38,29 +38,29 @@ public class Modelador {
int largo = proccesFrame.rows();
int ancho = proccesFrame.cols();
// obtengo cuanto mide en ancho y largo un escaque
int largoEscaque = (int) Math.floor(largo /(CANT_FILAS+1) );//+1 porque se toma un escaque mas de borde
int anchoEscaque = (int) Math.floor(ancho /(CANT_FILAS+1) );
int largoEscaque = (int) Math.floor(largo /(CANT_FILAS+2) );//+1 porque se toma un escaque mas de borde
int anchoEscaque = (int) Math.floor(ancho /(CANT_FILAS+2) );
Log.i(TAG, "largoEscaque= " + largoEscaque);
Log.i(TAG, "anchoEscaque= " + anchoEscaque);
for (int i = 0; i < CANT_FILAS; i++){
for (int j = 0; j < CANT_FILAS; j++){
int rowStart=(int)Math.floor(largoEscaque/2)+ i*largoEscaque +2;
int rowEnd = (int)Math.floor(largoEscaque/2)+i*largoEscaque + largoEscaque -2;
int colStart = (int)Math.floor(anchoEscaque/2)+j*anchoEscaque + 2;
int colEnd = (int)Math.floor(anchoEscaque/2)+j*anchoEscaque + anchoEscaque - 2;;
escaques[i][j]= inputFrame.submat(rowStart, rowEnd, colStart, colEnd);
for (int i = 0; i < 1; i++){
for (int j = 0; j < 1; 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;
int colEnd = (int)Math.floor(anchoEscaque)+j*anchoEscaque + anchoEscaque;
escaques[i][j]= inputFrame.submat(colStart, colEnd,rowStart, rowEnd);
}
}
}
public Mat dibujarEscaque(){
Mat tmp = Mat.zeros(Calibracion.getInstance().getImagenCalibrada().size(), CvType.CV_8UC4);
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 = 0;
int pos_y = 0;
for (int i = 0; i < CANT_FILAS; i++){
for (int j = 0; j < CANT_FILAS; j++){
int pos_x = 15;
int pos_y = 15;
for (int i = 0; i < 1; i++){
for (int j = 0; j < 1; 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);
......
......@@ -24,7 +24,7 @@ public class Homografia implements ImgProcInterface {
if (vertices != null){
Mat src = new Mat(4,1,CvType.CV_32FC2);
Mat dst = new Mat(4,1,CvType.CV_32FC2);
offset = (media/7);
Point p1, p2, p3, p4;
Point[] ret = getBestPoints(vertices, Calibracion.getInstance().getImagenCalibrada().size());
Log.i(TAG, "coso= " + ret);
......@@ -38,7 +38,7 @@ public class Homografia implements ImgProcInterface {
double d4349 = Math.sqrt(Math.pow((p4.x- p1.x),2) + Math.pow((p4.y- p1.y),2));
media = (int) Math.floor( Math.round((d17+d749+d143+d4349)/4));
offset = 2*(media/7);
offset = 2*(media/6);
src.put(0,0 ,(int)p1.x,(int)p1.y, (int)p2.x,(int)p2.y, (int)p3.x,(int)p3.y, (int)p4.x,(int)p4.y);
dst.put(0,0, offset,offset ,offset+media,offset , offset+media,offset+media, offset,offset+media );
......
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