Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

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

1 visualizzazione (ultimi 30 giorni)
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 Commento
Adam
Adam il 26 Gen 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,

Risposte (1)

Walter Roberson
Walter Roberson il 26 Gen 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.

Questa domanda è chiusa.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by