hi i try to make spline interpolation between two curves but i get bad results any help ?
i want to connect blue and red curves. i try to remove the unique values get bad result of yellow line
build problem
z=zeros(1000,1000);figure(1)imshow(z);vv =[801 928 748 923 687 902 657 854 651 814 657 785 671 730 700 695];hold on,plot(vv(:,1),vv(:,2),'r'),plot(vv(:,1),vv(:,2),'r*')vf =[800 328 801 306 805 256 798 223];plot(vf(:,1),vf(:,2),'b'),plot(vf(:,1),vf(:,2),'b*')%% point vector
xxa=[vv(:,1);vf(:,1)];yya=[vv(:,2);vf(:,2)];[w1,id2,idx]=unique(xxa,'stable');xxas=xxa(id2);yyas=yya(id2);dataPoints=[xxa,yya];plot(dataPoints(:,1),dataPoints(:,2),'ko')plot(dataPoints(:,1),dataPoints(:,2),'ko')distF=[0 ;sqrt(sum(diff(dataPoints).^2,2))];distFSum=cumsum(distF);figure(2),plot(distF);grid on;title('distance between points')figure(3),plot(distFSum);grid on;title('sum distance between points')%% spline
sx=spline(xxas,distFSum(id2),linspace(min(xxa),max(xxa),100));sy=spline(yyas,distFSum(id2),linspace(min(yya),max(yya),100));figure(1)plot(sx,sy,'y','LineWidth',2)
Best Answer