From: <gio...@un...> - 2012-10-20 15:51:08
|
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 |
From: <gio...@un...> - 2012-10-20 17:57:23
|
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 > |
From: c. <car...@gm...> - 2012-10-20 18:00:34
|
On 20 Oct 2012, at 17:50, gio...@un... 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. |
From: <gio...@un...> - 2012-10-21 13:57:46
|
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, gio...@un... 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. |
From: <gio...@un...> - 2012-10-21 13:54:57
|
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ë > |
From: Carnë D. <car...@gm...> - 2012-10-25 00:12:31
|
On 21 October 2012 15:54, <gio...@un...> 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ë |