Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Subscripted assignment dimension mismatch.???
    3 ビュー (過去 30 日間)
  
       古いコメントを表示
    
function [J] =  gabor_fn2(I)
clc; 
I=imread('e:\fingerprint3.jpg');
imshow(I); 
 I2 = imcrop(I); 
figure, imshow(I2) 
m=size(I2,1); 
n=size(I2,2); 
%%Gabor 
phi = 7*pi/8; 
theta = 2; 
sigma = 0.65*theta;
for i=1:3  
 for j=1:3 
      xprime= j*cos(phi); 
      yprime= i*sin(phi);   
    K = exp(2*pi*theta*sqrt(-1)*(xprime+ yprime)); 
      G= exp(-(i.^2+j.^2)/(sigma^2)).*abs(K);   
end 
end 
%%Convolve 
for i=1:m   
for j=1:n  
    J(i,j)=conv2(I2,G);   
end 
end 
figure,imshow(unit8(J))
Error in ==> gabor_fn2 at 26
    J(i,j)=conv2(I2,G);
0 件のコメント
回答 (1 件)
  Wayne King
    
      
 2012 年 2 月 20 日
        The problem is that the output of conv2(I2,G) should be the same size as I2 the way that you have written the code.
In your code above, G, is a scalar, so you have constructed a for loop:
for ii=1:m 
    for jj =1:n 
        J(ii,jj)=conv2(I2,G); 
    end
end
that is convolving a matrix with a scalar.
For example:
G = 2;
x = randn(10,10);
size(conv2(x,G))
You cannot then assign this result to J(ii,jj). For example:
J(1,1) = conv2(x,G);
throws the error you are getting for the reasons I explained.
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

