Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
showing error in elevanth line of this code ? please help me to get the output for this code immediately?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Adam
am 26 Jan. 2016
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,
Antworten (1)
Walter Roberson
am 26 Jan. 2016
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.
0 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!