#define ALIGNMENT 32 //Set to 16 bytes for SSE architectures and 32 bytes for Intel(R) AVX architectures using namespace std; #define THRESH_LOW 50.f /* Low threshold for edges detection */ #define THRESH_HIGHT 150.f /* Upper threshold for edges detection */ #define BORDER_VAL 0 #include #include #include #include #include "opencv2/core.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/highgui.hpp" #include "opencv2/videoio.hpp" #if defined(_WIN32) #include #else #include #endif int size_of_image; using namespace cv; Mat image; // This is the data structure for Windows 3.x Bitmap File header #pragma pack(push,1) typedef struct { char filetype[2]; //Identifies it as a .bmp file. Has filetype[0]='B' and filetype[1]='M' unsigned int filesize; short reserved1; short reserved2; unsigned int dataoffset; //offset in bytes to starting address where the bitmap data starts } file_header; // This is the data structure for Windows 3.x Full header which includes the file header too typedef struct { file_header fileheader; unsigned int headersize; int width; //Width for the image in terms of number of pixels int height; //Height for the image in terms of number of pixels short planes; short bitsperpixel; //This field indentifies if the image is in RGB format or Gray scale unsigned int compression; //This parameter mentions the type of compression involved. In our case we are not concerned about the compression but rather working with the plain image without compression unsigned int bitmapsize; //The total size of the image data in bytes int horizontalres; int verticalres; unsigned int numcolors; unsigned int importantcolors; } bitmap_header; //This is the data structure which is going to represent one pixel value in Gray Scale format typedef struct { unsigned char pixel_value; } gray_scale; #pragma pack(pop)