?? weilevoynt.c
字號:
/*************************************************************************** * weilevoy.c * written by: Stephanie Wojtkowski * * Input: <input image> <output height h> <output width w> <output filename> * * Output: <texture image of hxw> * * Description: This program takes the input image and uses the Wei-Levoy * texture synthesis method to create a new texture sample that is similar * to the original. ***************************************************************************/#include <stdio.h>#include <stdlib.h>#include <time.h>#include "ppmIO.h"#include "texlibnt.h"int main(int argc, char *argv[]){ Pixel *input; //The input image int rows, cols, colors;//The rows, cols, colors of the input image Pixel *output; //The output image int h, w; //The result image height and width, respectively int size; //The total size of the output image int i; if(argc != 5){ printf("Usage: weilevoy <input image> <output height> <output width> \<output filename>\n"); exit(-1); } input = readPPM(&rows, &cols, &colors, argv[1]); h = atoi(argv[2]); w = atoi(argv[3]); size = h*w; output = (Pixel *)malloc(size*sizeof (Pixel)); //initialize the random number generator srand48(39); //Seed output image with random noise for(i=0; i<size; i++){ output[i].r = 255 * drand48(); output[i].g = 255 * drand48(); output[i].b = 255 * drand48(); } GenerateTexture(input, rows, cols, output, h, w); printf("Writing result to %s\n", argv[4]); writePPM(output, h, w, 255, argv[4]); free(input); free(output); return 0;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -