【发布时间】:2012-11-24 20:18:21
【问题描述】:
我有 3D 矩阵,我想删除一些不连续性,我想更改统计属性。我的意思是,我不想更改全局统计属性。
有什么办法吗?
【问题讨论】:
标签: image matlab image-processing pattern-matching
我有 3D 矩阵,我想删除一些不连续性,我想更改统计属性。我的意思是,我不想更改全局统计属性。
有什么办法吗?
【问题讨论】:
标签: image matlab image-processing pattern-matching
也许,你可以使用 Efros 等人提出的纹理合成算法:
http://graphics.cs.cmu.edu/people/efros/research/EfrosLeung.html
【讨论】:
我使用自制算法得到以下结果:
思路如下:
代码如下:
% Load and treat image
im = imread('...');
im = im2double(im);
im = rgb2gray(im);
% Compute edges of the image
bw = edge(im);
% We want to find the positions of the strong lines in the image :
% Since they go through the whole image, we sum among x and y directions
% and then threshold.
xedges = sum(bw);
xedges = xedges > 1/3*max(xedges(:));
yedges = sum(bw,2);
yedges = yedges > 1/3*max(yedges(:));
% We create images of the same size that the original one and containing
% the horizontal and vertical lines
[xedges, yedges] = meshgrid(xedges, yedges);
% We create a 1D gaussian filter
gaussian = gausswin(12);
gaussian = gaussian / sum(gaussian);
% We filter the image among both directions
imfy = imfilter(im, gaussian);
imfx = imfilter(im, gaussian');
% We also filter the images with the lines to get the weights
xedges = im2double(xedges);
xedges = imfilter(xedges, gaussian');
xedges = xedges / max(xedges(:));
yedges = im2double(yedges);
yedges = imfilter(yedges, gaussian);
yedges = yedges / max(yedges(:));
% We use the filtered versions of the images with lines as weights between
% the original image and the filtered images
imfinal = xedges.*imfx + (1-xedges).*im;
imfinal = yedges.*imfy + (1-yedges).*imfinal;
imshow(imfinal);
【讨论】: