help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HELP :: if() problems encountered


From: Quentin Spencer
Subject: Re: HELP :: if() problems encountered
Date: Fri, 15 Sep 2006 10:33:30 -0500
User-agent: Thunderbird 1.5.0.7 (X11/20060913)

shoker_17 wrote:
Status            : Beginner

Version           : Octave 2.1.72
Purpose          : image Processing
Problem          : If () statement
Descriptions   : I was trying to manipulate a matrix in image intensity. The
main idea was to retrieve those data that were less than 1 from monoColor.

##to find the number of consecutive black pixels horizontally
##monoColor : image intensity of 32 rows and columns
for x = 1 : row
        for y = 1 : column
                if(monoColor(x,y) < 1)                 //tryin to find values 
in monoColor
less than 1
                        test(x,y)= monoColor(x, y);
                endif
          endfor
endfor

In the above code, i was trying to find the values in the matrix which are
less than 1.
However, to my dismay, I did not manage to get results i wanted. Instead, i
obtained the same number of rows and columns. Besides thism the values
smaller than 1 and 1 were also obtained.
Maybe i used the syntax wrongly  else "<1" doesnt seems to work at all.
*weird*

=============some monoColor image intensity==================

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 1 1 1 1 0.992156862745098 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0.996078431372549 1 0.988235294117647 1 0.996078431372549 0.996078431372549
1
 0.988235294117647 1 1 1 1 1 0.988235294117647 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 0.996078431372549 1 0.992156862745098 1 0.988235294117647 1
0.996078431372549 0.996078431372549

=============some monoColor image intensity==================

=============corresponding values in test array=================

 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 0 0 0 0 0.992156862745098 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0.996078431372549 0 0.988235294117647 0 0.996078431372549 0.996078431372549
0
 0.988235294117647 1 1 1 1 1 0.988235294117647 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 0.996078431372549 1 0.992156862745098 1 0.988235294117647 1
0.996078431372549 0.996078431372549

=============corresponding values in test array=================

H E L P !!

It looks like what you're trying to do is set all the values that are ==1 to zero. Is that right? See if the following give you the results you were expecting:

test = monoColor;
test(test==1) = 0;


Quentin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]