Example SCOPE wrappers in C#
Optasia wrapper for LPR processor
  1. public class LPRProcessor : Processor
  2.     {
  3.         public override IEnumerable<Row> Process(RowSet input, Row outputRow, string[] args)
  4.         {
  5.             //Initialize the LPR processor
  6.             LPRwrapperM lp = new LPRwrapperM(args[0], args[1]);
  7.  
  8.             //For each input row corresponding to an image patch, detect the lincense plates
  9.             foreach (Row row in input.Rows)
  10.             {
  11.                 //Read image binary from the last column
  12.                 byte[] ary1 = row[row.Count - 1].Binary;
  13.                  
  14.                 //Initilize the image
  15.                 img im = new img(ary1, ary1.Length, 1);
  16.                 //Call LPR
  17.                 List<problpM> lps = lp.getLPs(im, 0.85f);
  18.                 //Return probabilistic LPR results
  19.                 foreach (var item in lps)
  20.                 {
  21.                     outputRow[0].Set(row[0].Integer);
  22.                     outputRow[1].Set(row[1].Integer);
  23.                     outputRow[2].Set(item.getLP());
  24.                     outputRow[3].Set((float)item.getProb());
  25.                     yield return outputRow;
  26.                 }
  27.             }
  28.         }
  29.     }

Optasia wrapper for classifier processor
  1. public class ClassifierProcessor : Processor
  2.     {  
  3.         public override IEnumerable<Row> Process(RowSet input, Row outputRow, string[] args)
  4.         {
  5.             //Initialize the classifier
  6.             classifierM c = new classifierM(CLAS.LIBLINEAR, args[0]);
  7.  
  8.             //For each input row corresponding to a feature vector, apply the classifier
  9.             foreach (Row row in input.Rows)
  10.             {
  11.                 //Decode double vector
  12.                 List<float> feat = Optasia.Decode(row[row.Count - 1].Binary);
  13.                 //Call the classifier
  14.                 var result = c.predict(feat);
  15.                 //Return probabilistic results
  16.                 foreach (var pair in result)
  17.                 {
  18.                     outputRow[0].Set((int)row[0].Value);
  19.                     outputRow[1].Set((int)row[1].Value);
  20.                     outputRow[2].Set(pair.Key);
  21.                     outputRow[3].Set(pair.Value);
  22.                     yield return outputRow;
  23.                 }
  24.             }
  25.         }
  26.     }

Optasia wrapper for tracking reducer
  1. public class TrackingReducer : Reducer
  2.     {
  3.         public override IEnumerable<Row> Reduce(RowSet input, Row outputRow, string[] args)
  4.         {
  5.             bool init = false;
  6.             //Initialize the tracking module
  7.             TrackingWrapperM t = new TrackingWrapperM(args[0].Split(',').ToList(),
  8.                 args[1].Split(',').ToList(), args[2].Split(',').ToList());
  9.             //For each input row corresponding to a new image frame, run the tracking
  10.             foreach (Row row in input.Rows)
  11.             {
  12.                 List<carM> results = new List<carM>();
  13.                 img im = new img(row[row.Count - 1].Binary, row[row.Count - 1].Binary.Length, 1);
  14.  
  15.                 if (!init) //Construct first-frame reference
  16.                 {
  17.                     t.init(im);
  18.                     init = true;
  19.                 }
  20.                 else //Call the tracking module
  21.                     results = t.run(im);
  22.  
  23.                 //Return all tracking records
  24.                 foreach (var item in results)
  25.                 {
  26.                     outputRow[0].Set(row[0].Integer);
  27.                     outputRow[1].Set(row[1].Integer);
  28.                     outputRow[2].Set(item.data);
  29.                     outputRow[3].Set(item.inbox);
  30.                     outputRow[4].Set(item.inFrameId);
  31.                     outputRow[5].Set(item.outbox);
  32.                     outputRow[6].Set(item.outFrameId);
  33.  
  34.                     yield return outputRow;
  35.                 }
  36.             }
  37.         }
  38.     }