now supports color key images with 255,0,255 as the color key (only pixels that are 255,0,255) are drawn

This commit is contained in:
lostjared
2018-04-08 11:11:38 -07:00
parent 853c43b722
commit e7697b8c90
5 changed files with 60 additions and 4 deletions

View File

@@ -152,7 +152,11 @@ void Playback::drawEffects(cv::Mat &frame) {
if(saturation_ > 0) {
ac::setSaturation(frame, saturation_);
}
if(colorkey_set == true && !color_image.empty()) {
cv::Mat cframe = frame.clone();
cv::Vec3b well_color(255,0,255);
ac::filterColorKeyed(well_color, ac::orig_frame, cframe, frame);
}
}
void Playback::drawFilter(cv::Mat &frame, std::pair<int, int> &filter) {
@@ -245,6 +249,15 @@ Playback::~Playback() {
#endif
}
void Playback::Clear() {
mutex.lock();
blend_set = false;
colorkey_set = false;
blend_image.release();
color_image.release();
mutex.unlock();
}
void Playback::Stop() {
stop = true;
alpha = 0;
@@ -280,6 +293,13 @@ void Playback::setImage(const cv::Mat &frame) {
mutex.unlock();
}
void Playback::setColorKey(const cv::Mat &image) {
mutex.lock();
colorkey_set = true;
color_image = image;
mutex.unlock();
}
void Playback::filterFade(cv::Mat &frame, std::pair<int, int> &filter1, std::pair<int, int> &filter2, double alpha) {
unsigned int h = frame.rows; // frame height
unsigned int w = frame.cols;// framew idth