#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cmath>
usingnamespace std;
constint rows = 4,
cols = 4;
int main()
{
int intImage[rows][cols],
charImage[rows][cols],
rc[rows][cols],
i,
j,
maximum;
ifstream infile;
infile.open("TextFile1.txt"); //Importing TExtFile1.txt
if (!infile) //Checks whether or not the program can locate the file or not
{
cerr << "file could not be found\n"; //Displays an error message
exit(1); //Ends the program
}
cout << "The image before the Roberts Cross operator has been applied to it";
for (i = 0; i < rows; i++)
{
for (j = 0; j < cols; j++)
{
infile >> intImage[i][j];
}
}
for (i = 0; i < rows; i++)
{
for (j = 0; j < cols; j++)
{
cout << intImage[i][j] << " ";
}
cout << endl;
}
cout << "The image after the Roberts Cross operator has been applied to it";
for (i = 0; i < rows; i++)
{
for (j = 0; j < cols; j++)
{
rc[i][j] = (| intImage[i][j] - intImage[i + 1][j + 1] | , | intImage[i + 1][j] - intImage[i][j + 1] | );
}
}
return 0;
}