mirror of
https://github.com/lostjared/Acid.Cam.v2.Qt.git
synced 2025-12-17 04:10:01 +01:00
added brightness,gamma,saturation sliders and apply in playback thread
This commit is contained in:
@@ -150,6 +150,35 @@ 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);
|
||||
label_slide_bright->setGeometry(10, 280, 75, 20);
|
||||
slide_bright = new QSlider(Qt::Horizontal, this);
|
||||
slide_bright->setGeometry(80, 275, 100, 30);
|
||||
slide_bright->setMaximum(255);
|
||||
slide_bright->setMinimum(0);
|
||||
slide_bright->setTickInterval(0);
|
||||
|
||||
|
||||
QLabel *label_slide_gamma = new QLabel("Gamma: ", this);
|
||||
label_slide_gamma->setGeometry(190, 280, 65, 20);
|
||||
slide_gamma = new QSlider(Qt::Horizontal, this);
|
||||
slide_gamma->setGeometry(245, 275, 100, 30);
|
||||
slide_gamma->setMaximum(255);
|
||||
slide_gamma->setMinimum(0);
|
||||
slide_gamma->setTickInterval(0);
|
||||
|
||||
QLabel *label_sat = new QLabel("Saturation: ", this);
|
||||
label_sat->setGeometry(350, 280, 100, 20);
|
||||
slide_saturation = new QSlider(Qt::Horizontal, this);
|
||||
slide_saturation->setGeometry(420, 275, 100, 30);
|
||||
slide_saturation->setMaximum(255);
|
||||
slide_saturation->setMinimum(0);
|
||||
slide_saturation->setTickInterval(0);
|
||||
|
||||
connect(slide_bright, SIGNAL(valueChanged(int)), this, SLOT(colorChanged(int)));
|
||||
connect(slide_gamma, SIGNAL(valueChanged(int)), this, SLOT(colorChanged(int)));
|
||||
connect(slide_saturation, SIGNAL(valueChanged(int)), this, SLOT(colorChanged(int)));
|
||||
|
||||
log_text = new QTextEdit(this);
|
||||
log_text->setGeometry(10, 450, 780,310);
|
||||
log_text->setReadOnly(true);
|
||||
@@ -266,6 +295,10 @@ void AC_MainWindow::slideChanged(int) {
|
||||
playback->setRGB(slide_r->sliderPosition(), slide_g->sliderPosition(), slide_b->sliderPosition());
|
||||
}
|
||||
|
||||
void AC_MainWindow::colorChanged(int) {
|
||||
playback->setColorOptions(slide_bright->sliderPosition(), slide_gamma->sliderPosition(), slide_saturation->sliderPosition());
|
||||
}
|
||||
|
||||
void AC_MainWindow::addClicked() {
|
||||
int row = filters->currentRow();
|
||||
if(row != -1) {
|
||||
|
||||
@@ -53,6 +53,7 @@ public slots:
|
||||
void cb_SetIndex(int index);
|
||||
void frameInc();
|
||||
void slideChanged(int pos);
|
||||
void colorChanged(int pos);
|
||||
private:
|
||||
void createControls();
|
||||
void createMenu();
|
||||
|
||||
@@ -11,6 +11,7 @@ Playback::Playback(QObject *parent) : QThread(parent) {
|
||||
stop = true;
|
||||
isStep = false;
|
||||
isPaused = false;
|
||||
bright_ = gamma_ = saturation_ = 0;
|
||||
}
|
||||
|
||||
void Playback::Play() {
|
||||
@@ -100,6 +101,14 @@ void Playback::setOptions(bool n, int c) {
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
void Playback::setColorOptions(int b, int g, int s) {
|
||||
mutex.lock();
|
||||
bright_ = b;
|
||||
gamma_ = g;
|
||||
saturation_ = s;
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
void Playback::setRGB(int r, int g, int b) {
|
||||
mutex.lock();
|
||||
ac::swapColor_r = r;
|
||||
@@ -146,6 +155,16 @@ void Playback::run() {
|
||||
} else if(cur[i].first == 2) {
|
||||
draw_plugin(frame, cur[i].second);
|
||||
}
|
||||
if(bright_ > 0) {
|
||||
ac::setBrightness(frame, 1.0, bright_);
|
||||
}
|
||||
if(gamma_ > 0) {
|
||||
cv::Mat gam = frame.clone();
|
||||
ac::setGamma(gam, frame, gamma_);
|
||||
}
|
||||
if(saturation_ > 0) {
|
||||
ac::setSaturation(frame, saturation_);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
msleep(duration);
|
||||
|
||||
@@ -32,10 +32,12 @@ private:
|
||||
VideoMode mode;
|
||||
int device_num;
|
||||
unsigned int red, green, blue;
|
||||
unsigned int bright_, gamma_, saturation_;
|
||||
public:
|
||||
Playback(QObject *parent = 0);
|
||||
~Playback();
|
||||
void setRGB(int r, int g, int b);
|
||||
void setColorOptions(int b, int g, int s);
|
||||
void Play();
|
||||
void Stop();
|
||||
void Release();
|
||||
|
||||
Reference in New Issue
Block a user