Hi all, and a first question about graycomatrix

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Hi all, and a first question about graycomatrix

giorgio.denunzio
Hi all,
first message to the list for me!
I am new to octave and octave forge, but I'm a (quite) expert matlab
programmer. I am going to translate to octave, and to its packages, some
tools I wrote in the field of medical image processing.
My first question, hoping this is the right place to ask, concerns
graycomatrix: I am trying to understand what its parameters are, because
it is quite different from matlab equivalent function. While I imagine
that distances are just what the word says, an array of distances between
pixels, I do not understand how angles are given.
At http://sourceforge.net/mailarchive/message.php?msg_id=4559584
Stefan van der Walt (after submitting this function many years ago) said
"try the demos": can someone suggest me where they are?
Thank you very much!
Best regards
Giorgio



------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/octave-dev
Reply | Threaded
Open this post in threaded view
|

Re: Hi all, and a first question about graycomatrix

giorgio.denunzio
Solved myself! :-) The demo code was in the source of graycomatrix, that I
 found (by google) at
http://octave-image.sourcearchive.com/documentation/1.0.6/graycomatrix_8cc-source.html
Thanks!
Regards
Giorgio


> Hi all,
> first message to the list for me!
> I am new to octave and octave forge, but I'm a (quite) expert matlab
> programmer. I am going to translate to octave, and to its packages, some
> tools I wrote in the field of medical image processing.
> My first question, hoping this is the right place to ask, concerns
> graycomatrix: I am trying to understand what its parameters are, because
> it is quite different from matlab equivalent function. While I imagine
>


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/octave-dev
Reply | Threaded
Open this post in threaded view
|

Re: Hi all, and a first question about graycomatrix

c.-2
In reply to this post by giorgio.denunzio

On 20 Oct 2012, at 17:50, [hidden email] wrote:

> "try the demos": can someone suggest me where they are?
many Octave and Octave-Forge functions contain embedded demos:
http://www.gnu.org/software/octave/doc/interpreter/Demonstration-Functions.html#Demonstration-Functions
to run them just type:
demo function_name
at the Octave prompt.
HTH,
c.
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/octave-dev
Reply | Threaded
Open this post in threaded view
|

Re: Hi all, and a first question about graycomatrix

giorgio.denunzio
In reply to this post by giorgio.denunzio
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/octave-dev
Reply | Threaded
Open this post in threaded view
|

Re: Hi all, and a first question about graycomatrix

giorgio.denunzio
In reply to this post by c.-2
Hi Carlo, thank you very much! I did not know the existence of the demo
function!
graycomatrix has no demo, but your hint will be useful for me in the future!
Ciao!
Giorgio


>
> On 20 Oct 2012, at 17:50, [hidden email] wrote:
>
>> "try the demos": can someone suggest me where they are?
> many Octave and Octave-Forge functions contain embedded demos:
> http://www.gnu.org/software/octave/doc/interpreter/Demonstration-Functions.html#Demonstration-Functions
> to run them just type:
> demo function_name
> at the Octave prompt.
> HTH,
> c.



------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/octave-dev
Reply | Threaded
Open this post in threaded view
|

Re: Hi all, and a first question about graycomatrix

Carnë Draug-2
In reply to this post by giorgio.denunzio
On 21 October 2012 15:54,  <[hidden email]> wrote:

> 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

are you able to submit a patch for this? While most of the functions
are written in the very own octave language and should be no problem,
graycomatrix was implemented is written in C++. If you can't fix this,
could you please report this as a bug at
https://sourceforge.net/p/octave/bugs/ so it's not forgotten?

Thanks,
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/octave-dev