How to subtract false color gradient ?

Hi! I am trying to subtract a False color gradient from my image. I tried using the "detrend" function to subtract the polynomial trend, but it seems like I might be subtracting too much. I get some weird lines across my image.
This is the image before the gradient correction:
and this is how it looks after:
And this is my code:
% Calculate strain
strainNorm = (dspacingNorm - dspacingNominal) / dspacingNominal;
% Gradient Correction
D = detrend(strainNorm,1,'omitmissing');
figure; imagesc(xbins,ybins,D * 100);
title('Elastic lattice strain (%)'); colorbar; axis square; axis equal; % axis([0 xbins(end) 0 ybins(end)])
colormap jet; caxis([strainMin strainMax])
set(gca,'xtick',[]); set(gca,'xticklabel',[]); set(gca,'ytick',[]); set(gca,'yticklabel',[])
Thank you!

답변 (1개)

Matt J
Matt J 2023년 7월 3일
편집: Matt J 2023년 7월 3일

0 개 추천

detrend() operates column by column. I suspect you can avoid the lines by subtracting a plane fit to the whole surface instead, e.g., using planarFit() from this FEX download,

댓글 수: 2

Edith Celeste
Edith Celeste 2023년 7월 4일
Maybe I am not applying it right, but planarFit() is not working for my code
Matt J
Matt J 2023년 7월 4일
Maybe I am not applying it right
I would have to assume that.

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

카테고리

도움말 센터File Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

질문:

2023년 7월 3일

댓글:

2023년 7월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by