Octave vs Matlab: regionprops differences

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Octave vs Matlab: regionprops differences

giorgio.denunzio
Hi all,

please try this script in Matlab (with the image processing toolbox) and
in octave (first loading the image package):

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% define a mask
BW = logical([1 1 1 0 0 0 0 0
               1 1 1 0 1 1 0 0
               1 1 1 0 1 1 0 0
               1 1 1 0 0 0 1 0
               1 1 1 0 0 0 1 0
               1 1 1 0 0 0 1 0
               1 1 1 0 0 1 1 0
               1 1 1 0 0 0 0 0]);

L = bwlabel(BW, 8);   % ,4 or ,8 (default)
s = regionprops(L, 'Perimeter', 'Eccentricity')

for j = 1:size(s)
   disp(s(j).Perimeter)
   disp(s(j).Eccentricity)
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Here is the result, with connectivity = 4 or 8, and Matlab or octave:


Connectivity = 4, Matlab:

s =

   3×1 struct array with fields:
     Eccentricity
     Perimeter

    17.2760
     0.9270
     3.5560
      0
     7.0130
     0.9315


Connectivity = 4,  octave

error: vertical dimensions mismatch (1x3 vs 1x2)
error: called from
     regionprops>rp_perimeter at line 767 column 8
     regionprops at line 412 column 26
     testOctaveVSMatlab at line 13 column 3
 >>

Connectivity = 8, Matlab

s =
   2×1 struct array with fields:
     Eccentricity
     Perimeter

    17.2760
     0.9270
    13.1080
     0.9429


Connectivity = 8, octave

s =
   2x1 struct array containing the fields:
     Perimeter
     Eccentricity

  18
  0.92702
  14.243
  0.98641
 >>

As you see, with 4-connectivity, octave breaks. With 8-connectivity,
perimeters and eccentricities are different.

Thanks

Giorgio



---
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
https://www.avast.com/antivirus


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Octave vs Matlab: regionprops differences

Hartmut
Hey Giorgio,

this seems to be (at least partly) a bug in regionprops.m.

I have opened a bug report here [1] and will continue the discussion there.

Cheers

    Hartmut

[1] https://savannah.gnu.org/bugs/?52926



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave