分配特定的RGB颜色,三维网格/面/分 [英] Assign specific RGB colours to 3d mesh/surface/points

查看:462
本文介绍了分配特定的RGB颜色,三维网格/面/分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

面部和特征的地标

我有一个标有脸特征的面部图像。该图像被存储在标准的JPEG格式和地标被存储在 [XY] 格式(X,点的y对应于它的在图像上的坐标如下所示)


插值三维人脸目

我已生成深度信息(三维目)为每个标记点,并且具有在 [XYZ] 格式,其中坐标x和y是一个矩阵相同的点。

稀疏网格看起来是这样的:

然后我插了的xrange yrange zrange 以获得更好的网格。使用目(的xrange,yrange,zrange)给我下

的颜色进行人脸图像的像素可以用得到 imread(face_image.jpg)。 鉴于各内插点的(X,Y)值对应到(x,y)的图像中,是有可能使象素的颜色位于(X,Y,Z)[3DMESH] 相同颜色(X,Y)的人脸图像]

这将有效地塞给/扭曲的脸在the3d网,给我一个三维人脸模型。

解决方案

我建议这样的:

  N = 50000; %的人选择合适的东西
[C,图] = rgb2ind(FaceImageRGB,N);
 

要在RGB图像中的颜色映射到一个线性指标。 确保网格和RGB图像具有相同的XY尺寸

然后使用冲浪来绘制与颜色的索引值的表面(应该是形式冲浪(X,Y,Z,C ))和地图彩色地图。

 冲浪(3DMESH,C),遮光持平;
颜色表(图)
 

编辑:工作示例(用的多彩的图像此时...):

<$p$p><$c$c>rgbim=imread('http://upload.wikimedia.org/wikipedia/commons/0/0d/Loriculus_vernalis_-Ganeshgudi,_Karnataka,_India_-male-8-1c.jpg'); N = 50000; %的人选择的东西apropriate [C,图] = rgb2ind(rgbim,N); %创作网格具有相同的尺寸与图像的: [X,Y] = meshgrid( - 地板(尺寸(rgbim,2)/ 2):楼(大小(rgbim,2)/ 2), - 地板(尺寸(rgbim,1)/ 2):楼(大小( rgbim,1)/ 2)); %的任意函数关于Z: Z = - (十^ 2 + Y。^ 2); %显示表面的图像颜色值: 冲浪(X,Y,Z,双(C)),遮光平 颜色表(图)

结果:

Face and feature landmarks

I have a face image that has labelled face features. The image is stored in standard JPEG format and the landmarks are stored in [x y] format (x,y of point corresponds to its coordinates on the image as shown below)


Interpolated 3d face mesh

I have generated depth information (a 3d mesh) for each of the labelled points, and have a matrix in [x y z] format, where the coordinates x and y are the same as that of the points.

The sparse mesh looks like this:

I then interpolated over xrange, yrange and zrange to get a better mesh. Using mesh(xrange,yrange,zrange) gives me the following

The colours for face image pixels can be obtained using imread(face_image.jpg). Given that the (x,y) value of each of the interpolated point corresponds to (x,y) in the image, is it possible to make the colour of the pixel at (x,y,z)[3dmesh] the same as colour of (x,y)[face image]?

This would effectively superimpose/warp the face on the3d mesh, giving me a 3d face model.

解决方案

I would suggest this:

n=50000; % chose something appropriate
[C,map] = rgb2ind(FaceImageRGB,n);

To map the color in your RGB image into a linear index. Make sure the mesh and the RGB image have the same x-y dimensions.

Then use surf to plot the surface with the indexed values for color (should be in the form surf(X,Y,Z,C)) and the map as color map.

surf(3dmesh, C), shading flat;
colormap(map);

Edit: a working example (with a colorful image this time...):

rgbim=imread('http://upload.wikimedia.org/wikipedia/commons/0/0d/Loriculus_vernalis_-Ganeshgudi,_Karnataka,_India_-male-8-1c.jpg');

n=50000; % chose something apropriate
[C,map] = rgb2ind(rgbim,n);    

% Creation of mesh with the same dimensions as the image:
[X,Y] = meshgrid(-floor(size(rgbim, 2)/2):floor(size(rgbim, 2)/2), -floor(size(rgbim, 1)/2):floor(size(rgbim, 1)/2));

% An arbitrary function for Z:
Z=-(X.^2+Y.^2);

% Display the surface with the image as color value:
surf(X, Y, Z, double(C)), shading flat
colormap(map);

Result:

这篇关于分配特定的RGB颜色,三维网格/面/分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆