octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #49613] image package - regionprops.m majoraxi


From: Avinoam Kalma
Subject: [Octave-bug-tracker] [bug #49613] image package - regionprops.m majoraxislength broken
Date: Tue, 6 Dec 2016 21:22:50 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36

Follow-up Comment #17, bug #49613 (project octave):

Indeed, my patch was wrong. I tried to be compatible, but in the wrong way. It
should be:


   if (major_vec(2) == 0)
      orientation(idx) = 90;
    else
      orientation(idx) = -(180/pi) .* atan (major_vec(1) ./ major_vec(2));
    end


which works fine on your last example, and on your example from comment#0,
except entry 12, which matlab  result is 0, and mine is 90.

The same problem is with


BW_C = logical([0 0 0 0; 0 1 1 0; 0 1 1 0]);
L_C = bwlabel(BW_C);
props = regionprops(L_C,'Orientation');
orientation_C = props.Orientation


In which Matlab result is 0, and mine is 90.

I think that the problem is that both eigenvalues are equal, so
min = max.

What about:


    if (major(idx) == minor(idx))
      orientation(idx) = 0;
    elseif (major_vec(2) == 0)
      orientation(idx) = 90;
    else
      orientation(idx) = -(180/pi) .* atan (major_vec(1) ./ major_vec(2));
    endif



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49613>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]