On 21 October 2012 15:54, <giorgio.denun...@unisalento.it> 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 Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev