Metadata-Version: 2.1
Name: segment-image
Version: 0.0.2
Summary: A package used to segment an image
Home-page: https://github.com/MyDuan/segment_image
Author: yu.duan
Author-email: dy1226130575@163.com
License: UNKNOWN
Project-URL: Bug Tracker, https://github.com/MyDuan/segment_image/issues
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown

# segment_image

### Abstract

- A lib can be used to segment image https://pypi.org/project/segment-image/
- The first version just has k_means algorithm.

### install

- python >= 3.6
- install
```
$ pip install segment-image
```


### how to use

```
import segment_image
import cv2

img = cv2.imread("./sample_imgs/lena.png")
k = 2 # number of segments
k_means = segment_image.Kmeans(img, k)
iteration = 10
convergence_radius = 1e-6
k_means.run(iteration, convergence_radius)

```

### example

- https://github.com/MyDuan/segment_image/blob/main/examples/example_of_kmeans.py
- results:

![kmeans_re](https://user-images.githubusercontent.com/19246998/113019886-04c81500-91bd-11eb-8075-016c64f5161b.png)

![pig_re](https://user-images.githubusercontent.com/19246998/113070146-e124bf00-91fc-11eb-87a8-1cff0064288d.png)


