Question: #include #include //file read/write #include //string library using namespace std; { // application to image processing int row = 0, col = 0, numrows =
#include unsigned char* data1D = new unsigned char[numrows*numcols]; // for data read infile.read(reinterpret_cast(data1D), numrows*numcols * sizeof(unsigned char)); // Now print the array and process the data for (row = 0; row 100) // image processing: binarization data1D[row*numcols + col] = 255; else data1D[row*numcols + col] = 0; } cout // save to image ofstream ofp; string fname = "processed.pgm"; ofp.open(fname, ios::binary ); if (!ofp) { cout 
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
