diff --git a/src/Acid.Cam.v2.Linux.Qt.pro b/src/Acid.Cam.v2.Linux.Qt.pro index de75a88..f090ca0 100644 --- a/src/Acid.Cam.v2.Linux.Qt.pro +++ b/src/Acid.Cam.v2.Linux.Qt.pro @@ -7,7 +7,7 @@ TARGET = Acid_Cam_v2_Qt QT += core gui widgets DEPENDPATH += . INCLUDEPATH += . /usr/include/ /usr/local/include -LIBS += -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_video +LIBS += -lopencv_contrib -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_video QMAKE_CXXFLAGS += -std=c++11 RESOURCES += qresource.qrc diff --git a/src/ac.cpp b/src/ac.cpp index b86a0c7..882751c 100644 --- a/src/ac.cpp +++ b/src/ac.cpp @@ -47,13 +47,17 @@ #include "ac.h" #include "fractal.h" + + // Acid Cam namespace namespace ac { + const std::string version="2.3.3"; // variables unsigned int swapColor_r = 0, swapColor_g = 0, swapColor_b = 0; bool isNegative = false, noRecord = false, pass2_enabled = false, blendW = false, slide_Show = false, slide_Rand = false, strobe_It = false, switch_Back = false, blur_First = false; bool images_Enabled = false, fps_force = false,iRev = false; bool blur_Second = false; + int set_color_map = 0; cv::Mat orig_frame; cv::Mat blendW_frame; cv::Mat image_files[4]; @@ -93,8 +97,10 @@ namespace ac { double translation_variable = 0.001f, pass2_alpha = 0.75f; // swap colors inline function inline void swapColors(cv::Mat &frame, int x, int y); + inline void swapColors_(cv::Mat &frame, int x, int y); inline void procPos(int &direction, double &pos, double &pos_max, const double max_size = 15); std::unordered_map filter_map; + bool color_map_set = false; } void ac::fill_filter_map() { @@ -104,10 +110,17 @@ void ac::fill_filter_map() { } // swapColors inline function takes frame and x, y position -inline void ac::swapColors(cv::Mat &frame, int x, int y) { +inline void ac::swapColors(cv::Mat &frame, int y, int x) { if(in_custom == true) return; if(color_order == 0 && swapColor_r == 0 && swapColor_g == 0 && swapColor_b == 0) return; // if no swap needed return - cv::Vec3b &cur = frame.at(x,y); + if(set_color_map > 0 && color_map_set == false) { + return; + } + swapColors_(frame, y, x); +} + +inline void ac::swapColors_(cv::Mat &frame, int y, int x) { + cv::Vec3b &cur = frame.at(y,x); cur[0] += swapColor_b; cur[1] += swapColor_g; cur[2] += swapColor_r; @@ -137,9 +150,9 @@ inline void ac::swapColors(cv::Mat &frame, int x, int y) { } } // invert pixel in frame at x,y -inline void ac::invert(cv::Mat &frame, int x, int y) { +inline void ac::invert(cv::Mat &frame, int y, int x) { if(in_custom == true) return; - cv::Vec3b &cur = frame.at(x,y);// cur pixel + cv::Vec3b &cur = frame.at(y,x);// cur pixel cur[0] = ~cur[0]; // bit manipulation sets opposite cur[1] = ~cur[1]; cur[2] = ~cur[2]; @@ -5262,6 +5275,22 @@ void ac::IncreaseBlendHorizontal(cv::Mat &frame) { Pass2Blend(frame); } +void ac::ApplyColorMap(cv::Mat &frame) { + if(set_color_map > 0 && set_color_map < 13) { + cv::Mat output_f1 = frame.clone(); + cv::applyColorMap(output_f1, frame, (int)set_color_map-1); + unsigned int w = frame.cols; + unsigned int h = frame.rows; + color_map_set = true; + for(unsigned int z = 0; z < h; ++z) { + for(unsigned int i = 0; i < w; ++i) { + ac::swapColors(frame, z, i); + if(isNegative) ac::invert(frame, z, i); + } + } + color_map_set = false; + } +} // No Filter void ac::NoFilter(cv::Mat &) {} @@ -5273,4 +5302,11 @@ void ac::BlendWithSource(cv::Mat &frame) { // call custom fitler defined elsewhere void ac::custom(cv::Mat &frame) { custom_filter(frame); + } + + + + + + diff --git a/src/ac.h b/src/ac.h index d79c059..d061f29 100644 --- a/src/ac.h +++ b/src/ac.h @@ -85,7 +85,7 @@ extern cv::Mat blend_image; // acid cam namespace namespace ac { // version string - static const std::string version="2.3.2"; + extern const std::string version; extern double translation_variable, pass2_alpha; extern double alpha, tr; extern bool isNegative, noRecord,iRev; @@ -100,6 +100,7 @@ namespace ac { extern int snapshot_Type; extern bool in_custom; extern unsigned int swapColor_r, swapColor_g, swapColor_b; + extern int set_color_map; inline int GetFX(cv::Mat &frame, int x, int nw); inline int GetFY(cv::Mat &frame, int y, int nh); inline void invert(cv::Mat &frame, int x, int y); @@ -283,6 +284,9 @@ namespace ac { void NoFilter(cv::Mat &frame); void BlendWithSource(cv::Mat &frame); void plugin(cv::Mat &frame); + + // color maps + void ApplyColorMap(cv::Mat &frame); // draw functions / strings extern std::string draw_strings[]; extern DrawFunction draw_func[]; @@ -290,9 +294,7 @@ namespace ac { extern bool snapShot; extern std::unordered_map filter_map; void fill_filter_map(); - - // classes to be used by the filers - + // classes to be used by the filters // Square class to hold broken up cv::Mat class Square { public: @@ -350,11 +352,9 @@ namespace ac { void movePixels(); // reset void reset(); - private: Particle **part; // array of pointers for Particles unsigned int w, h; // frame width/height - }; } // custom filter function, must be defined in program so it will link