??? Index exceeds matrix dimensions.

1 次查看(过去 30 天)
Tahir
Tahir 2014-3-28
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

回答(1 个)

Image Analyst
Image Analyst 2014-3-28
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.

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by