help-octave
[Top][All Lists]
Advanced

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

Re: floor()


From: shoker_17
Subject: Re: floor()
Date: Mon, 16 Oct 2006 19:35:28 -0700 (PDT)

Octave Version : 2.1.72 (i486-pc-linux-gnu)

Packages Installed:
1. Octave
2. octave-forge
3. xloadimage
4. octave-gpc
5. imagemagick
6. octave-plplot
7. octave-sp
8. octave-headers
9. octave-info

Problems:
I guess its not very comprehensive for my previous descriptions. What I was
trying to do was to read from an image file and then manipulate the matrix
of the picture and changing them into binary. However, there was this
problem, whenever I tried to "floor()" or "fix()" the image matrix, what i
had was shown in result.

############### image conversion codes #######################
##load grayscale colour map
colormap('default');

##retrieve the RGB data from JPEG file
[r,g,b]=imread('chinese2.jpg');

##changing from RGB color format to Octave image format
[x,map]= rgb2ind(r,g,b);

##to change pixel values to 0.0 or 1.0
gray = ind2gray(x,map);

monoColor = mat2gray(gray);

##to retrieve matrix size
row=rows(x);
column=columns(x);

if(row != 10 || column != 10)
        expand_64=imresize(monoColor, [10 10]);
endif

##for checking purpose only
save -text 'expand_64.txt' expand_64;
 ############### image conversion codes #######################

| ############### result#######################
|  1 1 1 1 1 1 1 1 1 1
|  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 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
|  0 0 0 0 0 0 0 0 0 0
| ############### result ####################### 

If I were to assign, maybe say x = [all the values from the image matrix ],
from the the original values obtained, my output will not be of that shown
in result. Its only when i tried to manipulate the matrix directly from the
manipulated file that I will have this incorrect values.

##################values from the manipulated image#######################

octave:2> expand_64
expand_64 =

  1.00000  1.00000  1.00000  1.00000  1.00000  0.99608  0.99608  1.00000 
1.00000  1.00000
  1.00000  1.00000  0.99608  1.00000  1.00000  1.00000  1.00000  1.00000 
0.98824  0.99216
  1.00000  0.98824  0.52941  0.53333  0.53333  0.52549  0.53333  0.00000 
1.00000  1.00000
  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000 
1.00000  1.00000
  1.00000  1.00000  0.99608  1.00000  1.00000  1.00000  1.00000  1.00000 
1.00000  1.00000
  0.98824  0.99608  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000 
1.00000  0.99608
  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  0.99216 
1.00000  1.00000
  1.00000  0.53725  0.72941  0.73333  0.73333  0.73333  0.73333  0.73333 
0.74902  1.00000
  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000 
1.00000  0.99608
  0.99608  1.00000  0.99216  1.00000  1.00000  1.00000  1.00000  1.00000 
0.99216  0.99216

octave:3> floor(expand_64)
ans =

  1  1  1  1  1  0  0  1  1  1
  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  0  1  1  1  1  1  1  1
  0  0  0  0  0  0  0  0  0  0
  0  0  0  0  0  0  0  0  0  0
  1  0  0  0  0  0  0  0  0  1
  1  1  1  1  1  1  1  1  1  0
  0  0  0  0  0  0  0  0  0  0

##################values from the manipulated image#######################

##################values from my using assignment#######################
octave:2> testMatrix
testMatrix =

  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000 
1.00000  1.00000
  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000 
1.00000  1.00000
  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000 
1.00000  1.00000
  0.50000  0.50000  0.50000  0.50000  0.50000  0.50000  0.50000  0.50000 
0.50000  0.50000
  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000 
1.00000  1.00000
  0.99608  0.98039  0.99216  1.00000  1.00000  1.00000  1.00000  1.00000 
1.00000  1.00000
  1.00000  0.55686  0.73333  0.73333  0.73333  0.73333  0.73333  0.73725 
0.72941  0.99608
  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000 
1.00000  1.00000
  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000 
1.00000  1.00000
  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000 
1.00000  1.00000

octave:3> floor(testMatrix)
ans =

  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  0  0  0  0  0
  1  1  1  1  1  1  1  1  1  1
  0  0  0  1  1  1  1  1  1  1
  1  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

##################values from my using assignment#######################

I hope this will be more comprehensive in reporting my problems from using
Octave.

Shoker
-- 
View this message in context: 
http://www.nabble.com/floor%28%29-tf2352097.html#a6847427
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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