mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-27 11:27:08 +08:00
tests and minor corrections
This commit is contained in:
@@ -18,7 +18,7 @@ def test_blob_dog():
|
||||
img[xs, ys] = 255
|
||||
|
||||
blobs = blob_dog(img, min_sigma=5, max_sigma=50)
|
||||
radius = lambda x: r2*x[2]
|
||||
radius = lambda x: r2 * x[2]
|
||||
s = sorted(blobs, key=radius)
|
||||
thresh = 5
|
||||
|
||||
@@ -56,7 +56,7 @@ def test_blob_log():
|
||||
|
||||
blobs = blob_log(img, min_sigma=5, max_sigma=20, threshold=1)
|
||||
|
||||
radius = lambda x: r2*x[2]
|
||||
radius = lambda x: r2 * x[2]
|
||||
s = sorted(blobs, key=radius)
|
||||
thresh = 3
|
||||
|
||||
@@ -79,15 +79,15 @@ def test_blob_log():
|
||||
assert abs(b[0] - 200) <= thresh
|
||||
assert abs(b[1] - 350) <= thresh
|
||||
assert abs(radius(b) - 30) <= thresh
|
||||
|
||||
|
||||
|
||||
def test_blob_doh():
|
||||
r2 = math.sqrt(2)
|
||||
img = np.ones((512, 512), dtype = np.uint8)
|
||||
img = np.ones((512, 512), dtype=np.uint8)
|
||||
|
||||
xs, ys = circle(400, 130, 20)
|
||||
img[xs, ys] = 255
|
||||
|
||||
xs, ys = circle(160, 50, 30)
|
||||
xs, ys = circle(460, 50, 30)
|
||||
img[xs, ys] = 255
|
||||
|
||||
xs, ys = circle(100, 300, 40)
|
||||
@@ -96,9 +96,14 @@ def test_blob_doh():
|
||||
xs, ys = circle(200, 350, 50)
|
||||
img[xs, ys] = 255
|
||||
|
||||
blobs = blob_doh(img, min_sigma=1, max_sigma=60, num_sigma=10)
|
||||
blobs = blob_doh(
|
||||
img,
|
||||
min_sigma=1,
|
||||
max_sigma=60,
|
||||
num_sigma=10,
|
||||
threshold=1000)
|
||||
|
||||
radius = lambda x: r2*x[2]
|
||||
radius = lambda x: x[2]
|
||||
s = sorted(blobs, key=radius)
|
||||
thresh = 3
|
||||
|
||||
@@ -108,7 +113,7 @@ def test_blob_doh():
|
||||
assert abs(radius(b) - 20) <= thresh
|
||||
|
||||
b = s[1]
|
||||
assert abs(b[0] - 160) <= thresh
|
||||
assert abs(b[0] - 460) <= thresh
|
||||
assert abs(b[1] - 50) <= thresh
|
||||
assert abs(radius(b) - 30) <= thresh
|
||||
|
||||
|
||||
Reference in New Issue
Block a user