-4

我有 3D 矩阵,我想删除一些不连续性,我想更改统计属性。我的意思是,我不想更改全局统计属性。

有什么解决办法吗?

4

2 回答 2

2

我使用自制算法得到以下结果: 在此处输入图像描述

想法如下:

  • 我们首先使用边缘检测来检测不连续性,将两个方向和阈值的结果相加。
  • 我们由此创建了两张图像:一张在每个方向都有线条。
  • 我们使用一维高斯滤波器创建原始图像的两个低通版本:一个在每个方向上进行滤波。
  • 我们还对包含线条的图像进行低通滤波:它们将用作权重。
  • 我们通过计算组成最终图像: (low-pass_line_image) .* filtered_image + (1 - low-pass_line_image) .* original_image。我们在两个方向上执行此操作。

这是代码:

    % 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);
于 2012-12-06T20:03:12.943 回答
0

也许,您可以使用 Efros 等人提出的纹理合成算法:

http://graphics.cs.cmu.edu/people/efros/research/EfrosLeung.html

于 2012-12-06T18:44:10.257 回答