class TensorflowLite::Image::Segmentation

Included Modules

Defined in:

tflite_image/segmentation.cr

Constant Summary

OPACITY = UInt16::MAX // 2
TRANSPARENT_PIXEL = StumpyCore::RGBA.new(0_u16, 0_u16, 0_u16, 0_u16)

Class Method Summary

Instance Method Summary

Instance methods inherited from module TensorflowLite::Image::Common

client : Client client, detection_adjustments(image : Canvas, scale_mode : Scale = @scaling_mode)
detection_adjustments(image_width : Int32, image_height : Int32, scale_mode : Scale = @scaling_mode)
detection_adjustments
, input_format : Format input_format, labels : Array(String) labels, resolution : Tuple(Int32, Int32) resolution, run(canvas : Canvas, scale_mode : Scale = @scaling_mode, resize_method : StumpyResize::InterpolationMethod = :bilinear) run, scaling_mode : Scale scaling_mode, scaling_mode=(scaling_mode : Scale) scaling_mode=

Constructor methods inherited from module TensorflowLite::Image::Common

new(client : Client, labels : Array(String) | Nil = nil, scaling_mode : Scale = DEFAULT_SCALE_MODE, input_format : Format | Nil = nil, output_format : Format | Nil = nil) new

Class Method Detail

def self.pascal_label_colormap : Array(Tuple(UInt16, UInt16, UInt16)) #

A Colormap for visualizing segmentation results.

The colormap is an array with 256 elements, each of which is a 3-element array representing an RGB color.


[View source]

Instance Method Detail

def build_image_mask(detection : Detection) #

creates a multi-coloured mask of all the detections in the image


[View source]
def process(image : Canvas) : Tuple(Canvas, Detection) #

attempts to classify the object, assumes the image has already been prepared


[View source]
def scale_image_mask(image : Canvas, mask : Canvas, left_offset : Int32 = 0, top_offset : Int32 = 0, resize_method : StumpyResize::InterpolationMethod = :bilinear) #

scales the mask to fit on the image provided


[View source]
def scale_image_mask(target_width : Int32, target_height : Int32, mask : Canvas, left_offset : Int32 = 0, top_offset : Int32 = 0, resize_method : StumpyResize::InterpolationMethod = :bilinear) #

scales the mask to fit the target width and height


[View source]