⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 weilevoynt.c

📁 weilevoy算法实现纹理合成,分带与不带加速两个版本
💻 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 + -