diff --git a/3_cv_basics/1_image_representation/Makefile b/3_cv_basics/1_image_representation/Makefile new file mode 100644 index 0000000..9b3cc19 --- /dev/null +++ b/3_cv_basics/1_image_representation/Makefile @@ -0,0 +1,17 @@ +CC = g++ +CFLAGS = -Wall -Wextra -pedantic -std=c++11 +LIBS = -lSDL2 + +SRCS = image_representation.cpp image_representation.hpp +OBJS = $(SRCS:.cpp=.o) +TARGET = image +all: $(TARGET) + +$(TARGET): $(OBJS) + $(CC) $(CFLAGS) $(OBJS) -o $(TARGET) $(LIBS) + +.cpp.o: + $(CC) $(CFLAGS) -c $< -o $@ + +clean: + $(RM) $(OBJS) $(TARGET) diff --git a/3_cv_basics/1_image_representation/README.md b/3_cv_basics/1_image_representation/README.md new file mode 100644 index 0000000..4b7d04b --- /dev/null +++ b/3_cv_basics/1_image_representation/README.md @@ -0,0 +1,303 @@ +# Image Representation + +## Table Of Contents +- [Image Representation](#image-representation) + - [Table Of Contents](#table-of-contents) + - [How Do We Represent Image?](#how-do-we-represent-image) + - [Some Important Terminologies](#some-important-terminologies) + - [Types of Images](#types-of-images) + - [Binary Images](#binary-images) + - [Grayscale Images](#grayscale-images) + - [RGB Images](#rgb-images) + - [Colour Models](#colour-models) + - [Additive Model](#additive-model) + - [Subtractive Models](#subtractive-models) + - [HSV Colour Model](#hsv-colour-model) + - [Different Image Storing Formats](#different-image-storing-formats) + - [BitMap (.bmp)](#bitmap-bmp) + - [TIFF Format (.tiff , .tif)](#tiff-format-tiff--tif) + - [JPG Format (.jpg , .jpeg , .jpe , .jif , .jfif)](#jpg-format-jpg--jpeg--jpe--jif--jfif) + - [PNG Format (.png)](#png-format-png) + - [How is image actually stored ?](#how-is-image-actually-stored-) + - [Block 1: File Type Data](#block-1-file-type-data) + - [Block 2: Image Information Data](#block-2-image-information-data) + - [Block 3: Color Pallet (semi-optional)](#block-3-color-pallet-semi-optional) + - [Block 4: Raw Pixel Data](#block-4-raw-pixel-data) + - [Total BMP File Size](#total-bmp-file-size) + - [Installations](#installations) + - [Ubuntu](#ubuntu) + - [MacOS](#macos) + - [Build and run the executables](#build-and-run-the-executables) + - [Run without make](#run-without-make) + +## How Do We Represent Image? + +- It can be represented in various forms. +- As most of the time, representation refers to the way that brings information, such as color is coded digitally, and how the image is stored, i.e., how an image file is structured. + +- So,for the simplicity of computing it is represented in a matrix form. + + +## Some Important Terminologies + +1. **Pixel**: Pixel is the smallest unit of a picture displayed on the computer screen. + +A pixel includes its own:- +* **Intensity** +* **Name or Address** + + +The size of the image is defined as the total number of pixels in the horizontal direction times the total number of pixels in the vertical direction. For eg: (512 x 512,640 x 480, or 1024 x 768). + + +2. **Resolution**: The number of pixels per unit is called the resolution of the image.The sharpness of the picture on display depends on the resolution and the size of the monitor. + +It includes- + +● **Image Resolution**: The distance between two pixels. + +● **Screen Resolution**: The number of horizontal and vertical pixels displayed on the screen is called Screen Resolution. +For Example– 640 x 480, 1024 x 768 (Horizontal x Vertical) + + +3. **Aspect Ratio**: The ratio of image’s width to its height is known as the aspect ratio of an image. The height and width of an image are measured in length or number of pixels. +For Example: If a graphics has an aspect ratio of 2:1, it means the width is twice large to height. + +It includes– + +● **Frame aspect ratio**: Horizontal /Vertical Size + +● **Pixel aspect ratio**: Width of Pixel/Height of Pixel + +## Types of Images +There are many type of images , and we will look in detail about different types of images , and the color distribution in them. + +### Binary Images + +![image](https://user-images.githubusercontent.com/109454803/227176586-f93af71a-7a23-47df-bc4d-e3841c2d9367.png) + + +### Grayscale Images +![image](https://user-images.githubusercontent.com/109454803/227176655-016be56e-a12a-49cc-9cfd-84f3cc5a8ac3.png) + +### RGB Images +![image](https://user-images.githubusercontent.com/109454803/227176734-915aa2f6-1b76-4df6-acb2-717cf27b3064.png) + +## Colour Models + +Color model is a 3D color coordinate system to produce all range of color through the primary color set. +Their types are: + +### Additive Model + +● It is also named as “RGB model.” RGB stands for Red, Green, Blue. + +● The Additive color model uses a mixture of light to display colors. + +● The perceived color depends on the transmission of light. + +● It is used in digital media.For eg: Computer Monitor, Television etc. + +![image](https://user-images.githubusercontent.com/109454803/227176865-0e5dfe90-0ae4-422d-8340-7a9ade22e7b2.png) + +### Subtractive Models + +● It is also named as “CMYK Model.” CMYK stands for Cyan, Magenta, Yellow, and Black. + +● The Subtractive model uses a reflection of light to display the colors. + +● The perceived color depends on the reflection of light. + +● The CMYK model uses printing inks. For Example: Paint, Pigments, and color filter etc. + +![image](https://user-images.githubusercontent.com/109454803/227176955-044854dc-3d00-48b1-b82e-e9d806235b30.png) + +### HSV Colour Model + +● These are schemes that describe the way colors combine to create the spectrum we see. + +● Unlike RGB and CMYK, which use primary colors, HSV is closer to how humans perceive color. + +● It has three components: hue, saturation, and value. This color space describes colors (hue or tint) + +in terms of their shade (saturation or amount of gray) and their brightness value. + +![image](https://user-images.githubusercontent.com/109454803/227177010-d7c8e9e3-1c25-48ca-866a-42e921920644.png) + +Three Components of HSV colour model are as follows: + +* **HUE**: Hue is the color portion of the model, expressed as a number from 0 to 360 degrees: + * Red falls between 0 and 60 degrees. + * Yellow falls between 61 and 120 degrees. + * Green falls between 121 and 180 degrees. + * Cyan falls between 181 and 240 degrees. + * Blue falls between 241 and 300 degrees. + * Magenta falls between 301 and 360 degrees. + +* **SATURATION**: Saturation describes the amount of gray in a particular color, from 0 to 100 percent. + * Reducing this component toward zero introduces more gray and produces a faded effect. Sometimes, + * saturation appears as a range from 0 to 1, where 0 is gray, and 1 is a primary color. + +* **VALUE (OR BRIGHTNESS)**: Value works in conjunction with saturation and describes the brightness or intensity of the color, from 0 to 100 percent, where 0 is completely black, and 100 is the brightest and reveals the most color. + +* All images are stored in the computer as rectangular pixels. The resolution is an image referign to the number of pixels in a grid. Higher resolutions can be more details can be stored in an image. +* Images are stored and transmitted using image file formats, which are digital file formats. Each file format has an own method for storing and compressing image data, which can affect how many pixels an image can have. + +## Different Image Storing Formats + +#### BitMap (.bmp) + +* The BMP(Bitmap) format simply records the colour of each pixel with no compression(typically). +* It simply stores the image pixels by pixels. This means that a BMP image file can contain a large number of pixels, but the file size will also be very large. For example, a 1920x1080 pixel BMP image can be over 6 MB in size. + +#### TIFF Format (.tiff , .tif) + +* A TIFF, which stands for Tag Image File Format, is a computer file used to store raster graphics and image information. A favourite among photographers, TIFFs are a handy way to store high-quality images before editing if you want to avoid lossy file formats. + +* TIFF files are a lossless form of file compression, which means they’re larger than most but don’t lose image quality. + +#### JPG Format (.jpg , .jpeg , .jpe , .jif , .jfif) + +* A JPG file is a raster image saved in the JPEG format, commonly used to store digital photographs and graphics created by image-editing software. JPEG features lossy compression that can significantly reduce the size of an image without much degradation and supports up to 16,777,216 colors. + +* This means that a JPEG image file can contain a moderate number of pixels while still maintaining reasonable image quality. For example, a 1920x1080 pixel JPEG image can be under 1 MB in size. + + +#### PNG Format (.png) +* A PNG file is an image saved in the Portable Network Graphic (PNG) format, commonly used to store web graphics, digital photographs, and images with transparent backgrounds. It is a raster graphic similar to a .JPG image but is compressed with lossless compression and supports transparency. + +* This means that a PNG image file can contain a moderate number of pixels while still maintaining high image quality. For example, a 1920x1080 pixel PNG image can be under 3 MB in size. + +## How is image actually stored ? + +To simplify how image is stored we will restrict ourselves to the following parameters: +* Image is of the format `BitMap(BMP)`, since they do not contain any compressed data so there is no extra step required for decompression +* Image is grayscale. + +Every file is made of binary numbers, whether that is an image file or a text file. These binary numbers represent the content of the file and a computer decodes that information in the CPU. A plain-text file contains only text (without any styling or file metadata). Each character of the text is represented by their code-point (a decimal number assigned to each character). So if view a plain-text file in a binary, all binary numbers represent characters only. + +So every BMP image contains the following sections +1) File Type Data +2) Image Information Data +3) Color Pallet +4) Raw Pixel Data + +![](assets/bmp_file_structure.png) + +### Block 1: File Type Data + +This block is a BMP Header labeled as `BITMAPFILEHEADER`. This is the starting point of the BMP file and has 14 bytes width. This header contains a total of 5 fields of variable byte width. These are mentioned in the below table. + +| Field Name | Size (in Bytes) | Description | +|----------|:-------------:|------------------------| +| FileType | 2 Bytes | A 2 character string value in ASCII to specify a DIB file type. It must be 'BM' or '0x42 0x4D' in hexadecimals for modern compatibility reasons. | +| FileSize | 4 Bytes | An integer (unsigned) representing entire file size in bytes. This value is basically the number of bytes in a BMP image file. | +| Reserved | 2 Bytes | These 2 bytes are reserved to be utilized by an image processing application to add additional meaningful information. It should be initialized to '0' integer (unsigned) value. | +| Reserved | 2 Bytes | Same as the above. | +| PixelDataOffset | 4 Bytes | An integer (unsigned) representing the offset of actual pixel data in bytes. In nutshell:- it is the number of bytes between start of the file (0) and the first byte of the pixel data. | +| Total | 14 Bytes | Size of the BITMAPFILEHEADER in bytes. | + +### Block 2: Image Information Data + +This is a DIB Header must be used to specify the color and image information. Unlike `BITMAPFILEHEADER`, there are many types of info headers (listed on the Wiki page). Each header has different byte-width but for compatibility reasons, we use BITMAPINFOHEADER. + +| Field Name | Size (in Bytes) | Description | +|----------|:-------------:|------------------------| +| HeaderSize | 4 bytes | An integer (unsigned) representing the size of the header in bytes. It should be '40' in decimal to represent BITMAPINFOHEADER header type. | +| ImageWidth | 4 bytes | An integer (signed) representing the width of the final image in pixels.| +| ImageHeight | 4 bytes | An integer (signed) representing the height of the final image in pixels. | +| Planes | 2 bytes | An integer (unsigned) representing the number of color planes of the target device. Should be '1' in decimal. | +| BitsPerPixel | 2 bytes | An integer (unsigned) representing the number of bits (memory) a pixel takes (in pixel data) to represent a color. | +| Compression | 4 bytes | An integer (unsigned) representing the value of compression to use. Should be '0' in decimal to represent no-compression (identified by 'BI_RGB'). | +| ImageSize | 4 bytes | An integer (unsigned) representing the final size of the compressed image. Should be '0' in decimal when no compression algorithm is used. | +| XpixelsPerMeter | 4 bytes | An integer (signed) representing the horizontal resolution of the target device. This parameter will be adjusted by the image processing application but should be set to '0' in decimal to indicate no preference. | +| YpixelsPerMeter | 4 bytes | An integer (signed) representing the verical resolution of the target device (same as the above). | +| TotalColors | 4 bytes | An integer (unsigned) representing the number of colors in the color pallet (size of the color pallet or color table). If this is set to '0' in decimal :- 2^BitsPerPixel colors are used. | +| ImportantColors | 4 bytes | An integer (unsigned) representing the number of important colors. Generally ignored by setting '0' decimal value. | +| Total | 40 bytes | Size of the BITMAPINFOHEADER in bytes. | + +### Block 3: Color Pallet (semi-optional) + +This block contains the list of colors to be used by a pixel. This is an indexed table with the index starting from 0. The integer value of the pixel points to the color index in this table and that color is printed on the screen. + +*However, this block is mandatory when BitsPerPixel is less than or equal to 8, hence this block is semi-optional.* + +The below table contains information about the maximum possible colors for a given BitsPerPixel(bpp) or bit-depth. + +| BitsPerPixel(bpp) | Palletized | Max Colors | Description | +|:----------:|:-------------:|:--------------:|:-------:| +|1 | Yes | 2 | Ideal for monochromatic image of any two colors defined in the pallet. | +| 4 | Yes | 16 | Maximum 16 distinct colors can be defined in the pallet. | +| 8 | Yes | 256 | Maximum 256 distinct colors can be defined in the pallet. | +| 16 | No | 65_536 | Color is derived from RGB value (5-bit color channel / MSB is ignored). | +| 24 | No | 16M (16_777_215) | Color is derived from RGB value (8-bit color channel). | +| 32 | No | 4B (4_294_967_296) | Color is derived from RGBA value (8-bit color channel and 8-bit alpha channel). | + +### Block 4: Raw Pixel Data + +This block contains binary numbers dedicated to representing the unique color values of each individual pixel. Depending on the bpp of the BMP image, a byte can contain color values of multiple pixels or multiple bytes can be used to represent the color value of a single pixel. + +The size of this block, however, is not that straightforward to calculate. BMP scan lines need padding bytes and hence, we will be able to calculate size once we have written all the bytes. + +### Total BMP File Size + +The FileSize field in `BITMAPFILEHEADER` header is the sum of all the bytes in these 4 blocks. We could set the value of this field to 0 and it might work in all the BMP rendering applications but doing that should be avoided. + +![](assets/bmp_detailed_file_structure.jpg) + +*Note: It is to be noted that this example uses SDL2 library just to fulfil the purpose of displaying each pixel of the image on the screen. As such there is no special need to understand the internals of SDL2 library to understand the basics of image representation.* + +## Installations + +To install sdl and its related libraries : + +### Ubuntu + +```sh +sudo apt-get install libsdl2-2.0-0 +``` + +```sh +sudo apt-get install libsdl2-image-dev +``` + +### MacOS + +```zsh +brew install sdl2 +``` + +## Build and run the executables + +Now that you are aware with the various image storing formats, let's look at how to create and execute executables. + +After cloning in the Pixels_Seminar repository, get into the 1_image_representation folder using cd command + +```sh +cd /Pixels_Seminar/3_cv_basics/1_image_representation +``` + +`image_representation.cpp` is our code file. + +Perform make command + +`make` + +To run + +- `./image `\ + for eg : `./image /home/chinmay/Pixels_Seminar/3_cv_basics/1_image_representation/image.bmp` + +This will display the image. + +#### Run without make +If you want to run the code without make then just type + +- `g++ -g image_representation.cpp -o image $(pkg-config --cflags --libs sdl2)` + +and then +- `./image )`\ + for eg : `./image /home/chinmay/Pixels_Seminar/3_cv_basics/1_image_representation/image.bmp` + + +This will display the image. diff --git a/3_cv_basics/images/add.PNG b/3_cv_basics/1_image_representation/assets/add.PNG similarity index 100% rename from 3_cv_basics/images/add.PNG rename to 3_cv_basics/1_image_representation/assets/add.PNG diff --git a/3_cv_basics/images/b&w.PNG b/3_cv_basics/1_image_representation/assets/b&w.PNG similarity index 100% rename from 3_cv_basics/images/b&w.PNG rename to 3_cv_basics/1_image_representation/assets/b&w.PNG diff --git a/3_cv_basics/1_image_representation/assets/bmp_detailed_file_structure.jpg b/3_cv_basics/1_image_representation/assets/bmp_detailed_file_structure.jpg new file mode 100644 index 0000000..1462067 Binary files /dev/null and b/3_cv_basics/1_image_representation/assets/bmp_detailed_file_structure.jpg differ diff --git a/3_cv_basics/1_image_representation/assets/bmp_detailed_file_structure.webp b/3_cv_basics/1_image_representation/assets/bmp_detailed_file_structure.webp new file mode 100644 index 0000000..24af8e7 Binary files /dev/null and b/3_cv_basics/1_image_representation/assets/bmp_detailed_file_structure.webp differ diff --git a/3_cv_basics/1_image_representation/assets/bmp_file_structure.png b/3_cv_basics/1_image_representation/assets/bmp_file_structure.png new file mode 100644 index 0000000..032abf5 Binary files /dev/null and b/3_cv_basics/1_image_representation/assets/bmp_file_structure.png differ diff --git a/3_cv_basics/images/gray.PNG b/3_cv_basics/1_image_representation/assets/gray.PNG similarity index 100% rename from 3_cv_basics/images/gray.PNG rename to 3_cv_basics/1_image_representation/assets/gray.PNG diff --git a/3_cv_basics/images/hsv(img).PNG b/3_cv_basics/1_image_representation/assets/hsv(img).PNG similarity index 100% rename from 3_cv_basics/images/hsv(img).PNG rename to 3_cv_basics/1_image_representation/assets/hsv(img).PNG diff --git a/3_cv_basics/images/rgb.PNG b/3_cv_basics/1_image_representation/assets/rgb.PNG similarity index 100% rename from 3_cv_basics/images/rgb.PNG rename to 3_cv_basics/1_image_representation/assets/rgb.PNG diff --git a/3_cv_basics/images/subt.PNG b/3_cv_basics/1_image_representation/assets/subt.PNG similarity index 100% rename from 3_cv_basics/images/subt.PNG rename to 3_cv_basics/1_image_representation/assets/subt.PNG diff --git a/3_cv_basics/1_image_representation/image.bmp b/3_cv_basics/1_image_representation/image.bmp new file mode 100644 index 0000000..e73a7f8 Binary files /dev/null and b/3_cv_basics/1_image_representation/image.bmp differ diff --git a/3_cv_basics/1_image_representation/image1.bmp b/3_cv_basics/1_image_representation/image1.bmp new file mode 100644 index 0000000..4ead0f9 Binary files /dev/null and b/3_cv_basics/1_image_representation/image1.bmp differ diff --git a/3_cv_basics/1_image_representation/image_representation.cpp b/3_cv_basics/1_image_representation/image_representation.cpp new file mode 100644 index 0000000..e0b6a9d --- /dev/null +++ b/3_cv_basics/1_image_representation/image_representation.cpp @@ -0,0 +1,153 @@ +#include "image_representation.hpp" + +// Pragma directives are used to control allignment of the padding. +// When reading the binary file, it is necessary to allign struct members in a meomory to avoid any misinterpretation. +// That is why, push is used to set the packing to 1 byte, so that the BMPHeader struct is packed with no padding +// and the pop is used to restore the default packing setting after the BMPHeader struct is defined. +// More about data padding and alignment can be found here: https://www.geeksforgeeks.org/structure-member-alignment-padding-and-data-packing/ +#pragma pack(push, 1) + +// structure to store the file type data +struct BitMapFileHeader +{ + char file_type[2]; // "BM" (0x42, 0x4D) + uint32_t file_size; // Total size of the BMP file in bytes + uint16_t reserved1; // Unused (0) + uint16_t reserved2; // Unused (0) + uint32_t pixel_data_offset; // Offset to the start of the pixel data +}; + +// structure to store image information data +struct BitMapInfoHeader +{ + uint32_t header_size; // Size of this header (40 bytes) + int32_t width; // Width of the image in pixels + int32_t height; // Height of the image in pixels + uint16_t planes; // Number of color planes (1) + uint16_t bits_per_pixel; // Number of bits per pixel (8 for grayscale) + uint32_t compression; // Compression method (0 for uncompressed) + uint32_t image_size; // Size of the raw image data (0 for uncompressed) + int32_t x_pixels_per_meter; // Horizontal resolution in pixels per meter + int32_t y_pixels_per_meter; // Vertical resolution in pixels per meter + uint32_t colors_used; // Number of colors used in the image, 0 means all colors are used + uint32_t colors_important; // Number of important colors used, 0 means all colors are important +}; + +// Define the BMPImage structure that contains the File Type Data, Image Information data and the pixel data +struct BMPImage +{ + BitMapFileHeader header; // File Type Data + BitMapInfoHeader info; // Image Information Data + std::vector data; // Raw Pixel Data +}; +#pragma pack(pop) + +// Main function +int main(int argc, char *argv[]) +{ + if (argc != 2) + { // Check if the user provided an input file and return error message if file not found + std::cerr << "Usage: " << argv[0] << " " << std::endl; + return 1; + } + + // Read the BMP image from file + // open the input file using the filename passed in as an argument (stored in argv[1]). + std::ifstream infile(argv[1], std::ios::binary); + if (!infile) + { + std::cerr << "Error: Could not open input file: " << argv[1] << std::endl; + return 1; + } + + // create a BMPImage object to hold the image data. + BMPImage image; + + // read the BMP image file and store the size of BitMapFileHeader (14 bytes) in image.header + infile.read(reinterpret_cast(&image.header), sizeof(BitMapFileHeader)); + + // check if the first two bytes of the BMP header indicate that this is a BMP image (the signature 'BM'). If not, print an error message which returns 1. + if (image.header.file_type[0] != 'B' || image.header.file_type[1] != 'M') + { + std::cerr << "Error: Input file is not a BMP image" << std::endl; + return 1; + } + + // Output image file type data to the console + std::cout << "\n-------------------- Bit Map File Header --------------------" << std::endl; + std::cout << "File type: " << image.header.file_type << std::endl; + std::cout << "File Size: " << image.header.file_size << std::endl; + std::cout << "Pixel Data Offset: " << image.header.pixel_data_offset << std::endl; + std::cout << "-------------------------------------------------------------\n" << std::endl; + + // read the BMP image file and store the size of BitMapInfoHeader (40 bytes) in image.info + infile.read(reinterpret_cast(&image.info), sizeof(BitMapInfoHeader)); + if (image.info.bits_per_pixel != 8) + { + std::cerr << "Error: Input file is not an 8-bit BMP image" << std::endl; + return 1; + } + + int h = image.info.height; + int w = image.info.width; + + // Output image attributes to console + std::cout << "-------------------- Bit Map Info Header --------------------" << std::endl; + std::cout << "Header Size: " << image.info.header_size << std::endl; + std::cout << "Width: " << image.info.width << std::endl; + std::cout << "Height: " << image.info.height << std::endl; + std::cout << "Planes: " << image.info.planes << std::endl; + std::cout << "Bits per pixel: " << static_cast(image.info.bits_per_pixel) << std::endl; + std::cout << "Compression type: " << image.info.compression << std::endl; + std::cout << "Image Size: " << image.info.image_size << std::endl; + std::cout << "X pixels per meter: " << image.info.x_pixels_per_meter << std::endl; + std::cout << "Y pixels per meter: " << image.info.y_pixels_per_meter << std::endl; + std::cout << "Number of Colors Used: " << image.info.colors_used << std::endl; + std::cout << "Number of important colors: " << image.info.colors_important << std::endl; + std::cout << "-------------------------------------------------------------\n" << std::endl; + + // if valid, the code allocates memory for the image data (the pixel values) by resizing the image.data vector to hold width x height elements. + image.data.resize(w * h); + + // read the image data from the input file into the image.data vector + infile.read(reinterpret_cast(image.data.data()), image.data.size()); + + // To plot the data of each grayscale pixel fetched from the bitmap file, SDL2 library is used + SDL_Event event; + SDL_Renderer *renderer; + SDL_Window *window; + SDL_Init(SDL_INIT_VIDEO); + + // Create a Window and Renderer component to display on screen + SDL_CreateWindowAndRenderer(w, h, 0, &window, &renderer); + SDL_SetRenderDrawColor(renderer, 255, 255, 255, 0); + SDL_RenderClear(renderer); + + // Plot each pixel on the screen based on its location + for (int i = 0; i < h; i++) + { + for (int j = 0; j < w; j++) + { + uint8_t k = image.data[j + i * h]; + SDL_SetRenderDrawColor(renderer, k, k, k, 255); + + // It is to be noted that SDL library follows botton left as the origin of the image + SDL_RenderDrawPoint(renderer, j, h - i - 1); + } + } + + SDL_RenderPresent(renderer); + + // keeping the window active till the quit button is pressed + while (1) + { + if (SDL_PollEvent(&event) && event.type == SDL_QUIT) + break; + } + + // Free up the resources + SDL_DestroyRenderer(renderer); + SDL_DestroyWindow(window); + SDL_Quit(); + return EXIT_SUCCESS; +} diff --git a/3_cv_basics/1_image_representation/image_representation.hpp b/3_cv_basics/1_image_representation/image_representation.hpp new file mode 100644 index 0000000..e2ef01d --- /dev/null +++ b/3_cv_basics/1_image_representation/image_representation.hpp @@ -0,0 +1,13 @@ +#ifndef IMAGE_REPRESENTATION_HPP +#define IMAGE_REPRESENTATION_HPP + +#include +#include +#include +#include +#include + + + + +#endif // IMAGE_REPRESENTATION_HPP