Giter Club home page Giter Club logo

raspberrypi.libs's Issues

Error when processing image using FillProcessor

I am having problems running FreetronicsDMS.
This is what I have done:

$dotnet "build" "/RaspberryPi.Libs/FreetronicsDMD/FreetronicsDMD.csproj"

And then:

$cd ./RaspberryPi.Libs/FreetronicsDMD/bin/Debug/netcoreapp2.0
$sudo dotnet FreetronicsDMD.dll  lib

And I am getting this error:

SixLabors.ImageSharp.ImageProcessingException: An error occured when processing the image using FillProcessor`1. See the inner exception for more detail. at SixLabors.ImageSharp.Processing.ImageProcessor`1.Apply(Image`1 source, Rectangle sourceRectangle) at SixLabors.ImageSharp.DefaultInternalImageProcessorContext`1.ApplyProcessor(IImageProcessor`1 processor, Rectangle rectangle) at SixLabors.ImageSharp.DefaultInternalImageProcessorContext`1.ApplyProcessor(IImageProcessor`1 processor) at SixLabors.ImageSharp.ImageExtensions.Fill[TPixel](IImageProcessingContext`1 source, IBrush`1 brush) at SixLabors.ImageSharp.ImageExtensions.Fill[TPixel](IImageProcessingContext`1 source, TPixel color) at RaspberryPi.PiGPIO.Drivers.Dede.FreetronicsDMDSurface.<>c__DisplayClass25_0.<Clear>b__0(IImageProcessingContext`1 updates) in /home/pi/Desktop/RaspberryPi.Libs/RaspberryPi.PiGPIO.Drivers.Drawings.ImageSharp/Dede/FreetronicsDMDSurface.cs:line 173 at SixLabors.ImageSharp.ImageExtensions.Mutate[TPixel](Image`1 source, Action`1 operation) at RaspberryPi.PiGPIO.Drivers.Dede.FreetronicsDMDSurface.UpdateSurface(Action`1 updates) in /home/pi/Desktop/RaspberryPi.Libs/RaspberryPi.PiGPIO.Drivers.Drawings.ImageSharp/Dede/FreetronicsDMDSurface.cs:line 114 at RaspberryPi.PiGPIO.Drivers.Dede.FreetronicsDMDSurface.Clear(Boolean value) in /home/pi/Desktop/RaspberryPi.Libs/RaspberryPi.PiGPIO.Drivers.Drawings.ImageSharp/Dede/FreetronicsDMDSurface.cs:line 171 at RaspberryPi.PiGPIO.Drivers.Dede.FreetronicsDMDSurface.Init(Boolean runThread) in /home/pi/Desktop/RaspberryPi.Libs/RaspberryPi.PiGPIO.Drivers.Drawings.ImageSharp/Dede/FreetronicsDMDSurface.cs:line 88 at RaspberryPi.PiGPIO.Drivers.Dede.FreetronicsDMDSurface.Init() in /home/pi/Desktop/RaspberryPi.Libs/RaspberryPi.PiGPIO.Drivers.Drawings.ImageSharp/Dede/FreetronicsDMDSurface.cs:line 81 at Dede.DMDTest.Program.Run(IPiGPIO gpio) in /home/pi/Desktop/RaspberryPi.Libs/FreetronicsDMD/Program.cs:line 113

Do you have any clue why would I be getting this?

I am running on a RPI 3, running Raspbian 10:

   $lsb_release -a
   No LSB modules are available.
   Distributor ID: Raspbian
   Description:    Raspbian GNU/Linux 10 (buster)
   Release:        10
   Codename:       buster

Dotnet version:

  $dotnet --version
  2.2.102

Thanks for your help

Reduce allocations using ImageSharp

Image<TPixel> comes with an indexer so you do not need to create a new array. You are also not using tha alpha component of the Rgba32 struct so you might as well save another 25% memory by ignoring it and using the Rgb24 struct instead.

https://github.com/MaitreDede/RaspberryPi.Libs/blob/758a849be16ade461ef1e4be8218aaf78627ac6b/RaspberryPi.LibLedMatrix.ImageSharp/LedCanvasExtensions.cs#L20

Could be:

        public static void UpdateCanvasAsImageSharp(this LedMatrix matrix, Action<IImageProcessingContext<Rgb24>> method)
        {
            matrix.UpdateCanvas(canvas =>
            {
                using (Image<Rgb24> img = new Image<Rgb24>(canvas.Width, canvas.Height))
                {
                    img.Mutate(method);
                    for (int x = 0; x < canvas.Width; x++)
                    {
                        for (int y = 0; y < canvas.Height; y++)
                        {
                            Rgb24 rgb = img[x,y];
                            canvas.SetPixel(x, y, rgb.R, rgb.G, rgb.B);
                        }
                    }
                }
            });
        }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.