diff options
-rw-r--r-- | bin/img2list.py | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/bin/img2list.py b/bin/img2list.py deleted file mode 100644 index 48d0de4..0000000 --- a/bin/img2list.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Aaron LI -# 2015/06/23 -# - - -import numpy as np -from astropy.io import fits - - -def img2list(imgdata, mask=None): - """ - Convert a image matrix to list of point coordinates. - The input image matrix is taken as an integer matrix. - If one pixel has value n (>1), then it is repeated n times. - """ - img = imgdata.astype(int) - points = [] - ii, jj = np.nonzero(img >= 1) - while len(ii) > 0: - for i, j in zip(ii, jj): - points.append([i, j]) - img[ii, jj] -= 1 - ii, jj = np.nonzero(img >= 1) - return np.array(points) - |