Hi Carnë,
thanks for your kind reply! I'll immediately check the changes in the pkg.

I prefer to send my reply to the list too, because it might  be useful to
other people who are using or will use graycomatrix in octave (before it
gets aligned with matlab's).

As to the differences between matlab and octave versions of graycomatrix,
here are some (as far as I can see at present):

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

I hope I made no mistakes in what I wrote… If I did please be patient...

Thanks again for your work!
Best regards
Giorgio



> Hi Giorgio
>
> I'm the current maintainer of the image package. I'll be releasing a
> new version of the image package very soon there's only a standing
> issue with the Clang compiler (but moving to another country so
> haven't had much time).
>
> I didn't touch graycomatrix but many many functions had changes for
> increased matlab compatibility. Just take a look at the NEWS file:
>
> https://sourceforge.net/p/octave/code/11300/tree/trunk/octave-forge/main/image/NEWS
>
> Some of the fixes may mean no porting issues for you. And if you still
> find a compatibility issue, this is rarely by design and should be
> fixed. So please don't "fix" too much of your code if you can fix the
> function in Octave Forge instead, most of the times this actually
> really easy. Or at least report it.
>
> The new release will be sometime this week but if you can't make the
> package from the repository, you can get the beta version from
>
> http://carandraug.no-ip.org/octave/image-1.9.91.tar.gz
>
> Carnë
>



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to