How to interpolate missing z-values: looking for ideas

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 commentaires

Have you tried using the hough transform to detect the lines.
You can refer to the example https://www.mathworks.com/help/images/ref/houghlines.html
I do recall giving it a try a few weeks ago, and it did not really work. I did a little reading on hough transform and, from what I understood, it works the best when the fetutes/patterns can be parameterized (say, for example a line or a circle etc) with a few parameters (x,y, theta for a line, for example). Thanks.
Any other ideas, anyone? Thanks!
Akira Agata
Akira Agata le 15 Août 2022
Modifié(e) : Akira Agata le 15 Août 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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

Produits

Version

R2021b

Question posée :

le 10 Août 2022

Modifié(e) :

le 15 Août 2022

Community Treasure Hunt

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

Start Hunting!

Translated by