38 #include <visp3/ustk_gui/usImageDisplayWidgetRobotControl.h>
40 #if (defined(USTK_HAVE_VTK_QT) || defined(USTK_HAVE_QT5))
47 m_confidenceServoingButton(), m_useFeatureDisplay(false), m_confidence(), m_plot(), m_startTime()
49 this->setMinimumSize(200, 200);
51 m_controlArrowsActivated =
false;
52 m_leftArrow.setParent(
this);
53 m_rightArrow.setParent(
this);
54 m_confidenceServoingButton.setParent(
this);
56 m_leftArrow.setText(QString(
"\u25C0"));
57 m_rightArrow.setText(QString(
"\u25B6"));
58 m_leftArrow.setVisible(
false);
59 m_rightArrow.setVisible(
false);
61 m_confidenceServoingButton.setText(QString(
"\u21BB"));
62 m_confidenceServoingButton.setVisible(
true);
63 m_confidenceServoingButton.setCheckable(
true);
64 m_confidenceServoingButton.setChecked(
false);
65 m_confidenceServoingButton.setAutoFillBackground(
true);
66 QPalette pal = m_confidenceServoingButton.palette();
67 pal.setColor(QPalette::Button, QColor(Qt::green));
68 m_confidenceServoingButton.setPalette(pal);
69 m_confidenceServoingButton.update();
71 #if defined(VISP_HAVE_GDI)
72 m_display =
new vpDisplayGDI;
73 #elif defined(VISP_HAVE_OPENCV)
74 m_display =
new vpDisplayOpenCV;
77 connect(&m_leftArrow, SIGNAL(pressed()),
this, SIGNAL(
moveLeft()));
78 connect(&m_rightArrow, SIGNAL(pressed()),
this, SIGNAL(
moveRight()));
79 connect(&m_leftArrow, SIGNAL(released()),
this, SIGNAL(
stopMove()));
80 connect(&m_rightArrow, SIGNAL(released()),
this, SIGNAL(
stopMove()));
96 m_QImage = QImage(img.bitmap, img.getWidth(), img.getHeight(), img.getWidth(), QImage::Format_Indexed8);
97 QImage I =
m_QImage.convertToFormat(QImage::Format_RGB888);
98 I = I.scaled(this->width(), this->height());
103 if (m_controlArrowsActivated)
116 QImage::Format_Indexed8);
118 m_QImage = QImage(img.bitmap, img.getWidth(), img.getHeight(), img.getWidth(), QImage::Format_Indexed8);
120 QImage I =
m_QImage.convertToFormat(QImage::Format_RGB888);
121 I = I.scaled(this->width(), this->height());
126 if (m_controlArrowsActivated)
130 if (m_useFeatureDisplay) {
131 #if (defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV))
132 if (m_confidence.getSize() > 0) {
133 if (m_confidence.display == NULL)
134 m_display->init(m_confidence);
135 vpDisplay::display(m_confidence);
143 m_label->resize(event->size());
144 QImage I =
m_QImage.convertToFormat(QImage::Format_RGB888);
145 I = I.scaled(this->width(), this->height());
150 m_confidenceServoingButton.setGeometry((this->width() / 2) - m_confidenceServoingButton.size().width() / 2, 10, 40,
152 m_confidenceServoingButton.raise();
154 if (m_controlArrowsActivated)
160 m_controlArrowsActivated =
true;
162 m_leftArrow.setVisible(
true);
163 m_rightArrow.setVisible(
true);
164 m_leftArrow.setGeometry(10, (this->height() / 2) - m_leftArrow.size().height() / 2, 40, 40);
165 m_rightArrow.setGeometry(this->width() - 50, (this->height() / 2) - m_rightArrow.size().height() / 2, 40, 40);
167 m_rightArrow.raise();
172 m_controlArrowsActivated =
false;
180 QPalette pal = m_confidenceServoingButton.palette();
181 pal.setColor(QPalette::Button, QColor(Qt::red));
182 m_confidenceServoingButton.setPalette(pal);
183 m_confidenceServoingButton.update();
185 QPalette pal = m_confidenceServoingButton.palette();
186 pal.setColor(QPalette::Button, QColor(Qt::green));
187 m_confidenceServoingButton.setPalette(pal);
188 m_confidenceServoingButton.update();
196 m_useFeatureDisplay =
true;
199 m_plot.initGraph(0, 1);
200 m_plot.setTitle(0,
"confidence barycenter error");
201 m_plot.setUnitY(0,
"error");
202 m_plot.setLegend(0, 0,
"time");
203 m_startTime = vpTime::measureTimeMs();
210 #if (defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV))
211 if (m_useFeatureDisplay) {
212 vpImagePoint p0 = vpImagePoint(0, sanline);
213 vpImagePoint p1 = vpImagePoint(m_confidence.getHeight() - 1, sanline);
214 vpImagePoint p2 = vpImagePoint(0, m_confidence.getWidth() / 2);
215 vpImagePoint p3 = vpImagePoint(m_confidence.getHeight() - 1, m_confidence.getWidth() / 2);
216 vpDisplay::displayLine(m_confidence, p0, p1, vpColor::red);
217 vpDisplay::displayLine(m_confidence, p2, p3, vpColor::green);
218 vpDisplay::flush(m_confidence);
221 m_plot.plot(0, 0, vpTime::measureTimeMs() - m_startTime,
229 m_confidence = confidence;
void convert(const usImagePreScan2D< unsigned char > &preScanImage, usImagePostScan2D< unsigned char > &postScanImage, double xResolution=0., double yResolution=0.)
double getFieldOfView() const
double getScanLinePitch() const