/// <summary> Call the ResizeFingers function. </summary>
 /// <param name="source"></param>
 /// <param name="args"></param>
 protected virtual void SenseGlove_OnCalibrationFinished(object source, CalibrationArgs args)
 {
     if (this.resizeFingers)
     {
         this.ResizeHand(args.newFingerLengths);
     }
 }
예제 #2
0
 /// <summary> Used to call the OnCalibrationFinished event. </summary>
 /// <param name="calibrationArgs"></param>
 protected void CalibrationFinished(CalibrationArgs calibrationArgs)
 {
     if (OnCalibrationFinished != null)
     {
         OnCalibrationFinished(this, calibrationArgs);
     }
 }
예제 #3
0
    //------------------------------------------------------------------------------------------------------------------------------------
    // Manual Calibration Steps


    /// <summary> Call the CalibrationFinished event when the calculations within the DLL are finished. </summary>
    /// <param name="source"></param>
    /// <param name="args"></param>
    private void Glove_OnFingerCalibrationFinished(object source, FingerCalibrationArgs args)
    {
        //this.gloveData = glove.GetData(false); //retrieve the latest gloveData, which contains the new lengths.
        //this.convertedGloveData = new SenseGlove_Data(this.gloveData, this.glove.communicator.samplesPerSecond);
        this.calibrationArguments = new CalibrationArgs(args);
        this.fireCalibration      = true;
        //SenseGlove_Debugger.Log("Internal Calibration has finished!");
        //this.CalibrationFinished(arguments);
    }
예제 #4
0
 /// <summary> Fires when the Sense Glove has calculated new finger Lengths. </summary>
 /// <param name="source"></param>
 /// <param name="args"></param>
 private void SenseGlove_OnCalibrationFinished(object source, CalibrationArgs args)
 {
     if (this.canUpdate)
     {
         //the new gloveLengths have already been applied to the SenseGlove-Object, but should be updated in the database.
         HandProfile updatedProfile = new HandProfile(args.newFingerLengths);
         UserProfiles.AddEntry(this.userName, updatedProfile); //update / add entry
         SenseGlove_Debugger.Log("Updated " + this.userName);
     }
 }
    protected override void SenseGlove_OnCalibrationFinished(object source, CalibrationArgs args)
    {
        //resize so that the index finger position remains on the same place
        Vector3 dIndex = args.newJointPositions[1] - args.oldJointPositions[1];

        this.handBase.transform.localPosition  = this.handBase.transform.localPosition - dIndex;
        this.gloveBase.transform.localPosition = this.gloveBase.transform.localPosition - dIndex;

        base.SenseGlove_OnCalibrationFinished(source, args);
    }
    private void TrackedGlove_OnCalibrationFinished(object source, CalibrationArgs args)
    {
        SenseGlove_Debugger.Log("Resizing Model.");
        //Debug.Log( "Old: " + SenseGlove_Util.ToString(args.oldJointPositions[1]) + ", New: " + SenseGlove_Util.ToString(args.newJointPositions[1]));
        Vector3 dJoints = args.newJointPositions[1] - args.oldJointPositions[1];

        this.RescaleHand(args.newFingerLengths);
        this.handGroup.transform.localPosition  = this.handGroup.transform.localPosition - dJoints;
        this.gloveGroup.transform.localPosition = this.gloveGroup.transform.localPosition - dJoints;
    }
예제 #7
0
    /// <summary>
    /// Fire an OnCalibrationFinished Event.
    /// </summary>
    /// <param name="oldLengths"></param>
    /// <param name="newLengths"></param>
    /// <param name="oldPositions"></param>
    /// <param name="newPositions"></param>
    private void FireCalibration(float[][] oldLengths, float[][] newLengths, Vector3[] oldPositions, Vector3[] newPositions)
    {
        CalibrationArgs newArgs = new CalibrationArgs
                                  (
            oldLengths,
            newLengths,
            oldPositions,
            newPositions
                                  );

        this.CalibrationFinished(newArgs);
    }
예제 #8
0
        /// <summary>
        /// Calibrate the zero point of the specified image.
        /// </summary>
        /// <returns>The Zero Point magnitude.</returns>
        /// <param name="Img">Image to calibrate.</param>
        /// <param name="Args">Calibration parameters.</param>
        /// <returns>The Zero Point magnitude.</returns>
        public static double CalibrateImage(Image Img, CalibrationArgs Args)
        {
            DotDetector StarDetector = new DotDetector()
            {
                HighThresholdMultiplier = Args.StarHighThreshold,
                LowThresholdMultiplier  = Args.StarLowThreshold,
                MinPix = 15,
                NonrepresentativeThreshold = Args.NonRepThreshold
            };

            StarDetector.Parameters.Xstep = 0;
            StarDetector.Parameters.Ystep = 200;

            var StList     = StarDetector.DetectRaw(Img);
            var LocalStars = StList.Where((x) => x.Flux > Args.MinFlux & x.Flux < Args.MaxFlux).Where((x) => !x.PixelValues.Any((y) => y > Args.ClippingPoint)).
                             Select((x) => new Star()
            {
                EqCenter = Img.Transform.GetEquatorialPoint(x.Barycenter), Flux = x.Flux, PixCenter = x.Barycenter
            }).ToList();
            PixelPoint PixC = new PixelPoint()
            {
                X = Img.Width / 2, Y = Img.Height / 2
            };
            PixelPoint DiagF = new PixelPoint()
            {
                X = Img.Width, Y = Img.Height
            };
            double Diag = Img.Transform.GetEquatorialPoint(new PixelPoint()
            {
                X = 0, Y = 0
            }) ^ Img.Transform.GetEquatorialPoint(DiagF);
            EquatorialPoint EqCenter    = Img.Transform.GetEquatorialPoint(PixC);
            List <StarInfo> RemoteStars = GetVizieRObjects(EqCenter, Diag / 2, Args.MaxVizierMag);

            for (int i = 0; i < RemoteStars.Count; i++)
            {
                for (int j = i + 1; j < RemoteStars.Count; j++)
                {
                    if ((RemoteStars[i].Coordinate ^ RemoteStars[j].Coordinate) < Arc1Sec * Args.PositionError * DoubleStarRatio)
                    {
                        RemoteStars.RemoveAt(j); RemoteStars.RemoveAt(i); i--; break;
                    }
                }
            }

            return(Calibrate(RemoteStars, LocalStars, Args.PositionError));
        }
예제 #9
0
        private Dictionary <Image, double> CalibrateZP(FitsImage[] Images)
        {
            Dictionary <Image, double> ZP = new Dictionary <Image, double>();

            CalibrationArgs ca = new CalibrationArgs()
            {
                ClippingPoint     = 60000 * Images[0].GetProperty <SWarpScaling>().FlxScale,
                MaxFlux           = 300000,
                MaxVizierMag      = 22,
                MinFlux           = 500,
                NonRepThreshold   = 1,
                PositionError     = 1,
                StarHighThreshold = 30,
                StarLowThreshold  = 5
            };

            Parallel.ForEach(Images, (img) => FindZP(img, ZP, ca));

            return(ZP);
        }
예제 #10
0
        private void FindZP(Image img, Dictionary <Image, double> ZP, CalibrationArgs ca)
        {
            double Mag  = 28.9 + 2.5 * Math.Log10(img.GetProperty <SWarpScaling>().FlxScale);
            double dMag = 0;

            try
            {
                dMag = CalibrateImage(img, ca);
                if (double.IsNaN(dMag))
                {
                    Logger("FP error while calibrating flux");
                }
                else
                {
                    Mag = dMag;
                }
            }
            catch (Exception ex) { Logger("Could not calibrate flux. Error: " + ex.Message); }

            Logger("Zeropoint: " + Mag);
            lock (ZP)
                ZP.Add(img, Mag);
        }
예제 #11
0
 /// <summary> Fires when the glove's internal calibration finished, which may have come from a worker thread. </summary>
 /// <param name="source"></param>
 /// <param name="args"></param>
 private void LinkedGlove_OnCalibrationFinished(object source, CalibrationArgs args)
 {
     this.ReadyCalibration(new GloveCalibrationArgs(args), true);
 }
 /// <summary> Call the ResizeFingers function. </summary>
 /// <param name="source"></param>
 /// <param name="args"></param>
 private void SenseGlove_OnCalibrationFinished(object source, CalibrationArgs args)
 {
     //no resizing for now...
 }
예제 #13
0
    //------------------------------------------------------------------------------------------------------------------------------------
    // Calibration Events


    /// <summary> Call the CalibrationFinished event when the calculations within the DLL are finished. </summary>
    /// <param name="source"></param>
    /// <param name="args"></param>
    private void Glove_OnFingerCalibrationFinished(object source, CalibrationArgs args)
    {
        //comes from the DLL
        this.ReadyCalibration(new GloveCalibrationArgs(args), true);
    }