Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

2D-Filter. How to filter inclined flat noisy surface

Status
Not open for further replies.

pavel47

Member level 4
Joined
Nov 8, 2005
Messages
68
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Switzerland
Activity points
1,790
Hello,

In my project I need filter image from 3D scanner. The image delivered by such scanner is noisy and need to be filtered.
I did some excercises in Matlab. The filter I constructed is simple. Its frequency characteristic (OTF) merely repeats the most pronounced features of 3D scanner dâta FFT:
Code:
OTF = zeros(120, 160);
OTF(1,:) = 1;
OTF(:,1) = 1;

plan_rotated_filtered_FFT_2.jpg

But the filtering isn't sufficient. If somebody has an idea how to filter moreover ?

Thanks in advance.

Pavel.

P.S. 1. Here is my approach in Matlab
Code:
clc;
clear;
close all;

points1 = 500;
ampl1=5;
points2 = 20;
ampl2=100;

corners = [0 0; 160 0; 160 120; 0 120];
x1 = vertcat(corners(:,1), rand(points1,1)*160);
y1 = vertcat(corners(:,2), rand(points1,1)*120);
z1 = ampl1*(rand(points1+4,1)-0.5);

x2 = rand(points2,1)*160;
y2 = rand(points2,1)*120;
z2 = ampl2*(rand(points2,1)-0.5);

x = vertcat(x1, x2);
y = vertcat(y1, y2);
z = vertcat(z1, z2);

F = TriScatteredInterp(x,y,z,'linear');
[qx,qy] = meshgrid(0:159,0:119);
scan = F(qx,qy);
scanID = zeros(120, 160);

for i=-size(scan,1)/2+1:size(scan,1)/2
    for j=-size(scan,2)/2+1:size(scan,2)/2
        k=i+size(scan,1)/2;
        l=j+size(scan,2)/2;
        scan_3D{k,l} = [i j scan(k,l)];
        scanID_3D{k,l} = [i j scanID(k,l)];
    end
end

alfa = 30;
beta = 30;
gama = 0;

yaw = beta*pi/180;  
pitch = alfa*pi/180; 
roll = gama*pi/180;
dcm = angle2dcm(yaw, pitch, roll);

for i=1:size(scan,1)
    for j=1:size(scan,2)
        scan_3Dr{i,j} = dcm*scan_3D{i,j}';
        scan_r(i,j) = scan_3Dr{i,j}(3);
        
        scanID_3Dr{i,j} = dcm*scanID_3D{i,j}';
        scanID_r(i,j) = scanID_3Dr{i,j}(3);
    end
end

subplot(2,2,1);
surf(scan);
Title('Original');

subplot(2,2,2);
surf(scan_r);
Title('Rotated');

scan_r_FFT = fft2(scan_r);
OTF = zeros(120, 160);
OTF(1,:) = 1;
OTF(:,1) = 1;

G = scan_r_FFT .* OTF;
scan_r_filt = real(ifft2(G));

subplot(2,2,3);
surf(scan_r_filt);
Title('Filtered');

subplot(2,2,4);
surf(OTF);
Title('OTF');

figure;
subplot(1,2,1);
imagesc(log(1 + abs(fftshift(scan_r_FFT))));
Title('FFT');

subplot(1,2,2);
imagesc(log(1 + abs(fftshift(OTF))));
Title('OTF');

 

I see dark blue pixels next to light blue ones. And orange pixels next to yellow ones. Do I take it you want to even out the extremes between pixels?

You've probably tried the averaging method already.

You're filling a new (target) canvas one pixel at a time. Take a single pixel, and average all values of pixels that touch it. This will be nine pixels total. Put the average figure as the value of the pixel in your target grid.

Do this for each pixel of your target grid.

You can average pixels in a 5x5 grid, etc. Depending on what smoothness of transition you want. Or create a third canvas and fill it from your second grid by doing the same process a second time, etc.

I'm not acquainted with your programming language and I suspect you're already using a more sophisticated algorithm. So ignore this post if I'm behind the curve.
 

First, thanks for response.

You've probably tried the averaging method already

Average methods don't fit application, because the main purpose of a filter is to eleimunate spikes.
I search for a solution of very low frequency 2D-filter.
I didn't find any document where expained how to design such filter.
Classical approach based on cut-off frequency, attenuation in stop-band, etc. ... seems doesn't exist in 2D.

Regards.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top