mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-04 13:05:36 +08:00
fix orientation of regionprops with correct quadrant determination
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# coding: utf-8
|
||||
from math import sqrt, atan, pi as PI
|
||||
from math import sqrt, atan2, pi as PI
|
||||
import numpy as np
|
||||
from scipy import ndimage
|
||||
|
||||
@@ -301,7 +301,7 @@ def regionprops(label_image, properties=['Area', 'Centroid'],
|
||||
if a - c == 0:
|
||||
obj_props['Orientation'] = PI / 2
|
||||
else:
|
||||
obj_props['Orientation'] = - 0.5 * atan(2 * b / (a - c))
|
||||
obj_props['Orientation'] = - 0.5 * atan2(2 * b, (a - c))
|
||||
|
||||
if 'Perimeter' in properties:
|
||||
obj_props['Perimeter'] = perimeter(array, 4)
|
||||
|
||||
Reference in New Issue
Block a user