How to interpolate missing z-values: looking for ideas
3 views (last 30 days)
Show older comments
Hello Everyone,
I have an image that represents a magnetic (field) anomaly map (attached below). I had (x,y,z) data (.xyz file). Here, x-axis represents longitude values, y-axis represents latitude values, and z values are simply the anomaly values. I loaded the data on matlab and then saved it as a binary image (using imwrite). White pixels (255) represent anomaly values, and black pixels (0) represent background.
The anomaly values (in white) show dominantly linear patterns (marked with red lines), and are oriented nearly north-south. However, as the image shows, the linear patterns show discontinuities due to missing data (labelled in 2 places, with green rectangular boxes). Is there any way that I could fill these blanks (region of missing data) with some kind of interpolation, approaching from either end of the gap? Any other ideas would be appreciated? Thank you so much.
I have tried the function imclose (code attached below), but it was not helpful (see the output image below). I have attached my script for 'imclose' below. Thanks!
Script for 'imclose':
close all
clear all
% Use the imclose function to fill appropriate gaps in input image
figure
ima = gapClose('testimg.bmp',17,-82);
function [ima] = gapClose (imb, len, deg)
%% Input parameteres
% imb = Input image (image before gap completion is applied)
% Optional parameters (takes default values if left blank)
% len = length of the line for the function strel ('line')
% deg = orientation of the line (in degrees) for the function strel
% ima = Output image
imb = imread(imb);
% if len ==
se2 = strel('line', len, deg); % create line elements using 'strel'
ima=imclose(imb,se2); % apply imclose to fil the gaps
montage({imb,ima},'ThumbnailSize',[]) % display before and after images side by side
end
4 Comments
Akira Agata
on 15 Aug 2022
Edited: Akira Agata
on 15 Aug 2022
The original (x,y,z) data (.xyz file) should have much more information than the attached binary image data.
Therefore, I think it would be better to start this analysis from the original (x,y,z) data.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!