Skip to content

Instantly share code, notes, and snippets.

@yudi-matsuzake
Created November 15, 2015 15:18
Show Gist options
  • Save yudi-matsuzake/0d7f42694cbf5ac76380 to your computer and use it in GitHub Desktop.
Save yudi-matsuzake/0d7f42694cbf5ac76380 to your computer and use it in GitHub Desktop.
QUE?
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
#define WINDOW_TITLE "Modular Fractal"
#define IMG_WSIZE 750
#define IMG_HSIZE 750
unsigned int mod = 10;
int main(){
Mat img(Size(IMG_WSIZE, IMG_HSIZE), CV_8UC1);
namedWindow(WINDOW_TITLE, CV_WINDOW_NORMAL);
int iter = 1;
while(waitKey(1)==-1){
for (int i=0; i<img.rows; i++){
uchar* ptr = img.ptr<uchar>(i);
for(int j=0; j<img.cols; j++){
ptr[j] = ((i+1)*(j+1))%(1+mod);
}
}
imshow(WINDOW_TITLE, img);
mod += iter;
iter++;
if(!mod) mod = 1;
}
waitKey(0);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment