Created
November 15, 2015 15:18
-
-
Save yudi-matsuzake/0d7f42694cbf5ac76380 to your computer and use it in GitHub Desktop.
QUE?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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