const int maxs = 1544 * 2304 * 2;
void analyse(char *buf_src, unsigned short *buff_dst, int len = maxs)
{
int i;
buff_dst[i = 0] = 0;
for (char *p = buf_src; *p && p - buf_src < len; p++)
{
if (*p == ' ')
{
/*cout << numbers[i] << endl;*/
buff_dst[++i] = 0;
}
else
buff_dst[i] = buff_dst[i] * 10 + *p - '0';
}
}
int main(int argc, char* argv[])
{
ifstream filestr;
filestr.open("test.txt", ios::binary);
filebuf *pbuf = filestr.rdbuf();
const long size = pbuf->pubseekoff(0, ios::end, ios::in);
pbuf->pubseekpos(0, ios::in);
auto* buffer = new char[size];
pbuf->sgetn(buffer, size);
filestr.close();
//cout.write(buffer, size);
auto*buff_dst = new unsigned short[1544 * 2304];
analyse(buffer, buff_dst, size);
const Mat image = Mat(1544, 2304, CV_16UC1);
memcpy(image.data, buff_dst, 1544*2304*2);
delete[]buffer;
return 0;
}
void analyse(char *buf_src, unsigned short *buff_dst, int len = maxs)
{
int i;
buff_dst[i = 0] = 0;
for (char *p = buf_src; *p && p - buf_src < len; p++)
{
if (*p == ' ')
{
/*cout << numbers[i] << endl;*/
buff_dst[++i] = 0;
}
else
buff_dst[i] = buff_dst[i] * 10 + *p - '0';
}
}
int main(int argc, char* argv[])
{
ifstream filestr;
filestr.open("test.txt", ios::binary);
filebuf *pbuf = filestr.rdbuf();
const long size = pbuf->pubseekoff(0, ios::end, ios::in);
pbuf->pubseekpos(0, ios::in);
auto* buffer = new char[size];
pbuf->sgetn(buffer, size);
filestr.close();
//cout.write(buffer, size);
auto*buff_dst = new unsigned short[1544 * 2304];
analyse(buffer, buff_dst, size);
const Mat image = Mat(1544, 2304, CV_16UC1);
memcpy(image.data, buff_dst, 1544*2304*2);
delete[]buffer;
return 0;
}