+/**
+ * Create a test image using left as left edge and right as right edge positions
+ */
+void Dilatometer_TestImage()
+{
+
+ g_srcRGB = cvCreateMat(480, 640, CV_8UC3);
+
+ for( int x = 0; x < 640; ++x)
+ {
+ for (int y = 0; y < 480; ++y)
+ {
+ CvScalar s;
+ for( int i = 0; i < 3; ++i)
+ {
+ s.val[i] = 210 + (rand() % 1000) * 1e-0 - (rand() % 1000) * 1e-0;
+ // Produce an exponential decay around left edge
+ if( x < test_left)
+ s.val[i] *= exp( (x - test_left) / 25);
+ else if( x < 320)
+ s.val[i] *= exp( (test_left - x) / 25);
+ // Produce an exponential decay around right edge
+ else if( x < test_right)
+ s.val[i] *= exp( (x - test_right) / 25);
+ else
+ s.val[i] *= exp( (test_right - x) / 25);
+ }
+ cvSet2D(g_srcRGB,y,x,s);
+ // if( s.val[0] > 200)
+ // printf("row: %d, col: %d, %f\n", y, x, s.val[0]);
+ }
+
+ }
+ if (g_data == NULL)
+ {
+ g_data = cvCreateMat(g_srcRGB->rows,g_srcRGB->cols,CV_8UC1); //IPL_DEPTH_8U?
+ }
+ cvCvtColor(g_srcRGB,g_data,CV_RGB2GRAY);
+}