Interpolate Missing data and make line smooth
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi all
I have multiple images. each image has a line, I want to interpolate the missing value in the line and make the line smooth . and also auto correct the next pixel of line if it has the next point out of order. some images are attached
this is my input image
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/191881/image.jpeg)
the output is like that
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/191882/image.jpeg)
0 Kommentare
Antworten (1)
jonas
am 12 Jul. 2018
Try this.
GRAY=imread('204.jpg');
threshold = graythresh(GRAY);
BW = im2bw(GRAY, threshold);
%%Find Coordinates of images and smooth
[y,x]=find(BW==1);
win=15;
y=smooth(x,y,win);
%%interpolate
[x, index] = unique(x);
xq=1:256
yq = interp1(x, y2(index), xq,'linear','extrap');
%%Create figure from plot
out=zeros(size(BW));
out(sub2ind(size(GRAY),round(yq'),xq'))=1;
%%Plot
figure;
subplot(1,2,1)
imshow(out);
title('new')
subplot(1,2,2)
imshow(GRAY);
title('original')
0 Kommentare
Siehe auch
Kategorien
Mehr zu Interpolation finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!