Remote sensing-change detection
3 views (last 30 days)
Show older comments
my aim is to calculate mean vector and spectral feature vector of the image pixel but i keep on getting this error,'??? Index exceeds matrix dimensions.'
*my main code
clear;close all;
im=imread('tileIndoAfter6.tif');
im1=imread('tileIndoBefore6.tif');
im2 = reshape(im,500*500,3);
im3 = reshape(im1,500*500,3);
fim = im2single(im2(:,:,2));
fim1 = im2single(im3(:,:,2));
P=path;
path(P,'C:\Documents and Settings\Digs Diggy\My Documents\MATLAB\my work\fuzzy_cluster\');
[bwfim0,level0]=fcmthresh(fim,0);
[bwfim1,level1]=fcmthresh(fim,1);
subplot(2,2,1);
imshow(fim);title('Original');
subplot(2,2,3);
imshow(bwfim0);title(sprintf('FCM0,level=%f',level0));
subplot(2,2,4);
imshow(bwfim1);title(sprintf('FCM1,level=%f',level1));
z=path;
path(z,'C:\Documents and Settings\Digs Diggy\My Documents\MATLAB\my work\fuzzy_cluster\');
[bwfim_0,level0]=fcmthresh1(fim1,0);
[bwfim_1,level1]=fcmthresh1(fim1,1);
figure(2);
subplot(2,2,1);
imshow(fim1);title('Original_image_Before');
subplot(2,2,3);
imshow(bwfim_0);title(sprintf('FCM0,level=%f',level0));
subplot(2,2,4);
imshow(bwfim_1);title(sprintf('FCM1,level=%f',level1));
figure(3);
%fimm=imdivide(bwfim,bwfimk);
fimm=bwfim-bwfimk;
fimml=bwfim0-bwfim_0;
subplot(2,2,2);
imshow(fimml);title(sprintf('FCMdiff0,level=%f',level0));
fimmml=bwfim1-bwfim_1;
subplot(2,2,3);
imshow(fimmml);title(sprintf('FCMdiff1,level=%f',level1));
0 Comments
Answers (1)
bym
on 24 Sep 2011
perhaps instead of
im2 = reshape(im,500*500,3);
im3 = reshape(im1,500*500,3);
you mean:
im2 = reshape(im,500,500,3);
im3 = reshape(im1,500,500,3);
BTW - formatting your code makes it easier to read, and thus more likely to get an answer
0 Comments
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!