sketch recognition

3 次查看(过去 30 天)
stephanie borg
stephanie borg 2011-4-6
I AM USING THIS PROGRAM FOR SKETCH RECOGNITION HOWEVER IT IS GIVING ME THE ERROR ??? Subscripted assignment dimension mismatch.
Error in ==> sym_rec_main2 at 60 I3Dtotal(:,:,2) = Ibw3D2;
WHAT AM I DOING WRONG?
I3D1 = imread('IMG_0001.jpg');
I3D2 = imread('IMG_0002.jpg');
I3D3 = imread('IMG_0003.jpg');
I3D4 = imread('IMG_0004.jpg');
size3Dr = input('Enter number of training sets');
size3Dc = input('Enter number of different symbols');
sizer = size3Dr; %Assuming equal traning sets
sizec = size3Dc;
noimages = sizer/6;
Igray1 = rgb2gray(I3D1);
Ibw3D1 = im2bw(Igray1,graythresh(Igray1));
Igray2 = rgb2gray(I3D2);
Ibw3D2 = im2bw(Igray2,graythresh(Igray2));
Igray3 = rgb2gray(I3D3);
Ibw3D3 = im2bw(Igray3,graythresh(Igray3));
Igray4 = rgb2gray(I3D4);
Ibw3D4 = im2bw(Igray3,graythresh(Igray4));
I3Dtotal(:,:,1) = Ibw3D1;
I3Dtotal(:,:,2) = Ibw3D2;
I3Dtotal(:,:,3) = Ibw3D3;
I4Dtotal(:,:,3) = Ibw3D4;
rfactor = 1; crpval = 0;
for i = 1 : noimages
I = I3Dtotal(:,:,i);
img = sym_rec_img_preprocess(I, size3Dr, size3Dc, noimages);
for cnt = 1:((size3Dr*size3Dc)/noimages)
bw2 = img_crop(img{cnt}, rfactor, crpval);
charvec = img_resize(not(bw2));
out3D(:,cnt,i) = charvec;
end
end

回答(2 个)

Walter Roberson
Walter Roberson 2011-4-6
Use size() to check that all of the I3D* image arrays are the same size.
  5 个评论
Walter Roberson
Walter Roberson 2011-4-6
It is 07:00 here and I am going to bed in a moment. It is better to post your questions as others may be able to answer them. Especially if they are questions about the sketch recognition portion, as I am not familiar with the techniques used for sketch recognition.
stephanie borg
stephanie borg 2011-4-6
ok i understand. because this program is supposed to work. im afraid i have something wrong in the sketches but i dont know.

请先登录,再进行评论。


Tim Zaman
Tim Zaman 2011-4-6
The images you are using in this code have to be the exact amount of pixels: so if image 1 is 800x600, image 2 has to be 800x600 too. Common error with image processing.
  2 个评论
stephanie borg
stephanie borg 2011-4-6
you're right! they're not the same.. do you know from where i can change that? thanks
Walter Roberson
Walter Roberson 2011-4-6
You could use the imresize() suggestion I made earlier. You will have to decide whether you want to size the small images up, or the larger images down.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Feature Detection and Extraction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by