octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #38087] image package: graycomatrix incompatib


From: Carnë Draug
Subject: [Octave-bug-tracker] [bug #38087] image package: graycomatrix incompatibilities with matlab
Date: Mon, 14 Jan 2013 22:36:26 +0000
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.11) Gecko/20100101 Firefox/10.0.11 Iceweasel/10.0.11

URL:
  <http://savannah.gnu.org/bugs/?38087>

                 Summary: image package: graycomatrix incompatibilities with
matlab
                 Project: GNU Octave
            Submitted by: carandraug
            Submitted on: Mon 14 Jan 2013 22:36:25 GMT
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Giorgio Denunzio
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

This bug was originally reported on the mailing list by Giorgio Denunzio
<address@hidden> on 2012/10/21

----

input parameters:
1) matlab wants vectors, one row for each distance/direction couple, and the
necessary  information is a vector with x- and y- components, describing the
particular relative-position vector(s) we are interested in  ('Offset'
parameter) (no idea if I was clear… perhaps it is better to try matlab help
:-)  ; octave wants distinct angles (degrees) and distances:


offsets = [0 1; 0 -1;   -1 1; 1 -1;   -1 0; 1 0;   -1 -1; 1 1];
        % matlab
angles = [6 ; 2 ; 5 ; 1 ; 4 ; 0 ; 3 ; 7] * pi/4;   distances = [1];
     % octave



2) matlab implicitly transforms the input-image bit depth ('NumLevels'
parameter), while octave needs that you change it beforehand; matlab wants to
know the limits of gray level values ('GrayLimits' parameter), octave does not
(I do not know if it assumes the whole range of possible values in accordance
with the bit depth, or it calculates min and max from the image data (I
suppose the former is correct, but I have not checked yet).
Octave just wants to know how many levels are there (not their values). Anyway
I still have to totally verify this. The output is also different because
octave gives a 4D matrix (numlevels x numlevels x distances x angles, iirc),
while matlab gives a 3D matrix:


    numlevels = 16;
    graylimits = [0, 65535];

    % matlab
    theglcm = graycomatrix(I ,'Offset', offsets, 'NumLevels', numlevels ,
'GrayLimits', graylimits);

    % octave
    IOct = uint16(floor(numlevels*(double(I)/graylimits(2))));    %
diminuish bit depth; I supposed graylimits(1) to be zero.
    theglcm = graycomatrix(IOct, numlevels, distances, angles);
    theglcm = squeeze(theglcm);
    %% This works only because I am working with just one
    %% distance value! Now the output is
    %% numlevels x numlevels x angles like in matlab





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?38087>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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