My matlab
seamanj
这个作者很懒,什么都没留下…
展开
-
read selection
the format of .sel file is like: # per vertex status: 0=fixed, 1=deformable-region, 2=handle # 5261 vertices 1 1 1 1 2 1 1 1 0 1 1 1 1 function [group0, group1, group2] =原创 2017-01-18 22:51:37 · 268 阅读 · 0 评论 -
Laplacian surface editing
先讲下各个公式 公式(2)是laplacian coordinates的定义 公式(5)第一部分是保证laplacian coordinate坐标的一致性, 后面是handle点的约束 公式(8)是T的构造 公式(12)是求T中的系数 2D MATLAB 版在它的project里面自带, 这里将其拓展成3D版本, 源代码如下: func原创 2017-02-15 22:27:35 · 3404 阅读 · 2 评论 -
两个3*3*n旋转矩阵在第三维相乘
比较low的方法 for i = 1:n C(:,:,i) = A(:,:,i) * B(:,:,i); end elegant的方法, 用arrayfun arrayfun(@(M1,M2,n) M1(:,:,n)*M2(:,:,n), A, B, size(A,3) )原创 2017-02-04 00:11:23 · 2724 阅读 · 0 评论 -
arrayfun用法
arrayfun(@(n) norm(A(n,:)), 1:size(A,1)) 注意当返回不是标量的时候记得将'UniformOutput'参数改为0 arrayfun(@(n) norm(A(n,:)), 1:size(A,1), 'UniformOutput', 0);原创 2016-11-14 04:21:02 · 4175 阅读 · 0 评论 -
求cluster的质心坐标
c0 = arrayfun(@(x) mean(v0([x neighbors{x}],:)), 1:n, 'UniformOutput', 0); c0 = reshape(cell2mat(c0),3,[]); c0 = c0'原创 2017-02-16 00:56:44 · 1592 阅读 · 0 评论 -
scalar2color
function c = scalar2color(scalar, precision)%precision表示有多少间隙, % convert scalar to color vector % % % Copyright (c) 2017 seamanj@NCCA if size(scalar,2)>size(scalar,1) scalar = scalar'; end c原创 2017-02-02 04:09:04 · 1029 阅读 · 0 评论 -
perform_faces_reorientation
function faces = perform_faces_reorientation(vertex,faces, options) % perform_faces_reorientation - reorient the faces with respect to the center of the mesh % % faces = perform_faces_reorientation转载 2017-02-23 23:07:23 · 391 阅读 · 0 评论 -
perform_farthest_point_sampling_mesh
function [points,D] = perform_farthest_point_sampling_mesh( vertex,faces, points, nbr_iter, options ) % perform_farthest_point_sampling - samples points using farthest seeding strategy % % [points,D]转载 2017-02-23 22:58:14 · 1030 阅读 · 0 评论 -
my plot mesh
function options = my_plot_mesh(vertex,face,options) % plot_mesh - plot a 3D mesh. % % my_plot_mesh(vertex,face, options); % % 'options' is a structure that may contains: % - 'normal' : a (原创 2017-02-13 01:06:18 · 612 阅读 · 0 评论 -
export frames as pictures
function show_initilization %show_target(0.2, 1) %show_template('v4_mesh0.obj', 0.5, 1, 'interp') name = 'target.obj';% options = []; options.name = name; [vertex,faces] = read_mesh(name); vert原创 2017-02-23 19:42:01 · 488 阅读 · 0 评论 -
write frames to a video
%# figure figure, set(gcf, 'Color','white') Z = peaks; surf(Z); axis tight set(gca, 'nextplot','replacechildren', 'Visible','off'); [az,el]=view; xl=xlim; yl=ylim; zl=zlim; %# preallocate nFrames =原创 2017-02-23 19:40:07 · 679 阅读 · 0 评论 -
文章索引加1
for frame = 55:-1:0 before_name = strcat(strcat('Q:\CGI2017\bak\RenderByHoudini\v4_mesh',num2str(frame)),'.obj');% add photo prefix after_name = strcat(strcat('Q:\CGI2017\bak\RenderByHoudin原创 2017-02-14 02:08:01 · 320 阅读 · 0 评论 -
convert 3D matrix into diagonal block matrix
function M = mat3D2blk(A, d) M = reshape(permute(A,[1 3 2]), [],d); M = mat2cell(M,(size(M,1)/d)*ones(2,1),d); M = blkdiag(M{:});原创 2017-01-24 00:06:21 · 383 阅读 · 0 评论 -
how change files in matlab2 , cell 函数的运用
function main pics = dir('coil-20-proc');%list all the files in folder photo name = extractfield(pics, 'name');% extract name fields into a cell array index = ~ismember(name,[ {'.'},{'原创 2017-02-19 06:51:46 · 507 阅读 · 0 评论 -
map floats between 0 and 1 to colorvector
[vertices1, faces1] = read_mesh('dog6.obj'); [vertices1, faces1] = check_face_vertex(vertices1, faces1); X = vertices1(1,:); color = (X - min(X))./ (max(X) - min(X)); color = color'; colormap j...原创 2019-01-14 22:46:57 · 110 阅读 · 0 评论