43 #include <opencv/cv.h>
44 #include <opencv/highgui.h>
51 keyVal = cvWaitKey(10);
56 if ((
char) keyVal ==
'p') {
57 fprintf(stderr,
"Pause key pressed ! Press any to continue\n");
58 rasterPlotAll(10,
false);
61 else if( (
char) keyVal ==
's') {
63 rasterPlotAll(10,
false);
66 else if( (
char) keyVal ==
'q') {
70 else if( (
char) keyVal ==
'b') {
73 else if( (
char) keyVal ==
'n') {
82 static int winCounter;
97 void spikeRaster(
CpuSNN* s,
int grpId,
unsigned int* Nids,
unsigned int* timeCnts,
spikeRaster_t* sR)
101 cvNamedWindow(sR->winName);
102 if(sR->firstDisplay) {
103 cvMoveWindow(sR->winName, sR->xPos, sR->yPos);
105 sR->imgWin = cvCreateMat(160, 160, CV_8UC1);
107 sR->firstDisplay =
false;
109 CvMat* imgWin = sR->imgWin;
113 for (
int t=0; t < 1000; t++) {
114 for(
int i=0; i<timeCnts[t];i++,pos++) {
116 assert(
id <= grp_Info[gid].EndN);
117 assert(
id >= grp_Info[gid].StartN);
118 int val =
id-grp_Info[gid].StartN-sR->offset;
119 if( (val < sR->maxSize) && (val >= 0)) {
121 if ( sR->yScale < 2) {
122 if( (sR->maxSize+10-val) < MAX_CV_WINDOW_PIXELS) {
123 *((uchar*)CV_MAT_ELEM_PTR( *imgWin, sR->maxSize+10-val, t/2)) = 255.0;
127 if ( sR->maxSize+10-val*sR->yScale < MAX_CV_WINDOW_PIXELS) {
128 *((uchar*)CV_MAT_ELEM_PTR( *imgWin, sR->maxSize+10-val*sR->yScale, t/2)) = 255.0;
129 *((uchar*)CV_MAT_ELEM_PTR( *imgWin, sR->maxSize+10-1-val*sR->yScale, t/2)) = 255.0;
130 *((uchar*)CV_MAT_ELEM_PTR( *imgWin, sR->maxSize+10-val*sR->yScale, 1+t/2)) = 255.0;
131 *((uchar*)CV_MAT_ELEM_PTR( *imgWin, sR->maxSize+10-1-val*sR->yScale, 1+t/2)) = 255.0;
138 cvShowImage(winName, imgWin);
Contains all of CARLsim's core functionality.