Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Matrix Matrix::splitScene(int i, int j) //Split image into blocks
- {
- int endingRow = 49+i; //49+i
- int endingCol = 36+j; //36+j
- double* tempData = new double[49*36];
- int count = 0;
- for (int x = i; x < endingRow; x++)
- {
- for (int y = j; y < endingCol; y++)
- {
- tempData[count] = _data[(y*_N)+x];
- count++;
- }
- }
- Matrix temp(49, 36, tempData);
- delete[] tempData;
- return temp;
- }
- double* Matrix::getData() //getting data
- {
- return _data;
- }
- void Matrix::set(double* inputData) //sets pixels for each block based on ssd data
- {
- int number=0;
- for (int i = 0; i < 49; i++)
- {
- for (int j = 0; j < 36; j++)
- {
- _data[(i * _N) + j] = inputData[number];
- number++;
- }
- }
- delete [] inputData;
- }
- Matrix Matrix::operator=(const Matrix& other)
- {
- delete[] _data;
- _M = other._M;
- _N = other._N;
- _data = new double[_M*_N];
- for (int i = 0; i < (_M*_N); i++)
- {
- this->_data[i] = other._data[i];
- }
- return *this;
- }
- Matrix Matrix::operator*(const Matrix& other)
- {
- for (int i = 0; i < (_M*_N); i++)
- {
- this->_data[i] = this->_data[i] * other._data[i];
- }
- return *this;
- }
- Matrix Matrix::operator-(const Matrix& other) //overload allowing -ing of matrices
- {
- for (int i = 0; i < (_M*_N); i++)
- {
- this->_data[i] = this->_data[i] - other._data[i];
- }
- return *this;
- }
Advertisement
Add Comment
Please, Sign In to add comment