Skip to content

Commit

Permalink
BUGFIX: When calibrated, origin was mirrored.
Browse files Browse the repository at this point in the history
  • Loading branch information
avosskuehler committed Oct 21, 2021
1 parent b17b5bb commit a77b309
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VianaNET/Data/VideoData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ private static Point CalibrateSample(DataSample value)
}

Point origin = App.Project.CalibrationData.OriginInPixel;
Point calibratedPoint = new Point(value.PixelX - origin.X, origin.Y - value.PixelY);
Point calibratedPoint = new Point(value.PixelX - origin.X, value.PixelY - origin.Y);

calibratedPoint.X = calibratedPoint.X * App.Project.CalibrationData.ScalePixelToUnit;
calibratedPoint.Y = calibratedPoint.Y * App.Project.CalibrationData.ScalePixelToUnit;
Expand Down
2 changes: 1 addition & 1 deletion VianaNET/Modules/Video/Dialogs/CalibrateVideoWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected override void ContainerMouseLeftButtonDown(object sender, MouseButtonE

if (!this.originIsSet)
{
App.Project.CalibrationData.OriginInPixel = new Point(originalX, originalY);
App.Project.CalibrationData.OriginInPixel = new Point(originalX, Video.Control.Video.Instance.VideoElement.NaturalVideoHeight - originalY);
this.originIsSet = true;
this.originPath.Visibility = Visibility.Visible;
Canvas.SetLeft(this.originPath, scaledX - this.originPath.ActualWidth / 2);
Expand Down
2 changes: 1 addition & 1 deletion VianaNET/Modules/Video/VideoWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ private void PlaceCalibration()
if (this.GetScales(out double scaleX, out double scaleY))
{
Canvas.SetLeft(this.OriginPath, App.Project.CalibrationData.OriginInPixel.X * scaleX - this.OriginPath.ActualWidth / 2);
Canvas.SetTop(this.OriginPath, App.Project.CalibrationData.OriginInPixel.Y * scaleY - this.OriginPath.ActualHeight / 2);
Canvas.SetTop(this.OriginPath, (Video.Instance.VideoElement.NaturalVideoHeight - App.Project.CalibrationData.OriginInPixel.Y) * scaleY - this.OriginPath.ActualHeight / 2);
this.RulerLine.X1 = App.Project.CalibrationData.RulerStartPointInPixel.X * scaleX;
this.RulerLine.Y1 = App.Project.CalibrationData.RulerStartPointInPixel.Y * scaleY;
this.RulerLine.X2 = App.Project.CalibrationData.RulerEndPointInPixel.X * scaleX;
Expand Down

0 comments on commit a77b309

Please sign in to comment.