Home Page > > Details

ImageSharp AssignmentHelp With ,R Programming AssignmentDebug ,R Course Assignment Help With R Programming|Debug Matlab Programming

Working with images
Image class
An Image class contained in Image.cs has been provided on Blackboard. It is highly
recommended that you download and use this class in your project, as it encapsulates a lot of
convenient functionality for working with images. The Image class requires the
SixLabors.ImageSharp 3rd party library to be installed in your project.
Start by adding the Image.cs file into a new Console project (.NET core). You should familiarise
yourself with this class and the public members it exposes, because you will likely use them in
your solution!
Working with RGBA values and pixel intensities
RGBA values: RGBA stands for red, green, blue, alpha. Every pixel in our images has a RGBA
value. The alpha channel represents the the transparency of pixels (an alpha value of 0 indicates
complete transparency, and an alpha value of 255 indicates no transparency). In this assignment,
RGBA values are stored using the Rgba32 type. Each component is represented by a byte (an 8-
bit integer ranging from 0 to 255). For more information on the Rgba type, see the official
SixLabors documentation page. In our Image class, Rgba32 values at specific pixels can be
retrieved using square-bracket indexing (e.g. image[x, y].R ). The overall intensity of an RGBA
pixel can be retrieved using the image.GetGreyIntensity(...) method, which provides the average
intensity of the RGB channels (equivalent to the pixel values after converting to greyscale - hence
the method name GetGreyIntensity ).
Greyscale images: Greyscale images still have RGBA channels, but the values in the RGB
channels are identical. For example, the colour new Rgba32(25, 25, 25, 255) and new Rgba32(80,
80, 80, 255) each represent shades of grey. The colour new Rgba32(0, 0, 0, 255) represents
black, and the colour new Rgba32(255, 255, 255, 255) represents white. To convert an image to
greyscale, use Image.ToGreyscale(...) .
Examples
using SixLabors.ImageSharp.PixelFormats;  necessary for creating Rgba32 objects
...
 load an image
Image image1 = new Image("cat.png");
 create an image by copying an old one
Image image2 = new Image(image1);
 create a black image with a specific width and height
Image image3 = new Image(width: 400, height: 300);
 get the Rgba32 color of the pixel at x=25, y=30
Rgba32 color1 = image1[25, 30];
 get the overall pixel intensity at x=25, y=30
int intensity = image1.GetGreyIntensity(25, 30);
 create a color with the values r=50, g=80, b=55, and a=255
Rgba32 color2 = new Rgba32(50, 80, 55, 255);
 create a color that is 5% brighter than another color
Rgba32 color3 = new Rgba32(
(byte)(color1.R * 1.05),
(byte)(color2.G * 1.05),
(byte)(color2.B * 1.05),
(byte)(255)
);
 set a pixel to a new Rgba32 value
image1[25, 30] = color3;

Contact Us - Email:99515681@qq.com    WeChat:codinghelp
Programming Assignment Help!