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

solved homog. resol

parent 77ca8393
No related branches found
No related tags found
No related merge requests found
......@@ -133,7 +133,7 @@ public class ChessTrackActivity extends Activity implements
int port = Integer.parseInt(value.toString());
Log.i(TAG, "PORT=" + port);
_manager.setConnection(ip, port);
//_manager.setConnection(ip, port);
}
}
});
......
......@@ -6,6 +6,8 @@ import org.opencv.core.Mat;
import org.opencv.core.Size;
public class Logica {
private static final String TAG = "CHESSTRACK::Logica";
private Mat _tableroInicio;
private Mat _tableroAnterior;
......@@ -26,7 +28,7 @@ public class Logica {
public boolean validarNuevoTablero(Mat actual) {
Mat result = new Mat(8, 8, CvType.CV_8UC1);
Core.absdiff(actual, _tableroAnterior, result);
if (Core.countNonZero(result) == 0) {
if (Core.countNonZero(result) != 0) {
_tableroAnterior = actual;
}
return (Core.countNonZero(result) != 0);
......
......@@ -133,8 +133,8 @@ public class Manager {
if (_logica.validarNuevoTablero(aux)) {
if (_salida == OK) {
_client.SendData("Nuevo Tablero Valido = \n"
+ String.valueOf(_cantJugada));
_client.SendData("Nuevo Tablero Valido = ["
+ String.valueOf(_cantJugada) + "]\n");
_cantJugada++;
_client.SendData(" ".concat(aux.dump().concat("\n")));
}
......
......@@ -72,11 +72,20 @@ public class Homografia implements ImgProcInterface {
@Override
public Mat procesarImagen(Mat inputFrame) {
Log.i(TAG, "processing Frame - INI");
double x = inputFrame.size().width;
double y = inputFrame.size().height;
if (x < _rectROI.size().width){
x = _rectROI.size().width;
}
if (y < _rectROI.size().height){
y = _rectROI.size().height;
}
Mat aux = new Mat();
// hace la homografia con la matriz calculada en un ppio
Imgproc.warpPerspective(inputFrame,inputFrame, _matrizTransformada, inputFrame.size());
Imgproc.warpPerspective(inputFrame,aux, _matrizTransformada, new Size(x,y));
Mat tmp = Mat.zeros(_rectROI.size(), CvType.CV_8UC4);
(inputFrame.submat(_rectROI)).copyTo(tmp);
(aux.submat(_rectROI)).copyTo(tmp);
Log.i(TAG, "processing Frame - FIN");
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