Beispiel #1
0
        public override string ToString()
        {
            var result   = FrameNumber.ToString("000000") + ":";
            var defaults = (new FrameState()).Inputs;

            foreach (var change in Changes)
            {
                if (ValuesEqual(change.Value, defaults[change.Key]))
                {
                    result += " ~" + change.Key;
                }
                else if (change.Key == "SPEED")
                {
                    result += " SPEED:" + change.Value;
                }
                else if (change.Key == "LX" || change.Key == "LY" || change.Key == "RX" || change.Key == "RY")
                {
                    result += " " + change.Key + ":" + (int)change.Value;
                }
                else if ((int)change.Value == 1)
                {
                    result += " " + change.Key;
                }
            }
            if (!string.IsNullOrEmpty(Comment))
            {
                result += new string(' ', Math.Max(35 - result.Length, 0))
                          + " // " + Comment;
            }
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Retrieves the string representation of this object
        /// </summary>
        /// <returns></returns>

        public override string ToString()
        {
            return
                (FrameNumber.ToString(NumberFormat) + ' ' +
                 Score.ToString(ScoreFormat) + ' ' +
                 AcousticScore.ToString(ScoreFormat) + ' ' +
                 LanguageScore.ToString(ScoreFormat) + ' ' +
                 SearchState);
        }
Beispiel #3
0
        public string ToListItem(Font font, int listWidth)
        {
            var result   = FrameNumber.ToString();
            var defaults = new FrameState();

            while (TextRenderer.MeasureText(result, font).Width < listWidth - (listWidth - (listWidth / 7)))
            {
                result += ' ';
            }

            foreach (var change in Changes)
            {
                if (ValuesEqual(change.Value, defaults.Inputs[change.Key]))
                {
                    result += " ~" + change.Key;
                }
                else if (change.Key == "SPEED")
                {
                    result += " SPEED:" + change.Value;
                }
                else if (change.Key == "LX" || change.Key == "LY" || change.Key == "RX" || change.Key == "RY")
                {
                    result += " " + change.Key + ":" + (int)change.Value;
                }
                else if ((int)change.Value == 1)
                {
                    result += " " + change.Key;
                }
            }

            if (Random != string.Empty)
            {
                if (Random == defaults.Random)
                {
                    result += " ~RNG";
                }
                else
                {
                    result += " RNG:" + Random;
                }
            }

            if (!string.IsNullOrEmpty(Comment))
            {
                while (TextRenderer.MeasureText(result, font).Width < listWidth - (int)(listWidth / 2.4f))
                {
                    result += ' ';
                }

                result += ' ' + Comment;
            }

            return(result);
        }
Beispiel #4
0
 public void writeXml(System.Xml.XmlWriter writer)
 {
     writer.WriteElementString("timeStamp", FrameTime.ToString());
     writer.WriteElementString("frameNumber", FrameNumber.ToString());
     writer.WriteElementString("sensor", Sensor.ToString());
     writer.WriteElementString("ground", String.Format("{0},{1},{2},{3}", GroundW, GroundX, GroundY, GroundZ));
     writer.WriteElementString("trackingID", TrackingId.ToString());
     writer.WriteStartElement("skeleton");
     if (Joints != null)
     {
         foreach (var joint in Joints)
         {
             string jointStr = string.Format("{0},{1},{2},{3},{4},{5}", joint.TrackingState.ToString(), joint.X.ToString(), joint.Y.ToString(), joint.Z.ToString(), joint.DepthX.ToString(), joint.DepthY.ToString());
             writer.WriteElementString(Enum.GetName(typeof(JointTypeGait), joint.JointType), jointStr);
         }
     }
     writer.WriteElementString("frameEdges", FrameEdges.ToString());
     writer.WriteEndElement(); // skeleton
     writer.WriteElementString("currentTime", CurrentTime.ToString());
     writer.WriteElementString("lean", String.Format("{0},{1},{2}", LeanX, LeanY, LeanTrackingState));
     writer.WriteStartElement("wii");
     writer.WriteElementString("COP", String.Format("{0},{1}", WiiBoardData.CenterOfPressureX, WiiBoardData.CenterOfPressureY));
     writer.WriteElementString("raw", String.Format("{0},{1},{2},{3}", WiiBoardData.Raw.TopLeft, WiiBoardData.Raw.TopRight, WiiBoardData.Raw.BottomLeft, WiiBoardData.Raw.BottomRight));
     writer.WriteElementString("cal0", String.Format("{0},{1},{2},{3}", WiiBoardData.Calib0kg.TopLeft, WiiBoardData.Calib0kg.TopRight, WiiBoardData.Calib0kg.BottomLeft, WiiBoardData.Calib0kg.BottomRight));
     writer.WriteElementString("cal17", String.Format("{0},{1},{2},{3}", WiiBoardData.Calib17kg.TopLeft, WiiBoardData.Calib17kg.TopRight, WiiBoardData.Calib17kg.BottomLeft, WiiBoardData.Calib17kg.BottomRight));
     writer.WriteElementString("cal34", String.Format("{0},{1},{2},{3}", WiiBoardData.Calib34kg.TopLeft, WiiBoardData.Calib34kg.TopRight, WiiBoardData.Calib34kg.BottomLeft, WiiBoardData.Calib34kg.BottomRight));
     writer.WriteEndElement();  // wii
     writer.WriteStartElement("depth");
     writer.WriteElementString("mean", String.Format("{0},{1},{2}", depthMeanX, depthMeanY, depthMeanZ));
     writer.WriteElementString("cov", String.Format("{0},{1},{2},{3},{4},{5}", depthMeanXX, depthMeanXY, depthMeanXZ, depthMeanYY, depthMeanYZ, depthMeanZZ));
     writer.WriteEndElement();  // depth
     writer.WriteStartElement("silhouette");
     writer.WriteElementString("points", silhouettePointsToString(silhouette.points));
     writer.WriteElementString("resolution", silhouette.resolution.ToString());
     writer.WriteElementString("xRange", silhouette.xRange.ToString());
     writer.WriteElementString("yRange", silhouette.yRange.ToString());
     writer.WriteElementString("zRange", silhouette.zRange.ToString());
     writer.WriteElementString("trackQuality", silhouette.trackQuality.ToString());
     writer.WriteElementString("numberOfPixelsInBody", silhouette.numberOfPixelsInBody.ToString());
     writer.WriteElementString("ground", String.Format("{0},{1},{2},{3}", silhouette.groundW, silhouette.groundX, silhouette.groundY, silhouette.groundZ));
     writer.WriteElementString("mean", String.Format("{0},{1},{2}", silhouette.depthMeanX, silhouette.depthMeanY, silhouette.depthMeanZ));
     writer.WriteElementString("Cov", String.Format("{0},{1},{2},{3},{4},{5}", silhouette.depthMeanXX, silhouette.depthMeanXY, silhouette.depthMeanXZ, silhouette.depthMeanYY, silhouette.depthMeanYZ, silhouette.depthMeanZZ));
     writer.WriteEndElement();  // silhouette
 }
Beispiel #5
0
        private void bgSaveImage_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            Console("Start Record");

            while (true)
            {
                try
                {
                    var bmp1 = new Bitmap(pictureBox1.Image);

                    var parthSave    = txtParthSave.Text + "\\" + FrameNumber + ".bmp";
                    var parthPreview = txtParthPreview.Text;

                    var qualitySave    = int.Parse(textQualitySave.Text);
                    var qualityPreview = int.Parse(txtQualityPreview.Text);

                    var jpgEncoder          = GetEncoder(ImageFormat.Jpeg);
                    var myEncoderParameters = new EncoderParameters(1);

                    myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, qualitySave);
                    bmp1.Save(parthSave, jpgEncoder, myEncoderParameters);

                    myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, qualityPreview);
                    bmp1.Save(parthPreview, jpgEncoder, myEncoderParameters);

                    this.Invoke((MethodInvoker) delegate() { txtFrame.Text = FrameNumber.ToString(); });
                    FrameNumber++;
                }
                catch (Exception ex)
                {
                    ex.ToString();
                }

                Thread.Sleep(1000);
            }
        }