Clean noisy data from images

조회 수: 14 (최근 30일)
alberto tonizzo
alberto tonizzo 2024년 4월 4일
댓글: Mathieu NOE 2024년 4월 16일
Hey there,
I've been working with some images, averaging them out and plotting against depth (check out the code below). I'm trying to tidy up the data by getting rid of points that don't fit an exponential curve I've fitted to it. I've tried a couple of methods like filloutliers and sgolayfilt, but they haven't been working out too well. I used polyfit(depth_Sony, log(img_B_Masked_avg), 1) to fit the blue ('B') channel averages but the fit is not good because of the points that are off.
Any suggestions on a better approach? Thanks a bunch!
figure;
semilogy(depth_Sony, img_gray_Masked_avg, 'ko', 'MarkerSize', ms);
hold on;
semilogy(depth_Sony, img_R_Masked_avg, 'ro', 'MarkerSize', ms);
semilogy(depth_Sony, img_G_Masked_avg, 'go', 'MarkerSize', ms);
semilogy(depth_Sony, img_B_Masked_avg, 'bo', 'MarkerSize', ms);
xlabel('depth');
ylabel('mask avg value');
xlim([0 10]);
ylim([0.5*10^-1 10^1]);
  댓글 수: 2
cui,xingxing
cui,xingxing 2024년 4월 5일
Based on your description, image denoising the code you posted I don't see any direct relationship.
Actually MATLAB already contains many methods, traditional and deep learning cases are as follows:
alberto tonizzo
alberto tonizzo 2024년 4월 5일
Thank you @cui,xingxing the question is more about denoising this particular dataset. Notice that the variables "img_R_Masked_avg" are vectors, not images.

댓글을 달려면 로그인하십시오.

채택된 답변

Mathieu NOE
Mathieu NOE 2024년 4월 15일
hello
this is a simple exponential fit using polyfit
I had to do a bit of manual tweaks first to slect the appropriate data
here an example on the "blue" curve
figure;
ms = 2;
ind = depth_Sony>2.5 & depth_Sony<8.5; % select valid x range (avoid large clouds)
xx = depth_Sony(ind);
yy = img_B_Masked_avg(ind);
[yy,k] = rmoutliers(yy, 'movmedian', 300, 'ThresholdFactor', 2); % remove large dips
xx(k) = [];
[b,m] = myexpfit(xx,yy); % see function below
img_B_Masked_fit = b*exp(depth_Sony*m);
semilogy(depth_Sony, img_B_Masked_avg, 'bo',xx, yy, '*r',depth_Sony, img_B_Masked_fit, 'g--', 'MarkerSize', ms);
TE = sprintf('C = %0.2fe^{%0.3ft}',b, m);
legend('raw data','extracted data',TE);
xlabel('depth');
ylabel('mask avg value');
% xlim([0 10]);
% ylim([0.5*10^-1 10^1]);
%%%%%%%%%%%
function [b,m] = myexpfit(x,y)
% exponential fit using polyfit
P = polyfit(x, log(y), 1);
m = P(1);
b = exp(P(2));
% yfit = b*exp(x*m);
end
  댓글 수: 2
alberto tonizzo
alberto tonizzo 2024년 4월 16일
Thank you! That looks good!
Mathieu NOE
Mathieu NOE 2024년 4월 16일
tx !
as always, my pleasure !

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by