??? Index exceeds matrix dimensions.

5 views (last 30 days)
Tahir
Tahir on 28 Mar 2014
Answered: Image Analyst on 28 Mar 2014
Hello I am working on a project in which i use deconvolution operation on a image of dataset..I taken code from the website...but when i apply it on my image it give the error "??? Index exceeds matrix dimensions" The code is....
H2 = ones(10,10) ./ 100;
sampleRGB_OD_Blur = zeros(height,width,channel);
for k=1:channel
sampleRGB_OD_Blur(:,:,k) = filter2(H2,sampleRGB_OD(:,:,k),'same');
end
% Manual sampling of three regions of interest from the micrograph to calculate
% relative optical intensity of each stains in three color channels
He = reshape(sampleRGB_OD_Blur(44,348,:),3,1); % ERROR
Eo = reshape(sampleRGB_OD_Blur(361,290,:),3,1);
Bg = reshape(sampleRGB_OD_Blur(425,77,:),3,1);
Please help The complete code is here... http://web.hku.hk/~ccsigma/color-deconv/color-deconv.html

Answers (1)

Image Analyst
Image Analyst on 28 Mar 2014
Before the error line, put this line:
whos sampleRGB_OD_Blur
[rows, columns, numberOfColorChannels] = size(sampleRGB_OD_Blur)
Don't use semicolons and look in the command window. What does it say? I bet it will say the size is not as big as 425 rows by 348 columns. After that, check out this link.

Community Treasure Hunt

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

Start Hunting!