added color maps still working on interface

This commit is contained in:
lostjared
2018-03-17 17:58:16 -07:00
parent a6dd1c70bc
commit c2a893c0a7
4 changed files with 42 additions and 9 deletions

View File

@@ -122,7 +122,7 @@ void AC_MainWindow::createControls() {
connect(btn_moveup, SIGNAL(clicked()), this, SLOT(upClicked()));
connect(btn_movedown, SIGNAL(clicked()), this, SLOT(downClicked()));
QLabel *r_label = new QLabel("Red: ", this);
QLabel *r_label = new QLabel(tr("Red: "), this);
r_label->setGeometry(10, 255, 50, 20);
slide_r = new QSlider(Qt::Horizontal,this);
slide_r->setGeometry(40, 250, 100, 30);
@@ -130,7 +130,7 @@ void AC_MainWindow::createControls() {
slide_r->setMinimum(0);
slide_r->setTickInterval(0);
QLabel *g_label = new QLabel("Green: ", this);
QLabel *g_label = new QLabel(tr("Green: "), this);
g_label->setGeometry(150, 255, 50, 20);
slide_g = new QSlider(Qt::Horizontal, this);
slide_g->setGeometry(190, 250, 100, 30);
@@ -138,7 +138,7 @@ void AC_MainWindow::createControls() {
slide_g->setMinimum(0);
slide_g->setTickInterval(0);
QLabel *b_label = new QLabel("Blue: ", this);
QLabel *b_label = new QLabel(tr("Blue: "), this);
b_label->setGeometry(300, 255, 50, 20);
slide_b = new QSlider(Qt::Horizontal, this);
slide_b->setGeometry(330, 250, 100, 30);
@@ -150,7 +150,7 @@ void AC_MainWindow::createControls() {
connect(slide_g, SIGNAL(valueChanged(int)), this, SLOT(slideChanged(int)));
connect(slide_b, SIGNAL(valueChanged(int)), this, SLOT(slideChanged(int)));
QLabel *label_slide_bright = new QLabel("Brightness: ", this);
QLabel *label_slide_bright = new QLabel(tr("Brightness: "), this);
label_slide_bright->setGeometry(10, 280, 75, 20);
slide_bright = new QSlider(Qt::Horizontal, this);
slide_bright->setGeometry(80, 275, 100, 30);
@@ -159,7 +159,7 @@ void AC_MainWindow::createControls() {
slide_bright->setTickInterval(0);
QLabel *label_slide_gamma = new QLabel("Gamma: ", this);
QLabel *label_slide_gamma = new QLabel(tr("Gamma: "), this);
label_slide_gamma->setGeometry(190, 280, 65, 20);
slide_gamma = new QSlider(Qt::Horizontal, this);
slide_gamma->setGeometry(245, 275, 100, 30);
@@ -167,7 +167,7 @@ void AC_MainWindow::createControls() {
slide_gamma->setMinimum(0);
slide_gamma->setTickInterval(0);
QLabel *label_sat = new QLabel("Saturation: ", this);
QLabel *label_sat = new QLabel(tr("Saturation: "), this);
label_sat->setGeometry(350, 280, 100, 20);
slide_saturation = new QSlider(Qt::Horizontal, this);
slide_saturation->setGeometry(420, 275, 100, 30);
@@ -179,6 +179,27 @@ void AC_MainWindow::createControls() {
connect(slide_gamma, SIGNAL(valueChanged(int)), this, SLOT(colorChanged(int)));
connect(slide_saturation, SIGNAL(valueChanged(int)), this, SLOT(colorChanged(int)));
QLabel *color_maps_label = new QLabel("<b>Color Maps</b>", this);
color_maps_label->setGeometry(545, 260, 75, 20);
color_maps = new QComboBox(this);
color_maps->setGeometry(540, 275, 250, 30);
color_maps->addItem("None");
color_maps->addItem("Autum");
color_maps->addItem("Bone");
color_maps->addItem("Jet");
color_maps->addItem("Winter");
color_maps->addItem("Rainbow");
color_maps->addItem("Ocean");
color_maps->addItem("Summer");
color_maps->addItem("Cool");
color_maps->addItem("HSV");
color_maps->addItem("Pink");
color_maps->addItem("Hot");
color_maps->addItem("Parula");
connect(color_maps, SIGNAL(currentIndexChanged(int)), this, SLOT(colorMapChanged(int)));
log_text = new QTextEdit(this);
log_text->setGeometry(10, 450, 780,310);
log_text->setReadOnly(true);
@@ -288,7 +309,6 @@ void AC_MainWindow::chk_Clicked() {
}
void AC_MainWindow::cb_SetIndex(int index) {
playback->setOptions(chk_negate->isChecked(), index);
}
void AC_MainWindow::slideChanged(int) {
@@ -299,6 +319,10 @@ void AC_MainWindow::colorChanged(int) {
playback->setColorOptions(slide_bright->sliderPosition(), slide_gamma->sliderPosition(), slide_saturation->sliderPosition());
}
void AC_MainWindow::colorMapChanged(int pos) {
playback->setColorMap(pos);
}
void AC_MainWindow::addClicked() {
int row = filters->currentRow();
if(row != -1) {

View File

@@ -28,6 +28,7 @@ public:
QComboBox *combo_rgb;
QSlider *slide_r, *slide_g, *slide_b, *slide_bright, *slide_gamma, *slide_saturation;
QProgressBar *progress_bar;
QComboBox *color_maps;
QMenu *file_menu, *controls_menu, *help_menu;
QAction *file_exit, *file_new_capture, *file_new_video;
QAction *controls_snapshot, *controls_pause, *controls_step, *controls_stop, *controls_setimage, *controls_showvideo;
@@ -54,6 +55,7 @@ public slots:
void frameInc();
void slideChanged(int pos);
void colorChanged(int pos);
void colorMapChanged(int pos);
private:
void createControls();
void createMenu();

View File

@@ -117,6 +117,12 @@ void Playback::setRGB(int r, int g, int b) {
mutex.unlock();
}
void Playback::setColorMap(int c) {
mutex.lock();
ac::set_color_map = c;
mutex.unlock();
}
void Playback::setDisplayed(bool shown) {
video_shown = shown;
}
@@ -145,8 +151,6 @@ void Playback::run() {
if(i == cur.size()-1)
ac::in_custom = false;
if(cur[i].first == 0) {
ac::draw_func[cur[i].second](frame);
} else if(cur[i].first == 1) {
@@ -155,6 +159,7 @@ void Playback::run() {
} else if(cur[i].first == 2) {
draw_plugin(frame, cur[i].second);
}
ac::ApplyColorMap(frame);
if(bright_ > 0) {
ac::setBrightness(frame, 1.0, bright_);
}
@@ -167,6 +172,7 @@ void Playback::run() {
}
}
} else {
if(ac::set_color_map > 0) ac::ApplyColorMap(frame);
msleep(duration);
}
mutex.lock();

View File

@@ -38,6 +38,7 @@ public:
~Playback();
void setRGB(int r, int g, int b);
void setColorOptions(int b, int g, int s);
void setColorMap(int c);
void Play();
void Stop();
void Release();