Skip to content

Commit

Permalink
new filter
Browse files Browse the repository at this point in the history
  • Loading branch information
lostjared committed Jul 26, 2018
1 parent 757eace commit a47489f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 13 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion Acid.Cam.v2.OSX/AC_Controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ - (void) createMenu: (NSMenu **)cat menuAll: (NSMenu **)all items: (NSMenu **)it
std::sort(svOther_Custom.begin(), svOther_Custom.end());
const char **szOther_Custom = convertToStringArray(svOther_Custom);

std::vector<std::string> svSquare {"SquareSwap","SquareSwap4x2","SquareSwap8x4", "SquareSwap16x8","SquareSwap64x32", "SquareBars","SquareBars8","SquareSwapRand16x8","SquareVertical8","SquareVertical16","SquareVertical_Roll","SquareSwapSort_Roll","SquareVertical_RollReverse","SquareSwapSort_RollReverse", "RandomFilteredSquare","RandomQuads","QuadRandomFilter", "RollRandom", "GridFilter8x", "GridFilter16x", "GridFilter8xBlend", "GridRandom", "GridRandomPixel", "PixelatedSquare", "SmoothSourcePixel", "ColorLines", "Curtain", "RandomCurtain", "RandomCurtainVertical", "CurtainVertical", "SlideFilter","SlideFilterXor", "RandomSlideFilter", "SlideUpDown", "SlideUpDownXor", "SlideUpDownRandom", "SlideSubFilter", "SlideSubUpDownFilter", "FourSquare", "EightSquare", "DiagonalSquare"};
std::vector<std::string> svSquare {"SquareSwap","SquareSwap4x2","SquareSwap8x4", "SquareSwap16x8","SquareSwap64x32", "SquareBars","SquareBars8","SquareSwapRand16x8","SquareVertical8","SquareVertical16","SquareVertical_Roll","SquareSwapSort_Roll","SquareVertical_RollReverse","SquareSwapSort_RollReverse", "RandomFilteredSquare","RandomQuads","QuadRandomFilter", "RollRandom", "GridFilter8x", "GridFilter16x", "GridFilter8xBlend", "GridRandom", "GridRandomPixel", "PixelatedSquare", "SmoothSourcePixel", "ColorLines", "Curtain", "RandomCurtain", "RandomCurtainVertical", "CurtainVertical", "SlideFilter","SlideFilterXor", "RandomSlideFilter", "SlideUpDown", "SlideUpDownXor", "SlideUpDownRandom", "SlideSubFilter", "SlideSubUpDownFilter", "FourSquare", "EightSquare", "DiagonalSquare", "DiagonalSquareRandom"};

std::sort(svSquare.begin(), svSquare.end());
const char **szSquare = convertToStringArray(svSquare);
Expand Down
6 changes: 3 additions & 3 deletions Acid.Cam.v2.OSX/ac-filter1.cpp

Large diffs are not rendered by default.

28 changes: 25 additions & 3 deletions Acid.Cam.v2.OSX/ac-filter8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,15 +523,37 @@ void ac::EightSquare(cv::Mat &frame) {

void ac::DiagonalSquare(cv::Mat &frame) {
int pos_x = 0, pos_y = 0;
int col_w = frame.cols/4;
int col_h = frame.rows/4;
int col_w = (frame.cols/4)-1;
int col_h = (frame.rows/4)-1;
cv::Mat copy_frame = frame.clone();
for(int i = 0; i < 4; ++i) {
for(int i = 0; i < 3; ++i) {
cv::Mat out_frame;
cv::resize(copy_frame, out_frame, cv::Size(col_w,col_h));
if(pos_x >= 0 && pos_x <= frame.cols-col_w && pos_y >= 0 && pos_y <= frame.rows-col_h)
copyMat(out_frame, 0, 0, frame, pos_x, pos_y, col_w, col_h);
pos_x += col_w;
pos_y += col_h;
}
AddInvert(frame);
}

void ac::DiagonalSquareRandom(cv::Mat &frame) {
static MatrixCollection<4> collection;
collection.shiftFrames(frame);
int pos_x = 0, pos_y = 0;
int col_w = (frame.cols/4)-1;
int col_h = (frame.rows/4)-1;
Negate(frame);
for(int i = 0; i < 4; ++i) {
cv::Mat &copy_frame = collection.frames[i];
cv::Mat out_frame;
cv::resize(copy_frame, out_frame, cv::Size(col_w,col_h));
int index = 0;
DrawFunction func = getRandomFilter(index);
func(out_frame);
copyMat(out_frame, 0, 0, frame, pos_x, pos_y, col_w, col_h);
pos_x += col_w;
pos_y += col_h;
}
AddInvert(frame);
}
12 changes: 6 additions & 6 deletions Acid.Cam.v2.OSX/ac-util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,12 @@ void ac::filterFade(cv::Mat &frame, int filter1, int filter2, double alpha) {
void ac::copyMat(const cv::Mat &src,int src_x, int src_y ,cv::Mat &target, const ac::Rect &rc) {
for(int i = 0; i < rc.w; ++i) {
for(int z = 0; z < rc.h; ++z) {
//if(src_y+z < src.rows && src_x+i < src.cols && y+z < target.rows && x+i < target.cols) {
ASSERT(src_y+z < src.rows && src_x+i < src.cols && rc.y+z < target.rows && rc.x+i < target.cols);
cv::Vec3b &pixel = target.at<cv::Vec3b>(rc.y+z, rc.x+i);
cv::Vec3b src_pixel = src.at<cv::Vec3b>(src_y+z, src_x+i);
pixel = src_pixel;
//}
if(src_y+z < src.rows && src_x+i < src.cols && rc.y+z < target.rows && rc.x+i < target.cols) {
ASSERT(src_y+z < src.rows && src_x+i < src.cols && rc.y+z < target.rows && rc.x+i < target.cols);
cv::Vec3b &pixel = target.at<cv::Vec3b>(rc.y+z, rc.x+i);
cv::Vec3b src_pixel = src.at<cv::Vec3b>(src_y+z, src_x+i);
pixel = src_pixel;
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Acid.Cam.v2.OSX/ac.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ namespace ac {
void FourSquare(cv::Mat &frame);
void EightSquare(cv::Mat &frame);
void DiagonalSquare(cv::Mat &frame);
void DiagonalSquareRandom(cv::Mat &frame);
// No filter (do nothing)
void NoFilter(cv::Mat &frame);
// Alpha blend with original image
Expand Down

0 comments on commit a47489f

Please sign in to comment.