I have to apply a Fourier Transform on an image. For this, I want to create a new image with the transform. It is possible to create an image pixel by pixel? Or do I have to modify my basic image?
The C language itself doesn't have any built-in graphics capability. You can use a graphics toolkit like Qt, gtk, wxWidgets, etc. You could also construct an image file (BMP is pretty simple), and then launch (using fork and exec) an application to view it.
It should compile fine using commercially available C/C++ compilers. The software works on 8-bit, gray scale images in TIFF and BMP file formats. Inexpensive programs are available to convert almost any image into one of these formats. Chapter 0 introduces the C Image Processing System.
Function stbi_load returns a pointer to an unsigned char* buffer. The size of this buffer is width * height * channels . The image data is stored in the buffer in row order, i.e., the first width * channels bytes belong to the first row of image. The following code sets the first 10 rows of the input image to black.
Yes, you can do it.
public void Draw()
{
var bitmap = new Bitmap(640, 480);
for (var x = 0; x < bitmap.Width; x++)
{
for (var y = 0; y < bitmap.Height; y++)
{
bitmap.SetPixel(x, y, Color.BlueViolet);
}
}
bitmap.Save("m.bmp");
}
But it may be slowly, if you want draw big bitmaps.
You can draw in the same way on an existing image. You can get it like this:
var bitmap = new Bitmap("source.bmp");
Use this constructor to open images with the following file formats: BMP, GIF, EXIF, JPG, PNG and TIFF.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With