public trackingPointProperties(trackingPoint tp) { // // Required for Windows Form Designer support // InitializeComponent(); this.col=tp.PColor; this.pointNameTB.Text=tp.PName; this.xyLocXL.Text=Convert.ToString(tp.XyCoordX); this.xyLocYL.Text=Convert.ToString(tp.XyCoordY); this.xzLocXL.Text=Convert.ToString(tp.XzCoordX); this.xzLocZL.Text=Convert.ToString(tp.XzCoordZ); this.yzLocYL.Text=Convert.ToString(tp.YzCoordY); this.yzLocZL.Text=Convert.ToString(tp.YzCoordZ); this.xyRadL.Text=Convert.ToString(tp.XyRadius); this.xzRadL.Text=Convert.ToString(tp.XzRadius); this.yzRadL.Text=Convert.ToString(tp.YzRadius); updating=true; // // TODO: Add any constructor code after InitializeComponent call // }
private void frameTrackingCompletedHandler(trackingPoint sender) { // try // { Message(sender.PName + " tracking for current frame completed"); totalTrackingPoints--; tf.AddPoint(new BaseTypes.trackingPointLite(sender.PName, sender.XyCoordX, sender.XyCoordY, sender.XzCoordX, sender.XzCoordZ, sender.YzCoordY, sender.YzCoordZ, sender.XyRadius, sender.XzRadius, sender.YzRadius, sender.PColor)); if (totalTrackingPoints == 0) processFrame(projectSettings.frameIterator); projectSaved = false; // } // catch (InvalidOperationException) // { // MessageBox.Show("Application internal error!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); // } }
//handles closing project (to re-implement) private void CloseCurrentProject() { if (app_status.GetStatus()>=_app_status.project_active) { saveQuery(); trackingPoints=null; projectSettings=null; viewportXY.Dispose(); viewportXZ.Dispose(); viewportYZ.Dispose(); tempTrackingPoint=null; tf=null; trackingPointsBasicInfo=null; trackingPoints=null; totalTrackingPoints=0; trackingHist = null; viewportXY=null; viewportXZ=null; viewportYZ=null; trackingPointsLB.Items.Clear(); app_status.SetStatus(_app_status.started); } else Message("No active project detected"); }
//handles adding new tracking point (dialog?) private void addTrackingPoint() { if ( app_status.GetStatus()>=_app_status.distance_calibrated) if (viewportXY.isCapture() && viewportXZ.isCapture() && viewportYZ.isCapture()) { tForm = new trackingPointProperties(trackingPointsBasicInfo); tForm.Closing+=new CancelEventHandler(trackingPointPropertiesClosingHandler); tForm.Show(); addingPoint=true; tempTrackingPoint =new trackingPoint("temporary",projectSettings.defaultRadius, System.Drawing.Color.Orange); } else Message("One or more viewports not in capture mode/has no video loaded"); else Message ("Calibrate distance in all viewports first"); }
private void modifyPointParameters() { if (app_status.GetStatus()>=_app_status.points_defined) if (trackingPointsLB.SelectedItem!=null) { Message("Attempting to modify point params..."); foreach (trackingPoint tp in trackingPoints) if (tp.PName==trackingPointsLB.SelectedItem.ToString()) { tempTrackingPoint = new trackingPoint(tp.PName,tp,tp.PColor); break; } oldPointName=tempTrackingPoint.PName; if (viewportXY.isCapture() && viewportXZ.isCapture() && viewportYZ.isCapture()) { tForm = new trackingPointProperties(tempTrackingPoint); tForm.Closing+=new CancelEventHandler(trackingPointPropertiesUpdateClosingHandler); tForm.Show(); addingPoint=true; } else Message("One or more viewports not in capture mode/has no video loaded"); } else Message("Please select tracking point from Defined Points list"); else Message("No points defined yet"); }
//handles loading project private void LoadProject() { Message("Loading project"); loadProjectD.Filter = "Motion capture project files (*.mcp)|*.mcp"; if((loadProjectD.ShowDialog() == System.Windows.Forms.DialogResult.OK) && (loadProjectD.FileName!="")) { if (viewportXY!=null || viewportXZ!=null || viewportYZ!=null) CloseCurrentProject(); InitializeSettings("temp"); IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream(loadProjectD.FileName, FileMode.Open, FileAccess.Read, FileShare.Read); projectSettings = new BaseTypes.Settings(); projectSettings= (BaseTypes.Settings)formatter.Deserialize(stream); stream.Close(); InitializeViewports(); trackingPoints = new ArrayList(); app_status.SetStatus(_app_status.project_active); if (projectSettings.viewportXYScalingType==BaseTypes.scalingType.Custom) viewportXY.loadMedia(projectSettings.viewportXYFileName,(int)projectSettings.viewportXYHorizontalRes,(int)projectSettings.viewportXYVerticalRes); else if (projectSettings.viewportXYScalingType==BaseTypes.scalingType.ScaleBy) viewportXY.loadMedia(projectSettings.viewportXYFileName,projectSettings.viewportXYScalingFactor); else viewportXY.loadMedia(projectSettings.viewportXYFileName); if (projectSettings.viewportXZScalingType==BaseTypes.scalingType.Custom) viewportXZ.loadMedia(projectSettings.viewportXZFileName,(int)projectSettings.viewportXZHorizontalRes,(int)projectSettings.viewportXZVerticalRes); else if (projectSettings.viewportXZScalingType==BaseTypes.scalingType.ScaleBy) viewportXZ.loadMedia(projectSettings.viewportXZFileName,projectSettings.viewportXZScalingFactor); else viewportXZ.loadMedia(projectSettings.viewportXZFileName); if (projectSettings.viewportYZScalingType==BaseTypes.scalingType.Custom) viewportYZ.loadMedia(projectSettings.viewportYZFileName,(int)projectSettings.viewportYZHorizontalRes,(int)projectSettings.viewportYZVerticalRes); else if (projectSettings.viewportYZScalingType==BaseTypes.scalingType.ScaleBy) viewportYZ.loadMedia(projectSettings.viewportYZFileName,projectSettings.viewportYZScalingFactor); else viewportYZ.loadMedia(projectSettings.viewportYZFileName); viewportXY.setStartFrame(projectSettings.viewportXYStartFrame); viewportXZ.setStartFrame(projectSettings.viewportXZStartFrame); viewportYZ.setStartFrame(projectSettings.viewportYZStartFrame); viewportXY.grayscale=projectSettings.viewportXYGreyScale; viewportXY.brightnessCorrection=projectSettings.viewportXYBrightnessCorrectionValue; viewportXY.contrastCorrection=projectSettings.viewportXYContrastCorrectionValue; viewportXZ.grayscale=projectSettings.viewportXZGreyScale; viewportXZ.brightnessCorrection=projectSettings.viewportXZBrightnessCorrectionValue; viewportXZ.contrastCorrection=projectSettings.viewportXZContrastCorrectionValue; viewportYZ.grayscale=projectSettings.viewportYZGreyScale; viewportYZ.brightnessCorrection=projectSettings.viewportYZBrightnessCorrectionValue; viewportYZ.contrastCorrection=projectSettings.viewportYZContrastCorrectionValue; app_status.SetStatus(_app_status.viewports_ready); if (File.Exists(loadProjectD.FileName+"th")) { formatter = new BinaryFormatter(); stream = new FileStream(loadProjectD.FileName+"th", FileMode.Open, FileAccess.Read, FileShare.Read); trackingHist = new BaseTypes.trackingHistory(); trackingHist= (BaseTypes.trackingHistory)formatter.Deserialize(stream); stream.Close(); foreach (BaseTypes.trackingPointLite tpp in trackingHist.initialTrackingPointsSet) { trackingPoint tempTrackingPoint = new trackingPoint(tpp.pName,tpp.xyCoordX,tpp.xyCoordY,tpp.xzCoordX,tpp.xzCoordZ,tpp.yzCoordY,tpp.yzCoordZ,tpp.xyRadius,tpp.xzRadius,tpp.yzRadius, tpp.pColor); trackingPoints.Add(tempTrackingPoint); if (trackingPointsBasicInfo==null) trackingPointsBasicInfo = new ArrayList(); trackingPointsBasicInfo.Add(tpp); } vprtsChngMode(); //visualizePoints() doesn't work in playback mode visualizePoints(); trackingPointsLB.Items.Clear(); foreach (trackingPoint tp in trackingPoints) trackingPointsLB.Items.Add(tp.PName); app_status.SetStatus(_app_status.distance_calibrated); app_status.SetStatus(_app_status.points_defined); } else if (projectSettings.viewportXY1pxDistance!=-1 && projectSettings.viewportXZ1pxDistance!=-1 && projectSettings.viewportYZ1pxDistance!=-1) app_status.SetStatus(_app_status.distance_calibrated); this.Text="LW3d Motion Capture Utility : "+projectSettings.projectName; Message("New project loaded: "+loadProjectD.FileName); } else Message("New project aborted"); }
public trackingPoint(string name, trackingPoint tp, Color col) { this.pColor = tp.pColor; this.xyAnn = tp.xyAnn; this.xyCoordX=tp.xyCoordX; this.xyCoordY=tp.XyCoordY; this.xyRadius=tp.xyRadius; this.xyTrackPointImage=tp.xyTrackPointImage; this.xzAnn = tp.xzAnn; this.xzCoordX=tp.xzCoordX; this.xzCoordZ=tp.xzCoordZ; this.xzRadius=tp.xzRadius; this.xzTrackPointImage=tp.xzTrackPointImage; this.yzAnn = tp.yzAnn; this.yzCoordZ=tp.yzCoordZ; this.yzCoordY=tp.yzCoordY; this.yzRadius=tp.yzRadius; this.yzTrackPointImage=tp.yzTrackPointImage; this.calculateWorldCoords(); this.pColor=col; this.pName=name; }