请matlab高手帮忙分析一下这个纹理合成程序中的子程序。详细解释每一步什么意思!

function best_match = best_match_pattern(target, SAMPLE_POOL, dist_func)global_definitions;min_dist = 1.0000e+100;s = block_size*block_size*source.dim;mask = reshape((target ~= 0), 1, s);best_match = zeros(size(target));for i=1:number_of_samples dist = dist_func(reshape(target, 1, s), reshape(SAMPLE_POOL(i).data, 1, s).*mask); if dist < min_dist best_match = SAMPLE_POOL(i).data; best_match_number = i; min_dist = dist; endendfprintf('patch number %d is the best choice, MSE: %d\n', best_match_number, sqrt(min_dist/s));end

第1个回答  2013-11-10
楼主可否贴代码时稍微排版一下。这个只是一个子函数,用来计算满足最小距离的匹配项。应该结合别的m文件综合来分析其具体用途。

Warning: Invalid argument supplied for foreach() in /www/wwwroot/www.t2y.org3v3b34/skin/templets/default/contents.html on line 47
相似回答
大家正在搜