Esempio n. 1
0
        public WallProjectionSample(WallProjectionSample wps)
        {
            this.x = wps.x;
            this.y = wps.y;
            this.z = wps.z;

            this.sampledeviceIdentifier = "";
        }
 public WallProjectionAndPositionSample(WallProjectionSample wps, Point3D personPosition)
 {
     this.wallPositionX          = wps.x;
     this.wallPositionY          = wps.y;
     this.wallPositionZ          = wps.z;
     this.personPositionX        = personPosition.X;
     this.personPositionY        = personPosition.Y;
     this.personPositionZ        = personPosition.Z;
     this.sampledeviceIdentifier = wps.sampledeviceIdentifier;
 }
Esempio n. 3
0
 public WallProjectionSample classify(WallProjectionSample sample)
 {
     if (learned != null)
     {
         return(learned.Model.Predict(sample));
     }
     else
     {
         return(null);
     }
 }
Esempio n. 4
0
        public void addSampleAndLearn(WallProjectionSample sample)
        {
            if (sample == null)
            {
                return;
            }

            trainingSamples.Add(sample);

            if (trainingSetSize > 0 && trainingSamples.Count > trainingSetSize)
            {
                Random r    = new Random();
                int    half = (int)Math.Floor((double)(trainingSamples.Count / 2));
                int    pos  = r.Next(half);
                trainingSamples.RemoveAt(pos);
            }
            trainClassifier();
        }
        public String calculateWallProjectionSampleAndLearn(Point3D[] vectors, String deviceIdentifier)
        {
            WallProjectionSample sample = sCalculator.calculateSample(vectors, deviceIdentifier);

            if (sample.sampledeviceIdentifier.Equals("nullSample") == false)
            {
                XMLComponentHandler.writeWallProjectionSampleToXML(sample);
                //Point3D p = new Point3D(vectors[2].X, vectors[2].Y, vectors[2].Z);
                //XMLComponentHandler.writeWallProjectionAndPositionSampleToXML(new WallProjectionAndPositionSample(sample, p));
                //XMLComponentHandler.writeSampleToXML(vectors, sample.sampledeviceIdentifier);

                knnClassifier.addSampleAndLearn(sample);

                return("Sample gesammelt und Klassifikator trainiert");
            }


            return("Es ist ein Fehler beim Erstellen des Samples aufgetreten, bitte versuchen sie es erneut!");
        }
        public WallProjectionSample calculateSample(Point3D[] vectors, String label)
        {
            Ray3D   ray                 = new Ray3D((Point3D)vectors[0], (Point3D)vectors[1]);
            Point3D samplePoint         = intersectAndTestAllWalls(ray);
            WallProjectionSample sample = new WallProjectionSample(new Point3D(), "nullSample");

            if ((samplePoint.X.Equals(float.NaN) == false))
            {
                if (label.Equals(""))
                {
                    sample = new WallProjectionSample(samplePoint);
                }
                else
                {
                    sample = new WallProjectionSample(samplePoint, label);
                }
                return(sample);
            }

            return(sample);
        }
        public WallProjectionSample classify(WallProjectionSample sample)
        {
            WallProjectionSample predictedSample = knnClassifier.classify(sample);

            return(predictedSample);
        }