Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 使用VC+对图像应用效果+;?_Image_Image Processing_Visual C++ - Fatal编程技术网

Image 使用VC+对图像应用效果+;?

Image 使用VC+对图像应用效果+;?,image,image-processing,visual-c++,Image,Image Processing,Visual C++,我正致力于将艺术效果应用于图像。 你能告诉我如何达到这个效果吗 感谢您的任何意见 输入图像: 输出图像: ,第二张图片中的考拉是一张3D图片。。。计算机无法从您的第一张图像中轻松计算出哪些位应升高,哪些位应降低 我建议一个>人人

我正致力于将艺术效果应用于图像。 你能告诉我如何达到这个效果吗

感谢您的任何意见

输入图像:

输出图像:

第二张图片中的考拉是一张3D图片。。。计算机无法从您的第一张图像中轻松计算出哪些位应升高,哪些位应降低

我建议一个>人<来做这项工作,尽管计算机可以帮助

如果您有一个所有平铺高度的列表(可能是由图形艺术家自己创建的),您可以一次一个地将它们渲染到空白帧缓冲区中。按从最后面的平铺到最前面的顺序使用抗锯齿渲染它们。似乎为每个瓷砖选择的颜色值基于相应方形矩形中的平均颜色值(可能位于或可能不位于精确的像素边界上)。但是,如何计算平均值对我来说并不清楚,它可能是基于RGB或HSV,它可以是简单的平均值或加权平均值,非线性或任何值,并且您可能需要考虑伽马校正(参见链接)。 假定画布上的瓷砖(渲染前)的颜色空间已扭曲,以匹配原始图像中相应区域的颜色

我忽略了一些微妙之处,我想你可能不关心或不想腾出时间,比如在颜色扭曲和场景中的反射之后,在较暗或较亮的瓷砖上,阴影和高光是否应该校正为比某些参考瓷砖更暗或更亮。OTHH如果这些精细的细节很重要,你应该考虑使用OpenGL在3D中建立整个东西。OTOOH(三只手呼呼)也许你根本不应该使用VC++,而应该使用绘图软件包来实现这一点

这是一个代码概要说明,我还没有完全考虑清楚,这只是一个粗略的示意图,您需要了解这一点,修复我可能犯的任何问题和错误,并使其成为您自己的:-

int input_width, input_height, tile_width, tile_height;
int heights_width, heights_height, err=0, height, x, y;
char* input_pixels=NULL, *output_pixels=NULL, *tile_pixels=NULL;

char* modified_tile=NULL; int *heights_data=NULL;

if (!err) err =my_jpeg_read_func("koala.jpg",&width,&height,&input_pixels);
if (!err) err =my_png_read_func("ref-tile.png",&width,&height,&tile_pixels);
if (!err) err =my_read_tile_heights_func("tile-heights.csv",
  &heights_width,&heights_height,&heights_data);
if (!err) err =(output_pixels = malloc(input_width*input_height*3))==NULL;
if (!err) err =(modified_tile = malloc(tile_width*tile_height*4))==NULL;
if (!err) for (height=0; height<256; height++) for (x=0; x < heights_width; x++)
  for (y=0; y<heights_height; y++) if (heights_data[y*heights_width+x]==height) {
  int colorvalue = grabcolorvalue(input_pixels, input_widthh, input_height,
    heights_width, heights_height, x, y);
  create_colored_tile_by_color_space_warping(tile_pixels, modified_tile,
    tile_height, tile_width, colorvaLue);
  draw_tile(output_pixels, input_width, input_height, x, y, heights_width,
    heights_height, modified_tile, tile_width, tile_height);
}
if (!err) err=my_jpeg_wrapper_write("koala-out.jpg", output_pixels,
  input_width, input_height);
if (input_pixels) free(input_pixels); input_pixels=NULL;
if (output_pixels) free(output_pixels); output_pixels=NULL;
if (tile_pixels) free(tile_pixels); tile_pixels=NULL;
if (modified_tile) free(modified_tile); modifie_tile=NULL;
if (err) report_error_to_user(err);
int-input-u-width、input-u-height、tile-u-width、tile-u-height;
int heights\u width,heights\u height,err=0,height,x,y;
字符*输入像素=NULL,*输出像素=NULL,*平铺像素=NULL;
char*modified_tile=NULL;int*heights_data=NULL;
如果(!err)err=my_jpeg_read_func(“koala.jpg”、&width、&height、&input_像素);
如果(!err)err=my\u png\u read\u func(“ref tile.png”、&width、&height、&tile\u像素);
如果(!err)err=my\u read\u tile\u heights\u func(“tile heights.csv”,
&高度、宽度和高度、高度和数据);
如果(!err)err=(输出像素=malloc(输入宽度*输入高度*3))==NULL;
如果(!err)err=(修改的瓷砖=malloc(瓷砖宽度*瓷砖高度*4))==NULL;

如果(!err)for(height=0;height第二张图像中的考拉是一张3D图像……计算机无法从第一张图像中轻松计算出哪些位应该升高,哪些位应该降低

我建议一个>人<来做这项工作,尽管计算机可以帮助

如果你有一个所有瓷砖高度的列表,(可能是由一位图形艺术家自己创作的?)您可以一次一个地将它们渲染到空白帧缓冲区中。使用抗锯齿从最后面的分片到最前面依次渲染它们。似乎为每个分片选择的颜色值基于相应方形矩形中的平均颜色值(可能位于也可能不位于精确的像素边界上)但是,如何计算平均值我不清楚,它可能是基于RGB或HSV,它可以是一个简单的平均值或加权平均值,非线性或任何值,并且你可能需要考虑伽马校正(参见链接)。 假定画布上的瓷砖(渲染前)的颜色空间已扭曲,以匹配原始图像中相应区域的颜色

<>我忽略了微妙之处,我想你可能不关心或想腾出时间,比如阴影和高亮是否应该被修正为比深色或更轻的瓷砖更暗或更轻的颜色,而不是在颜色翘曲后的一些参考瓦片,以及场景中的反射。使用OpenGL.OTOOH(三只手呼呼)在3D中完成整个过程也许你根本不应该使用VC++,而应该使用绘图软件包来完成这项工作

这是一个代码概要说明,我还没有完全考虑清楚,这只是一个粗略的示意图,您需要了解这一点,修复我可能犯的任何问题和错误,并使其成为您自己的:-

int input_width, input_height, tile_width, tile_height;
int heights_width, heights_height, err=0, height, x, y;
char* input_pixels=NULL, *output_pixels=NULL, *tile_pixels=NULL;

char* modified_tile=NULL; int *heights_data=NULL;

if (!err) err =my_jpeg_read_func("koala.jpg",&width,&height,&input_pixels);
if (!err) err =my_png_read_func("ref-tile.png",&width,&height,&tile_pixels);
if (!err) err =my_read_tile_heights_func("tile-heights.csv",
  &heights_width,&heights_height,&heights_data);
if (!err) err =(output_pixels = malloc(input_width*input_height*3))==NULL;
if (!err) err =(modified_tile = malloc(tile_width*tile_height*4))==NULL;
if (!err) for (height=0; height<256; height++) for (x=0; x < heights_width; x++)
  for (y=0; y<heights_height; y++) if (heights_data[y*heights_width+x]==height) {
  int colorvalue = grabcolorvalue(input_pixels, input_widthh, input_height,
    heights_width, heights_height, x, y);
  create_colored_tile_by_color_space_warping(tile_pixels, modified_tile,
    tile_height, tile_width, colorvaLue);
  draw_tile(output_pixels, input_width, input_height, x, y, heights_width,
    heights_height, modified_tile, tile_width, tile_height);
}
if (!err) err=my_jpeg_wrapper_write("koala-out.jpg", output_pixels,
  input_width, input_height);
if (input_pixels) free(input_pixels); input_pixels=NULL;
if (output_pixels) free(output_pixels); output_pixels=NULL;
if (tile_pixels) free(tile_pixels); tile_pixels=NULL;
if (modified_tile) free(modified_tile); modifie_tile=NULL;
if (err) report_error_to_user(err);
int-input-u-width、input-u-height、tile-u-width、tile-u-height;
int heights\u width,heights\u height,err=0,height,x,y;
字符*输入像素=NULL,*输出像素=NULL,*平铺像素=NULL;
char*modified_tile=NULL;int*heights_data=NULL;
如果(!err)err=my_jpeg_read_func(“koala.jpg”、&width、&height、&input_像素);
如果(!err)err=my\u png\u read\u func(“ref tile.png”、&width、&height、&tile\u像素);
如果(!err)err=my\u read\u tile\u heights\u func(“tile heights.csv”,
&高度、宽度和高度、高度和数据);
如果(!err)err=(输出像素=malloc(输入宽度*输入高度*3))==NULL;
如果(!err)err=(修改的瓷砖=malloc(瓷砖宽度*瓷砖高度*4))==NULL;
如果(!err)表示(高度=0;高度请参见:

PS:您必须首先了解作者编写的CBitmapEx类。

请参阅:


PS:您必须首先了解作者编写的CBitmapEx类。

在不变灰的情况下浮雕图像的方法是校正整体色调和亮度,以匹配预浮雕瓷砖(即单一平面颜色),对于给定的瓷砖颜色而言,这是可能的。可能需要混合一些平淡的颜色,以获得更紧密的颜色匹配,但这可能是一种折衷。显然,接近光谱边缘的颜色存在基本限制-如果不使白色瓷砖变灰,则无法突出白色瓷砖,并且可以黑色瓷砖不能不变灰就变暗。这取决于你想要图像的样子。如果是我,我会