Added point drawing
This commit is contained in:
parent
feefe1b0a6
commit
c58d0e0971
|
@ -9,8 +9,8 @@ AigoQt::AigoQt(QWidget *parent)
|
|||
cam = new Quickcam("/dev/video0");
|
||||
|
||||
timer = new QTimer(this);
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(updateImage()));
|
||||
timer->start(2000);
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(on_buttonDrawPoints_clicked()));
|
||||
timer->start(200);
|
||||
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ void AigoQt::updateImage( void )
|
|||
cam->update();
|
||||
SDL_Surface *s = cam->getSurface();
|
||||
image->setPixmap(QPixmap::fromImage(QImage((uchar*)s->pixels, s->w, s->h, QImage::Format_RGB32)));
|
||||
on_buttonGenerateState_clicked();
|
||||
}
|
||||
|
||||
void AigoQt::on_buttonSetCorners_clicked( void )
|
||||
|
@ -53,12 +54,13 @@ void AigoQt::on_sliderWhite_valueChanged( int value)
|
|||
|
||||
void AigoQt::on_buttonDrawPoints_clicked( void )
|
||||
{
|
||||
updateImage();
|
||||
for (int i = 0; i < 19; i++)
|
||||
{
|
||||
for (int j = 0; j < 19; j++)
|
||||
{
|
||||
point p = State::positionPoint(i, j, settings);
|
||||
((uint8_t*)cam->getSurface()->pixels)[(p.y*640 + p.x) * 4] = 0xff000000;
|
||||
((uint32_t*)cam->getSurface()->pixels)[p.y*640 + p.x] = 0xffff0000;
|
||||
}
|
||||
}
|
||||
SDL_Surface *s = cam->getSurface();
|
||||
|
|
178
qt/main.ui
178
qt/main.ui
|
@ -6,7 +6,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>880</width>
|
||||
<height>684</height>
|
||||
<height>728</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
|
@ -20,7 +20,100 @@
|
|||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<item row="0" column="0" colspan="2" >
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>700</width>
|
||||
<height>550</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<widget class="ClickableLabel" name="image" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>40</y>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string>White threshold</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Black threshold</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" >
|
||||
<widget class="QLCDNumber" name="lcdNumber_2" />
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QSlider" name="sliderBlack" >
|
||||
<property name="minimum" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QLCDNumber" name="lcdNumber" />
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QSlider" name="sliderWhite" >
|
||||
<property name="minimum" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="singleStep" >
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="pageStep" >
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
|
@ -77,85 +170,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QSlider" name="sliderWhite" >
|
||||
<property name="minimum" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="singleStep" >
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="pageStep" >
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>700</width>
|
||||
<height>550</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<widget class="ClickableLabel" name="image" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>40</y>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLCDNumber" name="lcdNumber" />
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QSlider" name="sliderBlack" >
|
||||
<property name="minimum" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QLCDNumber" name="lcdNumber_2" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar" >
|
||||
|
@ -164,7 +178,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>880</width>
|
||||
<height>25</height>
|
||||
<height>29</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_File" >
|
||||
|
|
Reference in New Issue