Commit 60722216 authored by Aylen Ricca's avatar Aylen Ricca
Browse files

a lot of debug msg

parent c7ea9d45
......@@ -114,7 +114,7 @@ struct blob* vision_cls_getNextFrame(unsigned short int force_frame) {
blobs = iVisionModule_getNextFrame(HaViMo_id);
}
} else {
if(blobs == NULL) return NULL;
if(blobs == NULL) { printf("null blobs\n"); return NULL; }
}
//Preprocesamiento del array de blobs
......@@ -123,17 +123,20 @@ struct blob* vision_cls_getNextFrame(unsigned short int force_frame) {
unsigned short int blobs_merged;
do {
blobs_merged = 0;
for(i = 0; i < CANT_REGIONS; i++) {
if(blobs[i].region_index != INVALID_REGION) {
for(i = 0; i < CANT_REGIONS; i++) {
printf("procesar\n");
if(blobs[i].region_index != INVALID_REGION) {
printf("no es invalida\n");
if(blobs[i].max_x - blobs[i].min_x <= MIN_PX_SIZE_FOR_BLOB || blobs[i].max_y - blobs[i].min_y <= MIN_PX_SIZE_FOR_BLOB) {
//Invalidamos el blob
//Invalidamos el blob
printf("invalido blobs\n");
blobs[i].region_index = INVALID_REGION;
} else {
for(j = i + 1; j < CANT_REGIONS; j++) {
if(blobs[j].region_index != INVALID_REGION && blobs[i].region_color == blobs[j].region_color &&
vision_cla_canBlobsBeMerged(blobs[i], blobs[j], THRESHOLD_X, THRESHOLD_Y)) {
vision_cla_canBlobsBeMerged(blobs[i], blobs[j], THRESHOLD_X, THRESHOLD_Y)) {
//Se combinan los blobs
printf("blobs combinados\n");
blobs[j].region_index = INVALID_REGION;
if(blobs[i].max_x < blobs[j].max_x)
......@@ -151,7 +154,7 @@ struct blob* vision_cls_getNextFrame(unsigned short int force_frame) {
}
}
}
}
} else printf("es invalida\n");
}
} while(blobs_merged);
......
......@@ -13,6 +13,6 @@ int main() {
return -1;
vision_checkVision(0);
vision_terminate();
printf("FINAL FELIZ...");
printf("FINAL FELIZ...\n");
return 0;
}
......@@ -34,8 +34,8 @@ int frameNumber;
//cv::Scalar calibsMAX [] = {cv::Scalar(24,249,125),cv::Scalar(113,132,58),cv::Scalar(15,226,184),cv::Scalar(179,187,102)};
// AMARILLO - AZUL - NARANJA - MAGENTA -cam CSI
cv::Scalar calibsMIN [] = {cv::Scalar(16,106,145),cv::Scalar(121,83,46),cv::Scalar(13,229,75),cv::Scalar(-4,172,42)};
cv::Scalar calibsMAX [] = {cv::Scalar(110,247,254),cv::Scalar(136,116,73),cv::Scalar(19,255,241),cv::Scalar(11,255,145)};
cv::Scalar calibsMIN [] = {cv::Scalar(9,156,44),cv::Scalar(121,83,46),cv::Scalar(13,229,75),cv::Scalar(-4,172,42)};
cv::Scalar calibsMAX [] = {cv::Scalar(17,245,124),cv::Scalar(121,83,46),cv::Scalar(13,229,75),cv::Scalar(-4,172,42)};
/**
* Inicializa las estructuras que utiliza. Carga archivo de configuracion
......@@ -132,7 +132,7 @@ struct blob fillZeros(){
res.min_x = (unsigned int) 0;
res.max_y = (unsigned int) 0;
res.min_y = (unsigned int) 0;
/*
printf("===== START DEBUG =====\n");
printf("reg_idx: %u\n", res.region_index);
printf("reg_col: %u\n", res.region_color);
......@@ -144,15 +144,15 @@ struct blob fillZeros(){
printf("maxim_y: %u\n", res.max_y);
printf("minim_y: %u\n", res.min_y);
printf("===== FIN DEBUG =====\n");
*/
return res;
}
struct blob infoToBlob(CvBlob info, unsigned int region_idx){
struct blob res;
res.region_index = MY_GOAL_REGION;
res.region_color = region_idx;
res.region_index = region_idx+1;
res.region_color = BALL_REGION;
res.number_of_pixels = info.area;
res.sum_of_x_coord_high = 0;
......@@ -165,7 +165,7 @@ struct blob infoToBlob(CvBlob info, unsigned int region_idx){
res.min_x = info.minx;
res.max_y = info.maxy;
res.min_y = info.miny;
/*
printf("===== START DEBUG =====\n");
printf("reg_idx: %u\n", res.region_index);
printf("reg_col: %u\n", res.region_color);
......@@ -177,7 +177,7 @@ struct blob infoToBlob(CvBlob info, unsigned int region_idx){
printf("maxim_y: %u\n", res.max_y);
printf("minim_y: %u\n", res.min_y);
printf("===== FIN DEBUG =====\n");
*/
return res;
}
......@@ -217,7 +217,7 @@ void utilBlobs_getBlobs(struct blob* result){
CvBlobs blobsitos;
for (int i=0; i < CANT_CALIBRACIONES; i++){
IplImage *labelImg = cvCreateImage(cvGetSize(frame), IPL_DEPTH_LABEL, 1);
getOneColorBlobs(hsv, labelImg, blobsitos, imgSize, calibsMIN[i], calibsMAX[i]);
getOneColorBlobs(hsv, labelImg, blobsitos, imgSize, calibsMIN[0], calibsMAX[0]);
cvRenderBlobs(labelImg, blobsitos, frame, frame, CV_BLOB_RENDER_BOUNDING_BOX);
CvBlobs::const_iterator it = blobsitos.begin();
......
......@@ -56,7 +56,8 @@ void vision_setRobotHeight(double height) {
void processBlobs(void) {
//Identificamos la bola
vision_objRec_detectBall();
unsigned short int hayPelota = vision_objRec_detectBall();
printf("PELOTA = %d\n");
//Identificamos los agentes
vision_objRec_detectAllies();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment