X Tutup
Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

TensorStack.Extractors

Canny

Hed

Depth

Background Removal

Image Example

// Extractor config
var config = new ExtractorConfig("hed.onnx", Provider.DirectML);

// Create Pipeline
using (var pipeline = ExtractorPipeline.Create(config))
{
    // Load Pipeline
    await pipeline.LoadAsync();

    // Read input image
    var input = new ImageInput("Input.png");

    // Options
    var options = new ExtractorImageOptions(input);

    // Run Extractor Pipeline
    var outputTensor = await pipeline.RunAsync(options);

    // Save Output image
    await outputTensor.SaveAsync("Output.png");
}

Video Example

// Extractor config
var config = new ExtractorConfig("hed.onnx", Provider.DirectML);

// Create Pipeline
using (var pipeline = ExtractorPipeline.Create(config))
{
    // Load Pipeline
    await pipeline.LoadAsync();

    // Read input video
    var video = new VideoInput("Input.mp4");

    // Get video input
    var input = await video.GetTensorAsync();

    // Options
    var options = new ExtractorVideoOptions(input);

    // Run Extractor Pipeline
    var outputTensor = await pipeline.RunAsync(inputTensor);

    // Save Output video
    await outputTensor.SaveAync("Output.mp4");
}

Video Stream Example

// Extractor config
var config = new ExtractorConfig("hed.onnx", Provider.DirectML);

// Create Pipeline
using (var pipeline = ExtractorPipeline.Create(config))
{
    // Load Pipeline
    await pipeline.LoadAsync();

    // Read input video
    var video = new VideoInput("Input.mp4");

    // Get video stream
    var videoStream = video.GetStreamAsync();

    // Options
    var options = new ExtractorStreamOptions(videoStream);

    // Get Extractor stream
    videoStream = pipeline.RunAsync(options);

    // Save Video Steam
    await videoStream.SaveAync("Output.mp4");
}
X Tutup