[ Video ]
[ About ]
generated.photosというサイトで公開されているAIによって生成された著作権フリーの顔を並べる。
Line up AI Generated faces. Photo form generated.photos.
[ Source ]
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #pragma once #include "ofMain.h" class ofApp : public ofBaseApp { public: 	void setup(); 	void update(); 	void draw(); 	void keyPressed(int key) {}; 	void keyReleased(int key) {}; 	void mouseMoved(int x, int y) {}; 	void mouseDragged(int x, int y, int button) {}; 	void mousePressed(int x, int y, int button) { }; 	void mouseReleased(int x, int y, int button) {}; 	void mouseEntered(int x, int y) {}; 	void mouseExited(int x, int y) {}; 	void windowResized(int w, int h) {}; 	void dragEvent(ofDragInfo dragInfo) {}; 	void gotMessage(ofMessage msg) {}; 	int image_size; 	vector<ofImage> image_list; 	void draw_rectangle(int level, glm::vec2 location, int size); }; | 
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | #include "ofApp.h"	 //-------------------------------------------------------------- void ofApp::setup() { 	ofSetFrameRate(1); 	ofSetWindowTitle("openFrameworks"); 	ofBackground(239); 	ofSetColor(255); 	auto path = filesystem::path("PhotoDirectoryPath"); 	vector<string> file_name_list; 	for (auto entry : filesystem::recursive_directory_iterator(path)) { 		file_name_list.push_back(entry.path().string()); 	} 	this->image_size = 60; 	ofImage image = ofImage(); 	while (this->image_list.size() < 150) { 		int random_index = ofRandom(file_name_list.size()); 		auto image = ofImage(); 		image.loadImage(file_name_list[random_index]); 		this->image_list.push_back(image); 	} } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { 	this->draw_rectangle(3, glm::vec2(), ofGetWidth()); } //-------------------------------------------------------------- void ofApp::draw_rectangle(int level, glm::vec2 location, int size){ 	auto param = ofRandom(100); 	if (level > 2 || param < 50) { 		if (level > 0) { 			this->draw_rectangle(level - 1, location, size * 0.5); 			this->draw_rectangle(level - 1, location + glm::vec2(size * 0.5, 0), size * 0.5); 			this->draw_rectangle(level - 1, location + glm::vec2(0, size * 0.5), size * 0.5); 			this->draw_rectangle(level - 1, location + glm::vec2(size * 0.5, size * 0.5), size * 0.5); 		} 		else { 			int random_index = ofRandom(this->image_list.size()); 			auto draw_image = this->image_list[random_index]; 			draw_image.resize(size, size); 			draw_image.draw(location); 		} 	} 	else { 		int random_index = ofRandom(this->image_list.size()); 		auto draw_image = this->image_list[random_index]; 		draw_image.resize(size, size); 		draw_image.draw(location); 	} } //-------------------------------------------------------------- int main() { 	ofSetupOpenGL(720, 720, OF_WINDOW); 	ofRunApp(new ofApp()); } |