From f1bf7de14248438262225c3825fe8356e5d67762 Mon Sep 17 00:00:00 2001 From: Franco Zavala E Date: Sun, 18 Dec 2011 11:45:32 -0600 Subject: [PATCH] ultimo comit con mas efectos, conecciones y desconecciones... --- camara.cpp | 40 ++++++++++++++++++++++++++++++++++++++-- camara.h | 1 + mainwindow.cpp | 15 +++++++++++++++ mainwindow.h | 2 ++ mainwindow.ui | 15 +++++++++++---- 5 files changed, 67 insertions(+), 6 deletions(-) diff --git a/camara.cpp b/camara.cpp index 0736a86..e4e7ea1 100644 --- a/camara.cpp +++ b/camara.cpp @@ -73,7 +73,8 @@ void camara::guardImagen(const QString &nombre) String ruta("/tmp/"); ruta += nombre.toStdString(); cap >> fram; - imwrite(ruta,fram); + imwrite(ruta,fram); // tengo que aprender a guardar la QPixmap !!! + } } @@ -188,7 +189,7 @@ void camara::newQEXTframe() newpixG = qGreen(col); newpixB = qBlue(col); - if ((newpixR<155) & (newpixG>115) & (newpixB<146)) //aqui pregunta si el rojo y azul estan en niveles bajos + if (((newpixR>=42) && (newpixR<=75) ) && (newpixG>50) && (newpixB>=25 && newpixB<=65)) //aqui pregunta si el rojo y azul estan en niveles bajos imag.setPixel(i, j, fond.pixel(i,j)); //aqui debe poner el fondo.pixel(i,j) donde fondo es la imagen con la misma resolucion que la camara } } @@ -198,6 +199,41 @@ void camara::newQEXTframe() } } +void camara::newQEP1frame() +{ + if (errorid == 0) + { + Mat rgb; + cap >> fram; + cvtColor(fram, rgb, CV_BGR2RGB); + + QImage imag((const unsigned char*)(rgb.data), rgb.cols, rgb.rows, QImage::Format_RGB888); + + QRgb col; + int newpixR,newpixG,newpixB; + int width = imag.width(); + int height = imag.height(); + for (int i = 0; i < width; ++i) + { + for (int j = 0; j < height; ++j) + { + col = imag.pixel(i, j); + newpixR = qRed(col); + newpixG = qGreen(col); + newpixB = qBlue(col); + + if ((newpixR >= 60) && (newpixR <= 150) && (newpixG <= 40) && (newpixG >= 30) && + (newpixB >= 30) && (newpixB <= 45)) //aqui pregunta si el rojo y azul estan en niveles bajos + imag.setPixel(i, j, qRgb(newpixR, newpixG*2, newpixB)); + } + } + + //imag.invertPixels(); + camlabe->setPixmap(QPixmap::fromImage(imag.mirrored(true,false))); + mipix = QPixmap::fromImage(imag.mirrored(true,false)); + } +} + void camara::relacam() { if (errorid != 1) diff --git a/camara.h b/camara.h index 44455ee..de6609b 100644 --- a/camara.h +++ b/camara.h @@ -37,6 +37,7 @@ public slots: void newQBWframe(); void newQINframe(); void newQEXTframe(); + void newQEP1frame(); void relacam(); void opencam(); int geterror(); diff --git a/mainwindow.cpp b/mainwindow.cpp index 76ab529..a231862 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -371,3 +371,18 @@ void MainWindow::on_extrafond_clicked(bool checked) connect(timeer, SIGNAL(timeout()), camaru, SLOT(newQEXTframe())); } } + +void MainWindow::on_experimento1_clicked(bool checked) +{ + if (checked==true) + { + //desconecciones + disconnect(timeer, SIGNAL(timeout()), camaru, SLOT(newQBWframe())); + disconnect(timeer, SIGNAL(timeout()), camaru, SLOT(newQframe())); + disconnect(timeer, SIGNAL(timeout()), camaru, SLOT(newQEXTframe())); + disconnect(timeer, SIGNAL(timeout()), camaru, SLOT(newQEXTframe())); + + //coneccion + connect(timeer, SIGNAL(timeout()), camaru, SLOT(newQEP1frame())); + } +} diff --git a/mainwindow.h b/mainwindow.h index 6a4d413..d454959 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -42,6 +42,8 @@ private slots: void on_extrafond_clicked(bool checked); + void on_experimento1_clicked(bool checked); + private: Ui::MainWindow *ui; MiLabel* foto1; diff --git a/mainwindow.ui b/mainwindow.ui index 177cb82..2d37f29 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 1194 - 831 + 784 @@ -635,7 +635,7 @@ background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0.113122 rg 0 0 245 - 670 + 623 @@ -669,7 +669,14 @@ background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0.113122 rg - Extraer fondo + Con Fondo + + + + + + + Experimento1 @@ -681,7 +688,7 @@ background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0.113122 rg 0 0 245 - 670 + 623 -- 2.11.4.GIT