• 大小: 44.2MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-07
  • 语言: 其他
  • 标签: opencv  

资源简介

OpenCV实现的图像2D转3D Image-2D-to-3D.rar 图像2D转3D,基于VS2015+opencv。可以实现2d图像转3d图像的功能

资源截图

代码片段和文件信息

% Converts the 2009 basel Face Model (BFM [1]) to a binary file that can be
% directly read byte for byte in C++. The workflow is to feed this
% generated “raw“ binary file into the bfm-binary-to-cereal app which
% reads this binary byte for byte and converts it to a cereal .bin file
% that is then readable by eos.
%
% [1]: A 3D Face Model for Pose and Illumination Invariant Face
% Recognition P. Paysan R. Knothe B. Amberg S. Romdhani and T. Vetter
% AVSS 2009.
% http://faces.cs.unibas.ch/bfm/main.php?nav=1-0&id=basel_face_model
%
% Developer notes:
%  - The BFM data type is single SFM is double
%  - The BFM Matlab file contains the “unnormalised“ orthonormal basis
%    (as do the Surrey .scm files).
%  - Domains:
%    Colour: BFM: [0 255] SFM: [0 1].
%    Shape: BFM: in mm (e.g. 50000) SFM: in cm e.g. 50.
%    (Note: I think that‘s wrong since we have to divide by 1000.)
%  - The BFM doesn‘t have any texture coordinates.
%
function [] = convert_bfm2009_to_raw_binary(bfm_file binary_out_file)

if (~exist(‘bfm_file‘ ‘var‘))
    bfm_file = ‘D:/Github/data/bfm/PublicMM1/01_MorphableModel.mat‘;
end
if (~exist(‘binary_out_file‘ ‘var‘))
    binary_out_file = ‘bfm.raw‘;
end

bfm = load(bfm_file);

f = fopen(binary_out_file ‘w‘);

fwrite(f size(bfm.shapeMU 1) ‘int32‘); % num vertices times 3
fwrite(f size(bfm.shapePC 2) ‘int32‘); % number of basis vectors

% Write the shape mean:
for i=1:size(bfm.shapeMU 1)
    fwrite(f bfm.shapeMU(i) ‘float‘);
end

% Write the unnormalised shape PCA basis matrix:
% All of basis 1 will be written first then basis 2 etc.
for basis=1:size(bfm.shapePC 2)
    for j=1:size(bfm.shapePC 1) % all data points of the basis
        fwrite(f bfm.shapePC(j basis) ‘float‘);
    end
end

% Write the shape eigenvalues:
for i=1:size(bfm.shapeEV 1)
    fwrite(f bfm.shapeEV(i) ‘float‘);
end

% Write num_triangles and the triangle list:
fwrite(f size(bfm.tl 1) ‘int32‘);
for i=1:size(bfm.tl 1)
    fwrite(f bfm.tl(i 1) ‘int32‘);
    fwrite(f bfm.tl(i 2) ‘int32‘);
    fwrite(f bfm.tl(i 3) ‘int32‘);
end

% Now just exactly the same for the colour (albedo) model:
fwrite(f size(bfm.texMU 1) ‘int32‘); % num vertices times 3
fwrite(f size(bfm.texPC 2) ‘int32‘); % number of basis vectors

% Write the colour mean:
for i=1:size(bfm.texMU 1)
    fwrite(f bfm.texMU(i) ‘float‘);
end

% Write the unnormalised colour PCA basis matrix:
% All of basis 1 will be written first then basis 2 etc.
for basis=1:size(bfm.texPC 2)
    for j=1:size(bfm.texPC 1) % all data points of the basis
        fwrite(f bfm.texPC(j basis) ‘float‘);
    end
end

% Write the colour eigenvalues:
for i=1:size(bfm.texEV 1)
    fwrite(f bfm.texEV(i) ‘float‘);
end

fclose(f);

end

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     180154  2016-11-11 17:44  图片转3D-vs2015源码\bin\current_merged.isomap.png

     文件         61  2016-11-11 17:44  图片转3D-vs2015源码\bin\current_merged.mtl

     文件     382432  2016-11-11 17:44  图片转3D-vs2015源码\bin\current_merged.obj

     文件     901632  2016-11-11 17:37  图片转3D-vs2015源码\bin\fit-model.dll

     文件     837462  2016-09-09 00:33  图片转3D-vs2015源码\bin\haar_roboman_ff_alt2.xml

     文件       5466  2016-11-11 17:37  图片转3D-vs2015源码\bin\lib\fit-model.lib

     文件    1312394  1998-05-13 00:00  图片转3D-vs2015源码\bin\lib\GLAUX.LIB

     文件     281360  2006-03-04 03:19  图片转3D-vs2015源码\bin\lib\glew32.lib

     文件    1929072  2016-10-12 14:25  图片转3D-vs2015源码\bin\lib\glew32s.lib

     文件    1331572  2016-10-12 15:38  图片转3D-vs2015源码\bin\lib\glew32sd.lib

     文件      12648  1998-05-13 00:00  图片转3D-vs2015源码\bin\lib\GLU32.LIB

     文件     925754  2016-05-07 16:25  图片转3D-vs2015源码\bin\lib\libboost_filesystem-vc140-mt-s-1_61.lib

     文件    8295554  2016-05-07 16:27  图片转3D-vs2015源码\bin\lib\libboost_program_options-vc140-mt-s-1_61.lib

     文件      81112  2016-05-07 16:24  图片转3D-vs2015源码\bin\lib\libboost_system-vc140-mt-s-1_61.lib

     文件     283124  2016-10-19 13:37  图片转3D-vs2015源码\bin\lib\opencv_calib3d310.lib

     文件     655854  2016-10-19 10:32  图片转3D-vs2015源码\bin\lib\opencv_core310.lib

     文件     175428  2016-10-19 12:04  图片转3D-vs2015源码\bin\lib\opencv_imgcodecs310.lib

     文件     277898  2016-10-19 10:47  图片转3D-vs2015源码\bin\lib\opencv_imgproc310.lib

     文件     250430  2016-10-19 12:07  图片转3D-vs2015源码\bin\lib\opencv_objdetect310.lib

     文件    1805312  2016-10-19 13:37  图片转3D-vs2015源码\bin\opencv_calib3d310.dll

     文件    9763328  2016-10-19 10:32  图片转3D-vs2015源码\bin\opencv_core310.dll

     文件    1010688  2016-10-19 13:37  图片转3D-vs2015源码\bin\opencv_features2d310.dll

     文件     979456  2016-10-19 13:40  图片转3D-vs2015源码\bin\opencv_flann310.dll

     文件    2966528  2016-10-19 12:04  图片转3D-vs2015源码\bin\opencv_imgcodecs310.dll

     文件   20957696  2016-10-19 10:48  图片转3D-vs2015源码\bin\opencv_imgproc310.dll

     文件     949248  2016-10-19 13:37  图片转3D-vs2015源码\bin\opencv_ml310.dll

     文件    1118720  2016-10-19 12:07  图片转3D-vs2015源码\bin\opencv_objdetect310.dll

     文件     600576  2016-10-19 12:06  图片转3D-vs2015源码\bin\opencv_videoio310.dll

     文件    1048630  2016-11-11 17:44  图片转3D-vs2015源码\bin\output\out.isomap.bmp

     文件         50  2016-11-11 17:44  图片转3D-vs2015源码\bin\output\out.mtl

............此处省略8041个文件信息

评论

共有 条评论