1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
CImg<unsigned char> hrtBtPts(lineNmb,200,1,3,0);
const unsigned char black[] = { 0,0,0 }, white[] = { 255,255,255 }, green[] = { 0,255,0 };
int x0 = lineNmb, y0 = (wavarray[0] - 408), x1, y1; // data points for drawing line
for (int i = 0; i < lineNmb; ++i)
{
x1 = lineNmb - i; // reverse data direction
y1 = wavarray[i] - 408; // -408 for alignment (baseline value seems to be 507-509)
hrtBtPts.draw_line(x0,y0,x1,y1,green);
x0 = x1, y0 = y1;
}
hrtBtPts.rotate(180); // rotate image 180 degrees
hrtBtPts.draw_grid(10,10,0,0,false,false,white,0.1f,0x55555555,0x55555555)
.draw_grid(50,50,0,0,false,false,white,0.2f,0x55555555,0x55555555)
.draw_axes(0,0,2,-2,white,0.8f);
CImgDisplay disp(hrtBtPts, "Heartbeat Monitor Static Display");
hrtBtPts.save_bmp("hrtBtPts.bmp");
cin.ignore();
|