-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImageMatrix.h
43 lines (32 loc) · 1.5 KB
/
ImageMatrix.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef IMAGE_MATRIX_H
#define IMAGE_MATRIX_H
#include <string>
#include "ImageLoader.h"
class ImageMatrix {
public:
// Constructors and Destructor
ImageMatrix(); // Default constructor
ImageMatrix(const std::string &filepath); // Parameterized constructor for loading image from file
ImageMatrix(int imgHeight, int imgWidth); // Constructor for creating a blank image of given size
ImageMatrix(const double** inputMatrix, int imgHeight, int imgWidth); // Parameterized constructor - direct initialization with 2D matrix
ImageMatrix(const ImageMatrix &other); // Copy constructor
ImageMatrix& operator=(const ImageMatrix &other); // Copy assignment operator
~ImageMatrix(); // Destructor
// Overloaded operators
ImageMatrix operator+(const ImageMatrix &other) const;
ImageMatrix operator-(const ImageMatrix &other) const;
ImageMatrix operator*(const double &scalar) const; // Scalar multiplication
double** get_data() const; // Getter function to access the data in the matrix
double get_data(int i, int j) const; // Getter function to access the data at the index (i, j)
//Getting height and width of an image matrix
int get_height() const;
int get_width() const;
//Setting a cell
void set_data(int i, int j, double newValue);
private:
// Private member variables to store the image data
double** data; // 2D array to store image data
int height; // Height of the matrix
int width; // Width of the matrix
};
#endif // IMAGE_MATRIX_H