Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
cubic spline error

Subject: cubic spline error

From: sayed

Date: 16 Dec, 2013 18:18:06

Message: 1 of 2

How can transfer the contents of an image"DN value" to another image using interpolation algorithm.I mahed the folowing code but cubic spline generate this massege"Error using ./
Integers can only be combined with integers of the same
class, or scalar doubles.

Error in spline (line 59)
dd = ones(yd,1); dx = diff(x); divdif =
diff(y,[],2)./dx(dd,:);

Error in splncore (line 40)
     values =
     spline(x{i},reshape(values,prod(nv(1:d-1)),nv(d)),xi{i}).';
     
Error in interp2>spline2 (line 579)
    F = splncore(varargin(2:-1:1),varargin{3},{yyi(:).'
    xxi},'gridded');

Error in interp2 (line 238)
        zi = spline2(x,y,z,xi,yi,ExtrapVal);

Error in interpolation (line 26)
   I(i,j)= interp2(f,j,i,'spline'); "

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 clear all; close all; clc;
%I = imread('F:\phase2\imm\1.tif');
I = imread('image_shift.tif');
%imshow(I);
[n m] =size(I);
for i=1:n;
    for j=1:m;
        I(i,j)=0;
    end
end
%imwrite(I, 'F:\phase2\11_t.tif');
%imshow(I)
%h = imread('F:\phase2\11_t.tif');
%[x y]=size(h);
%f = imread('F:\phase2\imm\2.tif');
f = imread('original.tif');
%[x1 y1]=size(f);
%g =interp2(x,y,z,x1,y1,'cubic');
%imwrite(g, 'F:\phase2\12.tif');
%imshow(f)

%nerest naber
for i=1:n-1;
    for j=1:m-1;
   I(i,j)= interp2(f,j,i,'spline');
    end
end
imwrite(I, 'interpolation.tif');
%d = imread('F:\phase2\t.tif');

imshow(I);

Subject: cubic spline error

From: sayed

Date: 17 Dec, 2013 10:57:18

Message: 2 of 2

"sayed" wrote in message <l8ng4u$73g$1@newscl01ah.mathworks.com>...
> How can transfer the contents of an image"DN value" to another image using interpolation algorithm.I mahed the folowing code but cubic spline generate this massege"Error using ./
> Integers can only be combined with integers of the same
> class, or scalar doubles.
>
> Error in spline (line 59)
> dd = ones(yd,1); dx = diff(x); divdif =
> diff(y,[],2)./dx(dd,:);
>
> Error in splncore (line 40)
> values =
> spline(x{i},reshape(values,prod(nv(1:d-1)),nv(d)),xi{i}).';
>
> Error in interp2>spline2 (line 579)
> F = splncore(varargin(2:-1:1),varargin{3},{yyi(:).'
> xxi},'gridded');
>
> Error in interp2 (line 238)
> zi = spline2(x,y,z,xi,yi,ExtrapVal);
>
> Error in interpolation (line 26)
> I(i,j)= interp2(f,j,i,'spline'); "
>
> \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
>
> clear all; close all; clc;
> %I = imread('F:\phase2\imm\1.tif');
> I = imread('image_shift.tif');
> %imshow(I);
> [n m] =size(I);
> for i=1:n;
> for j=1:m;
> I(i,j)=0;
> end
> end
> %imwrite(I, 'F:\phase2\11_t.tif');
> %imshow(I)
> %h = imread('F:\phase2\11_t.tif');
> %[x y]=size(h);
> %f = imread('F:\phase2\imm\2.tif');
> f = imread('original.tif');
> %[x1 y1]=size(f);
> %g =interp2(x,y,z,x1,y1,'cubic');
> %imwrite(g, 'F:\phase2\12.tif');
> %imshow(f)
>
> %nerest naber
> for i=1:n-1;
> for j=1:m-1;
> I(i,j)= interp2(f,j,i,'spline');
> end
> end
> imwrite(I, 'interpolation.tif');
> %d = imread('F:\phase2\t.tif');
>
> imshow(I);




\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Dear members : thanks a lot
I have solved in my problem in my code . it was needed convert my image from integer to double, because cubic spline select many points .
sayed
   

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us