Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some pictures does not show transparent boxes #49

Closed
Mystogun opened this issue Apr 11, 2024 · 1 comment
Closed

some pictures does not show transparent boxes #49

Mystogun opened this issue Apr 11, 2024 · 1 comment

Comments

@Mystogun
Copy link

Mystogun commented Apr 11, 2024

This is the image I'm running the model against

Original Image
image

I use this code

using var platesPredictor = YoloV8Predictor.Create(platesModelPath);
var plateResults = platesPredictor.Detect(new ImageSelector(pictureBox3.ToImageSharpImage()));
using SixLabors.ImageSharp.Image detectedPlateImage = pictureBox3.ToImageSharpImage();
pictureBox6.Image = new Bitmap(new MemoryStream(plateResults.PlotImage(detectedPlateImage).ToArray()));

and this is the plotted image

Image after plotting
image

it looks like the boxes are not transparent

I tried to solve it by doing this

using var platesPredictor = YoloV8Predictor.Create(platesModelPath);
var plateResults = platesPredictor.Detect(new ImageSelector(pictureBox3.ToImageSharpImage()));
using SixLabors.ImageSharp.Image detectedPlateImage = pictureBox3.ToImageSharpImage();

var detectionOptions = new DetectionPlottingOptions();
detectionOptions.ColorPalette = new Compunet.YoloV8.Plotting.ColorPalette("ff000010");
detectionOptions.BoxBorderThickness = 1;

pictureBox6.Image = new Bitmap(new MemoryStream(plateResults.PlotImage(detectedPlateImage, detectionOptions).ToArray()));

it plotes this image, but there are no borders nor labels and confidence
image


but the same code(the one without the detectionOptions object) works fine with other pictures
like this one
image

yet the boxes on some other pictures are not transparent

@dme-compunet
Copy link
Owner

it plotes this image, but there are no borders nor labels and confidence

Indeed there are labels and borders, but they are not visible due to the poor quality of the image.

A possible solution is to create a canvas of an empty image in the dimensions of the original image (but of a higher quality), draw the blurred image to the canvas and then draw the predictions to the image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants