Colour Segmentation
  • Introduction
  • WHAT IS BEHIND?
    • Fuzzy Logic-based methods
      • Amante-Fonseca
      • Chamorro-Martínez
      • Liu-Wang
      • Shamir
  • USAGE
    • Segmentator object
    • Segmentation using Fuzzy Logic-based methods
  • Examples
    • Examples of Fuzzy Logic-based methods
Powered by GitBook
On this page
  • Example image
  • Results

Was this helpful?

  1. Examples

Examples of Fuzzy Logic-based methods

This page contains the results after applying the different methods based on Fuzzy Logic.

PreviousSegmentation using Fuzzy Logic-based methods

Last updated 3 years ago

Was this helpful?

Example image

Let us consider the following image, which we want to segment.

We load the image, and initialise the Segmentator object to proceed with the segmentation.

import cv2 
from colour_segmentation.base.segmentation_algorithm import SegmentationAlgorithm
from colour_segmentation.segmentator import Segmentator

segmentator = Segmentator(image=cv2.imread(r"assets/nectarine.jpg"))

Results

For each of the above methods, we will apply the segmentation with and without the achromatic colours.

Amante-Fonseca

result_amante_fonseca_achr = segmentator.segment(method=SegmentationAlgorithm.FUZZY_SET_AMANTE,
                                                 remove_achromatic_colours=False)
result_amante_fonseca_chr = segmentator.segment(method=SegmentationAlgorithm.FUZZY_SET_AMANTE,
                                                remove_achromatic_colours=True)

Chamorro-Martínez

result_chamorro_achr = segmentator.segment(method=SegmentationAlgorithm.FUZZY_SET_CHAMORRO,
                                           remove_achromatic_colours=False)
result_chamorro_chr = segmentator.segment(method=SegmentationAlgorithm.FUZZY_SET_CHAMORRO,
                                              remove_achromatic_colours=True)

Liu-Wang

result_liu = segmentator.segment(method=SegmentationAlgorithm.FUZZY_SET_LIU,
                                 apply_colour_correction=False,
                                 remove_achromatic_colours=True)
result_liu_corrected = segmentator.segment(method=SegmentationAlgorithm.FUZZY_SET_LIU,
                                           apply_colour_correction=True,
                                           remove_achromatic_colours=True)

Shamir

result_shamir_achr = segmentator.segment(method=SegmentationAlgorithm.FUZZY_SET_SHAMIR,
                                         remove_achromatic_colours=False)
result_shamir_chr = segmentator.segment(method=SegmentationAlgorithm.FUZZY_SET_SHAMIR,
                                        remove_achromatic_colours=True)
Example of segmentation using Amante-Fonseca without removing achromatic colours (left) and removing achroomatic colours (right).
Example of segmentation using Chamorro-Martínez without removing achromatic colours (left) and removing achroomatic colours (right).
Example of segmentation using Liu-Wang applying without applying colour correction (left) and applying colour correction (right). In both images achromatic colours have been removed.
Example of segmentation using hamir without removing achromatic colours (left) and removing achroomatic colours (right).