Click here to Skip to main content
15,889,403 members
Home / Discussions / C#
   

C#

 
GeneralRe: Code optimization Pin
tvbarnard18-Oct-09 3:10
tvbarnard18-Oct-09 3:10 
GeneralRe: Code optimization Pin
DaveyM6918-Oct-09 3:25
professionalDaveyM6918-Oct-09 3:25 
AnswerRe: Code optimization Pin
Eddy Vluggen18-Oct-09 2:33
professionalEddy Vluggen18-Oct-09 2:33 
GeneralRe: Code optimization Pin
tvbarnard18-Oct-09 3:28
tvbarnard18-Oct-09 3:28 
GeneralRe: Code optimization Pin
Eddy Vluggen18-Oct-09 3:37
professionalEddy Vluggen18-Oct-09 3:37 
GeneralRe: Code optimization Pin
tvbarnard18-Oct-09 3:52
tvbarnard18-Oct-09 3:52 
GeneralRe: Code optimization Pin
Luc Pattyn19-Oct-09 4:21
sitebuilderLuc Pattyn19-Oct-09 4:21 
GeneralRe: Code optimization Pin
tvbarnard19-Oct-09 5:09
tvbarnard19-Oct-09 5:09 
Thanks, that's the best insight yet.

This is the equivalent of the code I'm using (hopefully more clear):

class Classifier
{
   int[] posPoints //for example = {1, 10, 15}
   int[] negPoints // {20, 30, 2} (both sets have maximum of 10 points)
}

class Image
{
   double[,] imageData; //typically 24x24 greyscale, thus 36KB
}

//example method that uses images and classifiers:


void doCalculations(List<Image> images, List<Classifier> classifiers)
{
   foreach(Image image in images)
   {
      foreach(Classifier classifier in classifiers)
      {
         double value = 0;

         foreach(int p in posPoints)
         {
            value += image.imageData[p];
         }
         foreach(int p in negPoints)
         {
            value -= image.imageData[p];
         }
         
         //More code here: decide on image type based on "value"...
      }
   }
}


This method "doCalculations" would typically be called 500 times during the entire process (so that's where the 500 came from Smile | :) )

In case you were wondering, the reason I need classes is because extra data associated with each image or classifier is stored in the class (which I have omitted here).

tvb

GeneralRe: Code optimization Pin
Luc Pattyn19-Oct-09 5:37
sitebuilderLuc Pattyn19-Oct-09 5:37 
GeneralRe: Code optimization Pin
tvbarnard19-Oct-09 6:02
tvbarnard19-Oct-09 6:02 
GeneralRe: Code optimization Pin
Luc Pattyn19-Oct-09 6:40
sitebuilderLuc Pattyn19-Oct-09 6:40 
GeneralRe: Code optimization Pin
tvbarnard19-Oct-09 6:55
tvbarnard19-Oct-09 6:55 
GeneralRe: Code optimization Pin
Luc Pattyn19-Oct-09 7:06
sitebuilderLuc Pattyn19-Oct-09 7:06 
GeneralRe: Code optimization Pin
tvbarnard19-Oct-09 7:41
tvbarnard19-Oct-09 7:41 
GeneralRe: Code optimization Pin
Luc Pattyn19-Oct-09 12:45
sitebuilderLuc Pattyn19-Oct-09 12:45 
AnswerRe: Code optimization Pin
tvbarnard20-Oct-09 1:33
tvbarnard20-Oct-09 1:33 
GeneralRe: Code optimization Pin
Luc Pattyn20-Oct-09 1:40
sitebuilderLuc Pattyn20-Oct-09 1:40 
GeneralRe: Code optimization Pin
tvbarnard20-Oct-09 6:50
tvbarnard20-Oct-09 6:50 
GeneralRe: Code optimization Pin
Luc Pattyn20-Oct-09 6:53
sitebuilderLuc Pattyn20-Oct-09 6:53 
GeneralRe: Code optimization Pin
tvbarnard20-Oct-09 6:55
tvbarnard20-Oct-09 6:55 
GeneralRe: Code optimization Pin
Luc Pattyn18-Oct-09 11:24
sitebuilderLuc Pattyn18-Oct-09 11:24 
GeneralRe: Code optimization Pin
tvbarnard18-Oct-09 22:37
tvbarnard18-Oct-09 22:37 
GeneralRe: Code optimization Pin
Luc Pattyn19-Oct-09 4:27
sitebuilderLuc Pattyn19-Oct-09 4:27 
GeneralRe: Code optimization Pin
tvbarnard19-Oct-09 4:42
tvbarnard19-Oct-09 4:42 
GeneralRe: Code optimization Pin
tvbarnard18-Oct-09 3:31
tvbarnard18-Oct-09 3:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.