Info

此问题已关闭。 请重新打开它进行编辑或回答。

showing error in elevanth line of this code ? please help me to get the output for this code immediately?

1 次查看(过去 30 天)
clc;
clear all;
format long;
I1=imread('colored.jpg');
I2=double(I1);
A=I2;
clear vision;
k=1;
for i=1:10:(960-96);
for j=1:10:(1280-128);
m1=max(max(A(i:i+95,j:j+127)));
m2=min(min(A(i:i+95,j:j+127)));
vision(k)=(m1-m2)/(m1);
k=k+1
end;
end;
visionk=mean(vision)
  1 个评论
Adam
Adam 2016-1-26
Please format your code using the {} Code block. Otherwise we don't see an 11th line.
Also please post exactly any error messages you get. Since you know it is the 11th line you should give us all the information you have if you want a quick answer,

回答(1 个)

Walter Roberson
Walter Roberson 2016-1-26
Line 11 of your source is a blank line.
Line 12 of your source will cause a problem if your image is not 960 x 1280 . You should never hard-code image sizes: you should use size() with a single output to find out how big the image is.
Note: color JPEG images are always 3 dimensional, but you are ignoring the third dimension; as a result you will be working entirely on the Red information. That might be fine with you, but it is not fine for other people reading the code, so if it is what you want, then take the time to add in the third dimension specifically, A(something,something,1) as otherwise you confuse yourself and you confuse anyone else trying to read the code.

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by