glitch.gui/examples/line_collection01/plugin.cpp
Source: glitch.gui/examples/line_collection01/plugin.cpp
#include "acidcam/ac.h"
static constexpr int MAX = 8;
static ac::MatrixCollection<MAX> collection;
extern "C" void init() {
std::cout << "line_collection01 initialized...\n";
srand(static_cast<unsigned int>(time(0)));
}
extern "C" void rls() {
ac::release_all_objects();
}
extern "C" void clear() {
std::cout << "Clear called..\n";
ac::release_all_objects();
}
extern "C" void proc(cv::Mat &frame) {
if(collection.empty())
collection.shiftFrames(frame);
collection.shiftFrames(frame);
for(int z = 0; z < frame.rows; ++z) {
static int cnt = 0;
int offset = 0;
for(int i = 0; i < frame.cols; ++i) {
cv::Vec3b &pixel = ac::pixelAt(frame, z, i);
cv::Vec3b pix = collection.frames[offset].at<cv::Vec3b>(z, i);
pixel = pix;
if(++cnt > frame.cols/32) {
cnt = 0;
if(++offset > MAX-1)
offset = 0;
}
}
}
}