updated acid cam filters to version 2.2.6

This commit is contained in:
lostjared
2017-09-24 12:23:23 -07:00
parent f19fd86f05
commit 1a0a0b1112
2 changed files with 382 additions and 83 deletions

View File

@@ -1,9 +1,15 @@
/*
*
* Acid Cam functions for OpenCV
/* Acid Cam Functions for OpenCV
* written by Jared Bruni https://github.com/lostjared
* http://lostsidedead.com
Website: http://lostsidedead.com
YouTube: http://youtube.com/LostSideDead
Instagram: http://instagram.com/jaredbruni
Twitter: http://twitter.com/jaredbruni
Facebook: http://facebook.com/LostSideDead0x
You can use this program free of charge and redistrubute as long
as you do not charge anything for this program. This program is 100%
Free.
BSD 2-Clause License
@@ -33,11 +39,11 @@
* One quick note, most of the time when writing programs using x,y variables x goes first
* the OpenCV Mat at function that returns a pixel is reversed.
* the OpenCV Mat at function that returns a pixel is reversed.
* y is first. Example
* cv::Vec3b &v = frame.at<cv::Vec3b>(y, x);
*
*/
*/
#include "ac.h"
#include "fractal.h"
@@ -62,18 +68,21 @@ namespace ac {
// draw strings (function names)
std::string draw_strings[] = { "Self AlphaBlend", "Self Scale", "StrobeEffect", "Blend #3", "Negative Paradox", "ThoughtMode", "RandTriBlend", "Blank", "Tri", "Distort", "CDraw", "Type", "NewOne", "Blend Fractal","Blend Fractal Mood", "CosSinMultiply", "Color Accumlate1", "Color Accumulate2", "Color Accumulate3", "filter8","filter3","Rainbow Blend","Rand Blend","New Blend", "Alpha Flame Filters", "Pixel Scale", "PixelSort", "GlitchSort","Random Filter", "Random Flash", "Blend with Image", "Blend with Image #2", "Blend with Image #3", "Blend with Image #4", "GaussianBlur", "Median Blur", "Blur Distortion", "Diamond Pattern", "MirrorBlend","Pulse","Sideways Mirror","Mirror No Blend","Sort Fuzz","Fuzz","Double Vision","RGB Shift","RGB Sep","Graident Rainbow","Gradient Rainbow Flash", "Reverse", "Scanlines", "TV Static", "Mirror Average", "Mirror Average Mix", "Mean", "Laplacian", "Bitwise_XOR", "Bitwise_AND", "Bitwise_OR", "Equalize", "Channel Sort", "Reverse_XOR", "Combine Pixels", "FlipTrip", "Canny","Boxes","Boxes Fade", "Flash Black", "SlideRGB", "Side2Side","Top2Bottom","Strobe Red Then Green Then Blue","Blend_Angle", "Outward", "Outward Square", "ShiftPixels", "ShiftPixelsDown", "XorMultiBlend", "Bitwise_Rotate", "Bitwise_Rotate Diff", "HPPD", "FuzzyLines","GradientLines","GradientSelf","GradientSelfVertical", "GradientDown", "GraidentHorizontal", "GradientRGB","Inter", "UpDown","LeftRight","StrobeScan","BlendedScanLines","GradientStripes","XorSine","SquareSwap",
"SquareSwap4x2","SquareSwap8x4", "SquareSwap16x8","SquareSwap64x32","SquareBars","SquareBars8","SquareSwapRand16x8",
"SquareVertical8", "SquareVertical16","SquareVertical_Roll","SquareSwapSort_Roll","SquareVertical_RollReverse","SquareSwapSort_RollReverse","No Filter",
"SquareVertical8", "SquareVertical16","SquareVertical_Roll","SquareSwapSort_Roll","SquareVertical_RollReverse","SquareSwapSort_RollReverse","Circular","WhitePixel","FrameBlend", "FrameBlendRGB",
"TrailsFilter",
"TrailsFilterIntense","TrailsFilterSelfAlpha","TrailsFilterXor","ColorTrails", "No Filter",
"Blend with Source", "Plugin", "Custom","Blend With Image #1", "TriBlend with Image", "Image Strobe", "Image distraction" };
// filter callback functions
DrawFunction draw_func[] = { SelfAlphaBlend, SelfScale, StrobeEffect, Blend3, NegParadox, ThoughtMode, RandTriBlend, Blank, Tri, Distort, CDraw,Type,NewOne,blendFractal,blendFractalMood,cossinMultiply, colorAccumulate1, colorAccumulate2, colorAccumulate3,filter8,filter3,rainbowBlend,randBlend,newBlend,
alphaFlame, pixelScale,pixelSort, glitchSort,randomFilter,randomFlash, imageBlend,imageBlendTwo,imageBlendThree,imageBlendFour, GaussianBlur, MedianBlur, BlurDistortion,DiamondPattern,MirrorBlend,Pulse,SidewaysMirror,MirrorNoBlend,SortFuzz,Fuzz,DoubleVision,RGBShift,RGBSep,GradientRainbow,GradientRainbowFlash,Reverse,Scanlines,TVStatic,MirrorAverage,MirrorAverageMix,Mean,Laplacian,Bitwise_XOR,Bitwise_AND,Bitwise_OR,Equalize,ChannelSort,Reverse_XOR,CombinePixels,FlipTrip,Canny,Boxes,BoxesFade,FlashBlack,SlideRGB,Side2Side,Top2Bottom, StrobeRedGreenBlue,Blend_Angle,Outward,OutwardSquare,ShiftPixels,ShiftPixelsDown,XorMultiBlend,BitwiseRotate,BitwiseRotateDiff,HPPD,FuzzyLines,GradientLines,GradientSelf,GradientSelfVertical,GradientDown,GraidentHorizontal,GradientRGB,Inter,UpDown,LeftRight,StrobeScan,BlendedScanLines,GradientStripes,XorSine,SquareSwap,
SquareSwap4x2, SquareSwap8x4, SquareSwap16x8,SquareSwap64x32,SquareBars,SquareBars8,SquareSwapRand16x8,
SquareVertical8,SquareVertical16,SquareVertical_Roll,SquareSwapSort_Roll,SquareVertical_RollReverse,SquareSwapSort_RollReverse,NoFilter,
BlendWithSource,plugin,custom,blendWithImage, triBlendWithImage,imageStrobe, imageDistraction,0};
SquareVertical8,SquareVertical16,SquareVertical_Roll,SquareSwapSort_Roll,SquareVertical_RollReverse,SquareSwapSort_RollReverse,Circular,WhitePixel,FrameBlend,FrameBlendRGB,
TrailsFilter,TrailsFilterIntense,TrailsFilterSelfAlpha,TrailsFilterXor,ColorTrails,
NoFilter,BlendWithSource,plugin,custom,blendWithImage, triBlendWithImage,imageStrobe, imageDistraction,0};
// number of filters
int draw_max = 116;
int draw_max = 125;
// variables
double translation_variable = 0.001f, pass2_alpha = 0.75f;
// swap colors inline function
@@ -100,7 +109,7 @@ inline void ac::swapColors(cv::Mat &frame, int x, int y) {
cv::Vec3b temp;// temp
temp = cur;// temp = cur
// swap RGB orders
switch(color_order) {
case 1:
@@ -1860,9 +1869,9 @@ void ac::BlurDistortion(cv::Mat &frame) {
static unsigned int index = 1, direction = 1;
cv::GaussianBlur(frame, out, cv::Size(index, index), 0, 0);// output
if(direction == 1) {// if direction equals 1
if(index >= 51) direction = 0;// if greater than 51 set to zero go
if(index >= 51) direction = 0;// if greater than 51 set to zero go
// opposite direction
else index += 2;// increase
else index += 2;// increase
} else {
if(index <= 1) direction = 1;// go opposite direction
else index -= 2;// decrease
@@ -2001,7 +2010,7 @@ void ac::SidewaysMirror(cv::Mat &frame) {
orig = frame.clone();// clone frame to orig
for(int z = 2; z < h-3; ++z) {// loop from top to bottom
for(int i = 2; i < w-3; ++i) {// loop each row from left
// to right
// to right
// current pixel
cv::Vec3b &buffer = frame.at<cv::Vec3b>(z, i);
// h minus y, width minus x positioned pixel
@@ -2035,7 +2044,7 @@ void ac::MirrorNoBlend(cv::Mat &frame) {
for(int z = 2; z < h-3; ++z) { // loop through the height
for(int i = 2; i < w-3; ++i) {// go across each row
cv::Vec3b &buffer = frame.at<cv::Vec3b>(z, i);// current pixel
// opposite of current pixel
// opposite of current pixel
cv::Vec3b &pix1 = orig.at<cv::Vec3b>((h-z), (w-i));
// opposite width, same height
cv::Vec3b &pix2 = orig.at<cv::Vec3b>(z, (w-i));
@@ -2043,9 +2052,9 @@ void ac::MirrorNoBlend(cv::Mat &frame) {
cv::Vec3b &pix3 = orig.at<cv::Vec3b>((h-z), i);
// current pixel components equal
// add each pixel value together
buffer[0] = (pix1[0]+pix2[0]+pix3[0]);
buffer[1] = (pix1[1]+pix2[1]+pix3[1]);
buffer[2] = (pix1[2]+pix2[2]+pix3[2]);
buffer[0] = (pix1[0]+pix2[0]+pix3[0]);
buffer[1] = (pix1[1]+pix2[1]+pix3[1]);
buffer[2] = (pix1[2]+pix2[2]+pix3[2]);
// swap RGB positions
swapColors(frame, z, i);
// if the negative switch is on, invert
@@ -2657,7 +2666,7 @@ void ac::BoxesFade(cv::Mat &frame) {
if(color[0] >= 254) color[0] = rand()%255; // reset if over
if(color[1] >= 254) color[1] = rand()%255;
if(color[2] >= 254) color[2] = rand()%255;
cv::Vec3b &pixel = frame.at<cv::Vec3b>(y, x);
pixel[0] += color[0]; // add each component
pixel[1] += color[1];
@@ -2706,14 +2715,14 @@ void ac::SlideRGB(cv::Mat &frame) {
if(offset_x+i < (w-1)) {
cv::Vec3b off_pix = frame.at<cv::Vec3b>(z, offset_x+i);
pixel[color[0]] += off_pix[color[0]];
cv::Vec3b off_red = frame.at<cv::Vec3b>(z, (w-(offset_x+i)));
cv::Vec3b off_red = frame.at<cv::Vec3b>(z, (w-(offset_x+i)));
pixel[color[1]] += off_red[color[1]];
}
}
}
static unsigned int direction = 1;
if(direction == 1) {
++offset_x;
++offset_x;
if(offset_x > 5) {
direction = 0;
}
@@ -2832,7 +2841,7 @@ void ac::Outward(cv::Mat &frame) {
int w = frame.cols;// frame width
int h = frame.rows;// frame height
static double start_pos = 1, pos = 1.0, pos_max = 5.0;
static cv::Scalar offset(5, 50, 100);
pos = start_pos;
@@ -2885,7 +2894,7 @@ void ac::OutwardSquare(cv::Mat &frame) {
static double start_pos = 1, pos = 1.0, pos_max = 5.0;
static cv::Scalar offset(5, 50, 100);
pos = start_pos;
for(int y = h/2; y > 0; --y) {
for(int x = 0; x < wx; ++x) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(y, x);
@@ -3056,7 +3065,7 @@ void ac::XorMultiBlend(cv::Mat &frame) {
static double pos = 1.0, pos_max = 3.0;
cv::Scalar s(pos, -pos, pos);
for(int y = h-1; y > 0; --y) {
for(int x = w-1; x > 0; --x) {
for(int x = w-1; x > 0; --x) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(y, x);
pixel[0] = (pixel[0]^(int)s[0])*pos;
pixel[1] = (pixel[1]^(int)s[1])*pos;
@@ -3080,9 +3089,9 @@ void ac::BitwiseRotate(cv::Mat &frame) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
if(direction == 1) {
pixel[0] = ror(pixel[0], offset);
pixel[1] = rol(pixel[1], offset);
pixel[2] = ror(pixel[2], offset);
pixel[0] = ror(pixel[0], offset);
pixel[1] = rol(pixel[1], offset);
pixel[2] = ror(pixel[2], offset);
} else {
pixel[0] = rol(pixel[0], offset);
pixel[1] = ror(pixel[1], offset);
@@ -3138,7 +3147,7 @@ void ac::HPPD(cv::Mat &frame) {
pixel[0] = pixel[0]-total[0]*pos;
pixel[1] = pixel[1]-total[1]*pos;
pixel[2] = pixel[2]-total[2]*pos;
swapColors(frame, z, i);
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
@@ -3158,7 +3167,7 @@ void ac::FuzzyLines(cv::Mat &frame) {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
cv::Vec3b temp = pixel;
value[0] += temp[0]+temp[1]+temp[2];
value[1] -= temp[0]+temp[1]+temp[2];
value[2] += temp[0]+temp[1]+temp[2];
@@ -3176,7 +3185,7 @@ void ac::FuzzyLines(cv::Mat &frame) {
static int direction = 1;
procPos(direction, pos, pos_max);
}
@@ -3300,24 +3309,24 @@ void ac::GradientRGB(cv::Mat &frame) {
static unsigned int count = 0, index = 0;
static unsigned int direction = 1;
if(direction == 1) {
for(unsigned int z = 0; z < h; ++z) {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
pixel[index] = pixel[index]*count;
++count;
if(count >= 255) {
++index;
if(index > 2) {
index = 0;
for(unsigned int z = 0; z < h; ++z) {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
pixel[index] = pixel[index]*count;
++count;
if(count >= 255) {
++index;
if(index > 2) {
index = 0;
}
}
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
}
} else {
for(unsigned int i = 0; i < w; ++i) {
for(unsigned int z = 0; z < h; ++z) {
for(unsigned int z = 0; z < h; ++z) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
pixel[index] = pixel[index]*count;
++count;
@@ -3360,14 +3369,14 @@ void ac::UpDown(cv::Mat &frame) {
for(unsigned int i = 0; i < w; ++i) {
if(order == true) {
order = false;
for(unsigned int z = 0; z < h; ++z) {
for(unsigned int z = 0; z < h; ++z) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
for(unsigned int q = 0; q < 3; ++q)
pixel[q] = alpha+(pixel[q]*pos);
pixel[q] = alpha+(pixel[q]*pos);
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
alpha += 0.1;
} else {
order = true;
@@ -3382,7 +3391,7 @@ void ac::UpDown(cv::Mat &frame) {
alpha += 0.1;
}
}
static int direction = 1;
@@ -3413,7 +3422,7 @@ void ac::LeftRight(cv::Mat &frame) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
for(unsigned int q = 0; q < 3; ++q)
pixel[q] = alpha-(pixel[q]*pos);
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
@@ -3434,37 +3443,37 @@ void ac::StrobeScan(cv::Mat &frame) {
static unsigned int cdirection = 1;
for(unsigned int z = 0; z < h; ++z) {
switch(color_mode) {
case 0: {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
pixel[color_mode] = over+(pixel[color_mode]*pos);
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
switch(color_mode) {
case 0: {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
pixel[color_mode] = over+(pixel[color_mode]*pos);
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
break;
case 1: {
for(unsigned int i = w-1; i > 1; --i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
pixel[color_mode] -= over+(pixel[1]*pos);
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
break;
case 2: {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
pixel[color_mode] ^= static_cast<unsigned char>(over+(pixel[color_mode]*pos));
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
break;
}
break;
case 1: {
for(unsigned int i = w-1; i > 1; --i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
pixel[color_mode] -= over+(pixel[1]*pos);
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
break;
case 2: {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
pixel[color_mode] ^= static_cast<unsigned char>(over+(pixel[color_mode]*pos));
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
break;
}
if(cdirection == 1) {
++color_mode;
@@ -3619,7 +3628,7 @@ void Square_Swap(Square *squares, int num_w, int num_h, cv::Mat &frame, bool ran
for(int i = 0; i < pos; ++i) {
if(random == false)
// use shuffled
square_vec[i]->copyImageToTarget(points[i].x, points[i].y,frame);
square_vec[i]->copyImageToTarget(points[i].x, points[i].y,frame);
else
// use random
square_vec[rand()%pos]->copyImageToTarget(points[i].x, points[i].y,frame);
@@ -3817,6 +3826,278 @@ void ac::SquareSwapSort_RollReverse(cv::Mat &frame) {
SquareVertical(num_w, num_h, squares, frame,false);
}
void ac::Circular(cv::Mat &frame) {
unsigned int w = frame.cols;// frame width
unsigned int h = frame.rows;// frame height
static double pos = 1.0, pos_max = 7.0;
static double deg = 0.0;
static double rad = 50;
for(unsigned int i = 0; i < w; ++i) {
for(unsigned int z = 0; z < h; ++z) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
int X_color = int(rad * cos(deg));
int Y_color = int(rad * sin(deg));
pixel[0] += pos*X_color;
pixel[1] *= pos;
pixel[2] += pos*Y_color;
deg += 0.1;
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
rad += 0.5;
if(rad > 100) rad = 50;
static int direction = 1;
procPos(direction, pos, pos_max);
}
void ac::WhitePixel(cv::Mat &frame) {
unsigned int w = frame.cols;// frame width
unsigned int h = frame.rows;// frame height
static unsigned int pixel_count = 0;
for(unsigned int z = 0; z < h; ++z) {
for(unsigned int i = 0; i < w; ++i) {
if(pixel_count == 4) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
pixel[0] = pixel[1] = pixel[2] = 255;
pixel_count = rand()%2;
} else ++pixel_count;
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
pixel_count = rand()%2;
}
}
void ac::FrameBlend(cv::Mat &frame) {
unsigned int w = frame.cols;// frame width
unsigned int h = frame.rows;// frame height
static double pos = 1.0, pos_max = 7.0;
static cv::Mat stored_frame;
if((frame.rows != stored_frame.rows) || (frame.cols != stored_frame.cols)) {
stored_frame = frame.clone();
}
cv::Mat start = frame.clone();
// process frame
for(unsigned int z = 0; z < h; ++z) {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
cv::Vec3b old_pixel = stored_frame.at<cv::Vec3b>(z, i);
pixel[0] += (old_pixel[0]^pixel[0])*pos;
pixel[1] += (old_pixel[1]&pixel[1])*pos;
pixel[2] += (old_pixel[2]|pixel[2])*pos;
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
stored_frame = start;
static int direction = 1;
procPos(direction, pos, pos_max);
}
void ac::FrameBlendRGB(cv::Mat &frame) {
unsigned int w = frame.cols;// frame width
unsigned int h = frame.rows;// frame height
static double pos = 1.0, pos_max = 7.0;
static cv::Mat stored_frame;
if((frame.rows != stored_frame.rows) || (frame.cols != stored_frame.cols)) {
stored_frame = frame.clone();
}
cv::Mat start = frame.clone();
static int swap = 0;
// process frame
for(unsigned int z = 0; z < h; ++z) {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
cv::Vec3b old_pixel = stored_frame.at<cv::Vec3b>(z, i);
switch(swap) {
case 0:
pixel[0] += (old_pixel[0]^pixel[0])*pos;
pixel[1] += (old_pixel[1]&pixel[1])*pos;
pixel[2] += (old_pixel[2]|pixel[2])*pos;
break;
case 1:
pixel[0] += (old_pixel[0]&pixel[0])*pos;
pixel[1] += (old_pixel[1]|pixel[1])*pos;
pixel[2] += (old_pixel[2]^pixel[2])*pos;
break;
case 2:
pixel[0] += (old_pixel[0]|pixel[0])*pos;
pixel[1] += (old_pixel[1]^pixel[1])*pos;
pixel[2] += (old_pixel[2]&pixel[2])*pos;
break;
}
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
++swap;
if(swap > 2) swap = 0;
stored_frame = start;
static int direction = 1;
procPos(direction, pos, pos_max);
}
template<int Size>
class MatrixCollection {
public:
MatrixCollection() : w(0), h(0) {}
cv::Mat frames[Size+1];
int w, h;
void shiftFrames(cv::Mat &frame) {
int wx = frame.cols;
int wh = frame.rows;
if(w != wx || h != wh) {
for(unsigned int i = 0; i < Size; ++i)
frames[i] = frame.clone();
w = wx;
h = wh;
return;
}
for(int i = Size-1; i > 0; --i) {
frames[i] = frames[i-1];
}
frames[0] = frame.clone();
}
};
void ac::TrailsFilterIntense(cv::Mat &frame) {
static MatrixCollection<8> collection;
collection.shiftFrames(frame);
unsigned int w = frame.cols;// frame width
unsigned int h = frame.rows;// frame heigh
for(unsigned int z = 0; z < h; ++z) {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
cv::Scalar s;
cv::Vec3b frame_pixels[8];
frame_pixels[0] = collection.frames[1].at<cv::Vec3b>(z, i);
frame_pixels[1] = collection.frames[2].at<cv::Vec3b>(z, i);
frame_pixels[2] = collection.frames[3].at<cv::Vec3b>(z, i);
frame_pixels[3] = collection.frames[4].at<cv::Vec3b>(z, i);
frame_pixels[4] = collection.frames[5].at<cv::Vec3b>(z, i);
frame_pixels[5] = collection.frames[6].at<cv::Vec3b>(z, i);
pixel[0] += (frame_pixels[0][0] + frame_pixels[1][0] + frame_pixels[2][0] + frame_pixels[3][0] + frame_pixels[4][0] + frame_pixels[5][0]);
pixel[1] += (frame_pixels[0][1] + frame_pixels[1][1] + frame_pixels[2][1] + frame_pixels[3][1] + frame_pixels[4][1] + frame_pixels[5][1]);
pixel[2] += (frame_pixels[0][2] + frame_pixels[1][2] + frame_pixels[2][2] + frame_pixels[3][2] + frame_pixels[4][2] + frame_pixels[5][2]);
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
}
void ac::TrailsFilter(cv::Mat &frame) {
static MatrixCollection<4> collection;
collection.shiftFrames(frame);
unsigned int w = frame.cols;// frame width
unsigned int h = frame.rows;// frame heigh
for(unsigned int z = 0; z < h; ++z) {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
cv::Scalar s;
cv::Vec3b frame_pixels[4];
frame_pixels[0] = collection.frames[1].at<cv::Vec3b>(z, i);
frame_pixels[1] = collection.frames[2].at<cv::Vec3b>(z, i);
frame_pixels[2] = collection.frames[3].at<cv::Vec3b>(z, i);
pixel[0] += (frame_pixels[0][0] + frame_pixels[1][0] + frame_pixels[2][0]);
pixel[1] += (frame_pixels[0][1] + frame_pixels[1][1] + frame_pixels[2][1]);
pixel[2] += (frame_pixels[0][2] + frame_pixels[1][2] + frame_pixels[2][2]);
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
}
void ac::TrailsFilterSelfAlpha(cv::Mat &frame) {
static MatrixCollection<8> collection;
static double pos = 1.0, pos_max = 7.0;
collection.shiftFrames(frame);
unsigned int w = frame.cols;// frame width
unsigned int h = frame.rows;// frame heigh
for(unsigned int z = 0; z < h; ++z) {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
cv::Scalar s;
cv::Vec3b frame_pixels[8];
frame_pixels[0] = collection.frames[1].at<cv::Vec3b>(z, i);
frame_pixels[1] = collection.frames[2].at<cv::Vec3b>(z, i);
frame_pixels[2] = collection.frames[3].at<cv::Vec3b>(z, i);
frame_pixels[3] = collection.frames[4].at<cv::Vec3b>(z, i);
frame_pixels[4] = collection.frames[5].at<cv::Vec3b>(z, i);
frame_pixels[5] = collection.frames[6].at<cv::Vec3b>(z, i);
pixel[0] += (frame_pixels[0][0] + frame_pixels[1][0] + frame_pixels[2][0] + frame_pixels[3][0] + frame_pixels[4][0] + frame_pixels[5][0])*pos;
pixel[1] += (frame_pixels[0][1] + frame_pixels[1][1] + frame_pixels[2][1] + frame_pixels[3][1] + frame_pixels[4][1] + frame_pixels[5][1])*pos;
pixel[2] += (frame_pixels[0][2] + frame_pixels[1][2] + frame_pixels[2][2] + frame_pixels[3][2] + frame_pixels[4][2] + frame_pixels[5][2])*pos;
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
static int direction = 1;
procPos(direction, pos, pos_max);
}
void ac::TrailsFilterXor(cv::Mat &frame) {
static MatrixCollection<8> collection;
static double pos = 1.0, pos_max = 7.0;
collection.shiftFrames(frame);
unsigned int w = frame.cols;// frame width
unsigned int h = frame.rows;// frame heigh
for(unsigned int z = 0; z < h; ++z) {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
cv::Scalar s;
cv::Vec3b frame_pixels[8];
frame_pixels[0] = collection.frames[1].at<cv::Vec3b>(z, i);
frame_pixels[1] = collection.frames[2].at<cv::Vec3b>(z, i);
frame_pixels[2] = collection.frames[3].at<cv::Vec3b>(z, i);
frame_pixels[3] = collection.frames[4].at<cv::Vec3b>(z, i);
frame_pixels[4] = collection.frames[5].at<cv::Vec3b>(z, i);
frame_pixels[5] = collection.frames[6].at<cv::Vec3b>(z, i);
pixel[0] ^= (frame_pixels[0][0] + frame_pixels[1][0] + frame_pixels[2][0] + frame_pixels[3][0] + frame_pixels[4][0] + frame_pixels[5][0]);
pixel[1] ^= (frame_pixels[0][1] + frame_pixels[1][1] + frame_pixels[2][1] + frame_pixels[3][1] + frame_pixels[4][1] + frame_pixels[5][1]);
pixel[2] ^= (frame_pixels[0][2] + frame_pixels[1][2] + frame_pixels[2][2] + frame_pixels[3][2] + frame_pixels[4][2] + frame_pixels[5][2]);
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
static int direction = 1;
procPos(direction, pos, pos_max);
}
void ac::ColorTrails(cv::Mat &frame) {
static MatrixCollection<8> collection;
collection.shiftFrames(frame);
unsigned int w = frame.cols;// frame width
unsigned int h = frame.rows;// frame heigh
for(unsigned int z = 0; z < h; ++z) {
for(unsigned int i = 0; i < w; ++i) {
cv::Vec3b &pixel = frame.at<cv::Vec3b>(z, i);
cv::Scalar s;
cv::Vec3b frame_pixels[8];
frame_pixels[0] = collection.frames[1].at<cv::Vec3b>(z, i);
frame_pixels[1] = collection.frames[2].at<cv::Vec3b>(z, i);
frame_pixels[2] = collection.frames[3].at<cv::Vec3b>(z, i);
frame_pixels[3] = collection.frames[4].at<cv::Vec3b>(z, i);
frame_pixels[4] = collection.frames[5].at<cv::Vec3b>(z, i);
frame_pixels[5] = collection.frames[6].at<cv::Vec3b>(z, i);
for(unsigned int q = 0; q < 6; ++q) {
if(frame_pixels[q][0] > pixel[0]) frame_pixels[q][0] = 0;
if(frame_pixels[q][1] < pixel[1]) frame_pixels[q][1] = 0;
if(frame_pixels[q][2] > pixel[2]) frame_pixels[q][2] = 0;
}
pixel[0] = (frame_pixels[0][0] + frame_pixels[1][0] + frame_pixels[2][0] + frame_pixels[3][0] + frame_pixels[4][0] + frame_pixels[5][0]);
pixel[1] = (frame_pixels[0][1] + frame_pixels[1][1] + frame_pixels[2][1] + frame_pixels[3][1] + frame_pixels[4][1] + frame_pixels[5][1]);
pixel[2] = (frame_pixels[0][2] + frame_pixels[1][2] + frame_pixels[2][2] + frame_pixels[3][2] + frame_pixels[4][2] + frame_pixels[5][2]);
swapColors(frame, z, i);
if(isNegative) invert(frame, z, i);
}
}
}
// No Filter
void ac::NoFilter(cv::Mat &frame) {}

View File

@@ -1,7 +1,16 @@
/* Acid Cam Functions for OpenCV
* written by Jared Bruni https://github.com/lostjared
* http://lostsidedead.com
Website: http://lostsidedead.com
YouTube: http://youtube.com/LostSideDead
Instagram: http://instagram.com/jaredbruni
Twitter: http://twitter.com/jaredbruni
Facebook: http://facebook.com/LostSideDead0x
You can use this program free of charge and redistrubute as long
as you do not charge anything for this program. This program is 100%
Free.
BSD 2-Clause License
Copyright (c) 2017, Jared Bruni
@@ -68,7 +77,7 @@ extern cv::Mat blend_image;
// acid cam namespace
namespace ac {
// version string
static const std::string version="2.2.5";
static const std::string version="2.2.6";
extern double translation_variable, pass2_alpha;
extern double alpha, tr;
extern bool isNegative, noRecord,iRev;
@@ -216,6 +225,15 @@ namespace ac {
void SquareSwapSort_Roll(cv::Mat &frame);
void SquareVertical_RollReverse(cv::Mat &frame);
void SquareSwapSort_RollReverse(cv::Mat &frame);
void Circular(cv::Mat &frame);
void WhitePixel(cv::Mat &frame);
void FrameBlend(cv::Mat &frame);
void FrameBlendRGB(cv::Mat &frame);
void TrailsFilter(cv::Mat &frame);
void TrailsFilterIntense(cv::Mat &frame);
void TrailsFilterSelfAlpha(cv::Mat &frame);
void TrailsFilterXor(cv::Mat &frame);
void ColorTrails(cv::Mat &frame);
void NoFilter(cv::Mat &frame);
void BlendWithSource(cv::Mat &frame);
void plugin(cv::Mat &frame);