Example of image segmentation in Pharo based on k-means clustering.
Look at our tutorial on the pharo wiki of how to use this project! https://github.com/pharo-ai/wiki/blob/master/wiki/Tutorials/image-segmentation-using-kmeans.md
To install image-segmentation
, go to the Playground (Ctrl+OW) in your Pharo image and execute the following Metacello script (select it and press Do-it button or Ctrl+D):
Metacello new
baseline: 'AIImageSegmentation';
repository: 'github://pharo-ai/image-segmentation';
load.
If you want to add a dependency, include the following lines into your baseline method:
spec
baseline: 'AIImageSegmentation'
with: [ spec repository: 'github://pharo-ai/image-segmentation' ].
file := 'pharo-local/iceberg/pharo-ai/image-segmentation/img/renoir_river.jpg' asFileReference.
segmentator := AIImageSegmentator new
loadImage: file;
numberOfSegments: 3;
yourself.
segmentator clusterImagePixels.
segmentator segmentate.
segmentator segmentatedImage.
segmentator segments.
segmentator openAll.