Loading an Unsupervised Segmenter and Segmenting an Image¶
This code snippet shows how to load a trained unsupervised segmenter and how to segment a new image.
C++¶
#include <eVision/EasyDeepLearning/EasySegment/EUnsupervisedSegmenterResult.h>
using namespace eVision;
using namespace eVision::EasyDeepLearning;
// Image
EImageBW8 image;
image.Load("my_image_path");
// Segmenter
EUnsupervisedSegmenter segmenter;
segmenter.Load("segement_path");
// Apply the segmenter on the image
EUnsupervisedSegmenterResult r = segmenter.Apply(image);
// Retrieve the segmentation map
EImageBW8 segmentationMap = r.GetSegmentationMap();
C#¶
using eVision;
using eVision.EasyDeepLearning;
// Image and segmenter constructor
EUnsupervisedSegmenter segmenter = new EUnsupervisedSegmenter();
EImageBW8 image = new EImageBW8();
// Load segmenter and image
segmenter.Load("segment_path");
image.Load("image_path");
// Apply the segmenter on the image
EUnsupervisedSegmenterResult result = segmenter.Apply(image);
// Retrieve the segmentation map
EImageBW8 segmentationMap = result.SegmentationMap;
Python¶
import eVision
from eVision import EasyDeepLearning as edl
# Image and segmenter constructor
segmenter = edl.EUnsupervisedSegmenter()
image = eVision.EImageBW8()
# Load segmenter and image
segmenter.Load("segment_path")
image.Load("image_path")
# Apply the segmenter on the image
result = segmenter.Apply(image)
# Retrieve the segmentation map
segmentation_map = result.SegmentationMap