2
In . NET it is relatively easy and simple to work with images. It is possible to use the class System.Drawing.Bitmap
to open images in Bitmap, Jpeg and PNG formats and play with your pixels. The code below, for example, takes any image and returns its representation in grayscale:
public void RemoverCores(Bitmap input)
{
Bitmap output = new Bitmap(input.Width, input.Height);
for (int i = 0; i <= input.Width; i++)
{
for (int j = 0; j <= input.Height; j++)
{
Color cores = input.GetPixel(i, j);
int media = (cores.R + cores.G + cores.B) / 3;
output.SetPixel(j, j, Color.FromArgb(media, media, media));
}
}
return output;
}
I learned in college that images and sounds are only two distinct forms of signals of a similar nature, and that algorithms that apply to one form also apply to another.
For example, the same algorithm that "blurs" an image serves to remove noises from an audio track. We simply use time instead of height and width when we treat a sound instead of an image and, if I remember correctly, instead of color tracks we have sound frequency ranges.
In college we did this with Matlab. However I would like to work with . NET sounds, with C#. Is there an on-board or official API for this? If it does not exist, at least there is some project with which I can at least generate and manipulate a file . wav or . mp3?
I think Naudio will help me.
– Oralista de Sistemas