Skip to content

Commit

Permalink
BUGFIX: Rotation gave wrong coordinates.
Browse files Browse the repository at this point in the history
IMPROVED: Pixel values starting left bottom corner with (0,0) instead of default (0,0) in the top left corner, gives us synchronized x-y view even without calibration.
IMPROVED: Installer with desktop icon.
BUGFIX: Installer let some orphan files in the system.
BUGFIX: Save dialog with correct filename.
BUGFIX: Reload of project missed multiple objects in the chart window.
IMPROVED: Manual Data Acquisition available in video capture mode.
IMPROVED: Updated of video frame during timeline slider drag.
  • Loading branch information
avosskuehler committed Oct 21, 2021
1 parent 23c10c5 commit b17b5bb
Show file tree
Hide file tree
Showing 16 changed files with 185 additions and 68 deletions.
6 changes: 3 additions & 3 deletions Setup/Setup/Config.wxi
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
<?define SupportPhone = "[email protected]"?>
<?define InstallDescription = "Video analysis for science education."?>
<?define UpgradeGuid = "{4830D7E5-685D-4637-B1BD-9A347BB911CF}"?>
<?define ProductVersion="6.0.0" ?>
<?define ProductVersion="6.1.0" ?>

<?if $(var.Platform) = x64 ?>
<?define ProductName = "Viana.NET 6.0" ?>
<?define ProductName = "Viana.NET 6.1" ?>
<?define Win64 = "yes" ?>
<?define PlatformName = "x64"?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?else ?>
<?define ProductName = "Viana.NET 6.0" ?>
<?define ProductName = "Viana.NET 6.1" ?>
<?define Win64 = "no" ?>
<?define PlatformName = "x86"?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
Expand Down
2 changes: 1 addition & 1 deletion Setup/Setup/Libs.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
Source="$(var.VianaNET.TargetDir)" />
</Component>

<Component Id="C_System.Buffers" Guid="" Win64="$(var.Win64)">
<Component Id="C_System.Buffers" Guid="{63A5EAE8-4A52-4C70-9514-C865EEC6DFFC}" Win64="$(var.Win64)">
<File Id="System.Buffers" Name="System.Buffers.dll" KeyPath="yes" Assembly=".net" AssemblyManifest="System.Buffers" AssemblyApplication="System.Buffers" DiskId="1"
Source="$(var.VianaNET.TargetDir)" />
</Component>
Expand Down
90 changes: 76 additions & 14 deletions Setup/Setup/Viana.wxs
Original file line number Diff line number Diff line change
@@ -1,17 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include $(sys.CURRENTDIR)Config.wxi?>

<Fragment>

<Directory Id="TARGETDIR" Name="SourceDir">

<Directory Id="DesktopFolder" SourceName="Desktop">
<!--<Component Id="C_ShortCutDesktop" Guid="{D8DFF141-B56E-41C8-8A41-3E967B1494E2}" Transitive="yes" Win64="$(var.Win64)">
<Shortcut Id="ShortCutDesktop" Name="$(var.ProductName)" Description="$(var.ProductName) Verknüpfung" Target="[INSTALLLOCATION]VianaNET.exe"></Shortcut>
</Component>-->
<?if $(sys.BUILDARCH)=x64?>
<Directory Id="ProgramFilesFolder"/>
<?endif?>
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="INSTALLLOCATION" Name="$(var.ProductName)">
</Directory>
</Directory>

<Directory Id="DesktopFolder" SourceName="Desktop" />
<!--<Directory Id="DesktopFolder" SourceName="User's Desktop">
<Component Id="C_ShortCutDesktop" Guid="{B57FB044-6F44-46CF-BE54-5FC3F64B00DD}" Transitive="yes" Win64="$(var.Win64)">
<Shortcut Id="ShortCutDesktop" Name="VianaNET" Description="Startet Viana.NET" Icon="VianaNET.ico" IconIndex="0" Show="normal" WorkingDirectory="TARGETDIR" Advertise="yes" />
</Component>
</Directory>-->

<Directory Id="ProgramMenuFolder" SourceName="User's Programs Menu">
<Directory Id="VianaNET" Name="$(var.ProductName)">
<Component Id="C_ShortCutComponent" Guid="{F6B81D14-B701-4529-AD3D-EB7228AA08AD}" Transitive="yes" Win64="$(var.Win64)">
<Shortcut Id="ShortCutDesktop" Name="VianaNET" Directory="DesktopFolder" Description="Startet Viana.NET" Icon="VianaNET.ico" IconIndex="0" Show="normal" Target="[INSTALLLOCATION]VianaNET.exe" />
<Shortcut Id="ProgShortCut" Name="$(var.ProductName)" Description="$(var.ProductName) Verknüpfung" Target="[INSTALLLOCATION]VianaNET.exe" Icon="VianaNET.ico"></Shortcut>
<CreateFolder Directory="VianaNET" />
<RegistryValue Id="R_Software" Root="HKCU" Key="Software\$(var.Manufactor)\$(var.ProductName)" Name="VianaNET" Value="[VianaNET]" Type="string" KeyPath="yes" />
<RemoveFolder Id="Remove" Directory="VianaNET" On="uninstall" />
</Component>
</Directory>
</Directory>
</Directory>

<DirectoryRef Id="INSTALLLOCATION">
<Component Id="C_VianaNET.Exe" DiskId="1" Guid="{832E2327-ED4A-4A1B-A4D1-51A86BA070EA}" Win64="$(var.Win64)">
<File Id="VianaNET.Exe" Name="VianaNET.Exe" Source="$(var.VianaNET.TargetDir)" KeyPath="yes"/>
<ProgId Id="VianaNET" Description="Viana.NET xml-Projektdatei." Icon="VianaNET.ico" IconIndex="0" Advertise="yes">
<Extension Id="via" Advertise="yes">
<Verb Id="open" Command="&amp;Open" Argument="&quot;%1&quot;" Sequence="1" />
</Extension>
</ProgId>
<!--<Shortcut Id="ShortCutDesktop" Directory="DesktopFolder" Name="VianaNET" Description="Startet Viana.NET" Icon="VianaNET.ico" IconIndex="0" Show="normal" WorkingDirectory="TARGETDIR" Advertise="yes" />
<Shortcut Id="ShortCutProgramMenu" Directory="ProgramMenuFolder\VianaNET" Name="VianaNET" Description="Startet Viana.NET" Icon="VianaNET.ico" IconIndex="0" Show="normal" WorkingDirectory="TARGETDIR" Advertise="yes" />
<?if $(sys.BUILDARCH)=x64?>
<Shortcut Id="UninstallShortCut" Directory="ProgramMenuFolder\VianaNET" Name="Uninstall $(var.ProductName)" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]"/>
<?else?>
<Shortcut Id="UninstallShortCut" Directory="ProgramMenuFolder\VianaNET" Name="Uninstall $(var.ProductName)" Target="[SystemFolder]msiexec.exe" Arguments="/x [ProductCode]"/>
<?endif?>-->
</Component>
<Component Id="C_VianaNET.EXE.CONFIG" DiskId="1" Guid="{D6EDFDFB-DF47-40D2-904F-EDA93E680C44}" Win64="$(var.Win64)">
<File Id="VianaNET.EXE.CONFIG" Name="VianaNET.exe.config" Source="$(var.VianaNET.TargetDir)" />
</Component>
<Component Id="C_License" Guid="{50737152-D57F-4100-8055-2746E405BF1A}" Win64="$(var.Win64)">
<File Id="License" Name="License.rtf" KeyPath="yes" DiskId="1"
Source="$(var.SolutionDir)Setup\Setup\" />
</Component>
</DirectoryRef>

<!--<Directory Id="TARGETDIR" Name="SourceDir">-->

<!--<Directory Id="DesktopFolder" SourceName="Desktop">-->
<!--<Component Id="C_ShortCutDesktop" Guid="{D8DFF141-B56E-41C8-8A41-3E967B1494E2}" Transitive="yes" Win64="$(var.Win64)">
<Shortcut Id="ShortCutDesktop" Name="$(var.ProductName)" Description="$(var.ProductName) Verknüpfung" Target="[INSTALLLOCATION]VianaNET.exe"></Shortcut>
</Component>-->
<!--</Directory>-->

<!--<Directory Id="ProgramMenuFolder" SourceName="User's Programs Menu">
<Directory Id="VianaNET" Name="$(var.ProductName)">
<Component Id="C_ShortCutMenu" Guid="{BA432F39-4E9D-4DFC-B535-455249EAA452}" Transitive="yes" Win64="$(var.Win64)">
<Shortcut Id="ProgShortCut" Name="$(var.ProductName)" Description="$(var.ProductName) Verknüpfung" Target="[INSTALLLOCATION]VianaNET.exe"></Shortcut>
Expand All @@ -21,13 +76,13 @@
<Shortcut Id="UninstallShortCut" Name="Uninstall $(var.ProductName)" Target="[SystemFolder]msiexec.exe" Arguments="/x [ProductCode]"/>
<?endif?>
<CreateFolder Directory="VianaNET" />
<RegistryValue Id="R_Software" Root="HKCU" Key="Software\$(var.Manufactor)\$(var.ProductName)\{BA432F39-4E9D-4DFC-B535-455249EAA452}" Name="VianaNET" Value="[VianaNET]" Type="string" KeyPath="yes" />
<RegistryValue Id="R_Software" Root="HKCU" Key="Software\$(var.Manufactor)\$(var.ProductName)" Name="VianaNET" Value="[VianaNET]" Type="string" KeyPath="yes" />
<RemoveFolder Id="Remove" Directory="VianaNET" On="uninstall" />
</Component>
</Directory>
</Directory>
</Directory>-->

<Directory Id="$(var.PlatformProgramFilesFolder)">
<!--<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="INSTALLLOCATION" Name="$(var.ProductName)">
<Component Id="C_VianaNETExe" Guid="{1246AC67-0A60-4224-8C33-8A4868FD3957}" Win64="$(var.Win64)">
<File Id="VianaNETExe" Name="VianaNET.exe" KeyPath="yes" Assembly=".net" AssemblyManifest="VianaNETExe" AssemblyApplication="VianaNETExe" DiskId="1"
Expand All @@ -37,24 +92,31 @@
<Verb Id="open" Command="&amp;Open" Argument="&quot;%1&quot;" Sequence="1" />
</Extension>
</ProgId>
<!--<Shortcut Id="_A07C5294E7E24F4CB7D6F426AE6326AB" Directory="DesktopFolder" Name="VianaNET" Description="Startet Viana.NET" Icon="VianaNET.ico" IconIndex="0" Show="normal" WorkingDirectory="TARGETDIR" Advertise="yes" />-->
-->
<!--<Shortcut Id="_A07C5294E7E24F4CB7D6F426AE6326AB" Directory="DesktopFolder" Name="VianaNET" Description="Startet Viana.NET" Icon="VianaNET.ico" IconIndex="0" Show="normal" WorkingDirectory="TARGETDIR" Advertise="yes" />-->
<!--
<Shortcut Id="_A2BF88A82C6947B294A261A87EBACFC4" Directory="VianaNET" Name="VianaNET" Description="Startet Viana.NET" Icon="VianaNET.ico" IconIndex="0" Show="normal" WorkingDirectory="TARGETDIR" Advertise="yes" />
</Component>
<Component Id="C_VianaNETConfig" Guid="{A5DCF465-A9B5-4B96-341F-66BC43F8B985}" Win64="$(var.Win64)">
<File Id="VianaNETConfig" Name="VianaNET.exe.config" KeyPath="yes" DiskId="1"
Source="$(var.VianaNET.TargetDir)" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>-->
<!--</Directory>-->

<Icon Id="VianaNET.ico" SourceFile="$(var.SolutionDir)VianaNET\Images\VianaNET.ico" />

<Feature Id='VianaMainApplicationFeature' Title='Viana.Net application' Description='Installs viana.net core components.' Level='1'>
<ComponentRef Id='C_VianaNETExe' />
<!--<ComponentRef Id="C_ShortCutDesktop" />-->
<ComponentRef Id='C_License' />
<ComponentRef Id='C_ShortCutComponent' />
<!--<ComponentRef Id='C_ShortCutDesktop' />-->
<ComponentRef Id='C_VianaNET.Exe' />
<ComponentRef Id="C_VianaNET.EXE.CONFIG" />
<!--<ComponentRef Id='C_VianaNETExe' />
<ComponentRef Id="C_ShortCutDesktop" />
<ComponentRef Id="C_ShortCutMenu" />
<ComponentRef Id="C_VianaNETConfig" />
<ComponentRef Id="C_VianaNETConfig" />-->
</Feature>
</Fragment>
</Wix>
15 changes: 15 additions & 0 deletions VianaNET/CustomStyles/Types/TrackObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace VianaNET.CustomStyles.Types
{
public class TrackObject
{
public TrackObject(int index, string name)
{
this.Name = name;
this.Index = index;
}

public string Name { get; private set; }

public int Index { get; private set; }
}
}
6 changes: 5 additions & 1 deletion VianaNET/Data/ProcessingData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,11 @@ public bool ProcessImage()

if (Video.Instance.IsDataAcquisitionRunning)
{
App.Project.VideoData.AddPoint(i, this.CurrentBlobCenter[i]);
if (this.CurrentBlobCenter[i].HasValue)
{
var flippedPoint = new Point(this.CurrentBlobCenter[i].Value.X, Video.Instance.VideoElement.NaturalVideoHeight - this.CurrentBlobCenter[i].Value.Y);
App.Project.VideoData.AddPoint(i, flippedPoint);
}
}
}

Expand Down
13 changes: 11 additions & 2 deletions VianaNET/MainWindow/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,12 @@ private void NewProjectOnClick(object sender, RoutedEventArgs e)
{
if (!string.IsNullOrEmpty(App.Project.ProjectFilename))
{
string description = VianaNET.Localization.Labels.AskSaveProjectDialogDescription;
description = description.Replace("%1", Path.GetFileName(App.Project.ProjectFilename));

VianaDialog dlg = new VianaDialog(
VianaNET.Localization.Labels.AskSaveProjectDialogTitle,
VianaNET.Localization.Labels.AskSaveProjectDialogDescription,
description,
VianaNET.Localization.Labels.AskSaveProjectDialogMessage,
false);
if (dlg.ShowDialog().GetValueOrDefault(false))
Expand Down Expand Up @@ -732,6 +735,7 @@ private void SelectNumberOfObjectsButtonClick(object sender, RoutedEventArgs e)

// Update button image source
this.CreateImageSourceForNumberOfObjects();
this.ResetColorButton();
}

/// <summary>
Expand Down Expand Up @@ -777,6 +781,9 @@ private void CalibrateVideoButtonClick(object sender, RoutedEventArgs e)
/// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
private void RotateVideoButtonClick(object sender, RoutedEventArgs e)
{
App.Project.CalibrationData.Reset();
App.Project.VideoData.Reset();
this.VideoWindow.BlobsControl.ResetBlobsControl();
if (Video.Instance.VideoElement.Rotation.HasValue)
{
switch (Video.Instance.VideoElement.Rotation.Value)
Expand Down Expand Up @@ -1011,6 +1018,7 @@ private void ModifyDataButtonClick(object sender, RoutedEventArgs e)
ModifyDataWindow modifyDataWindow = new ModifyDataWindow();
modifyDataWindow.ShowDialog();
App.Project.VideoData.RefreshDistanceVelocityAcceleration();
this.VideoWindow.BlobsControl.UpdateDataPoints();
}

/// <summary>
Expand Down Expand Up @@ -1104,8 +1112,9 @@ private void UpdateColorButton()
float bandwidth = 26f / count;
for (int i = 0; i < count; i++)
{
Color color = App.Project.ProcessingData.TargetColor.Count > i ? App.Project.ProcessingData.TargetColor[i] : Colors.Black;
drawingContext.DrawRectangle(
new SolidColorBrush(App.Project.ProcessingData.TargetColor[i]),
new SolidColorBrush(color),
null,
new Rect(3 + i * bandwidth, 3, bandwidth, 27));
}
Expand Down
4 changes: 2 additions & 2 deletions VianaNET/Modules/Chart/ChartWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
<ComboBox
Name="ObjectSelectionCombo"
Grid.Column="1"
Text="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=SelectedItem}"
ItemsSource="{Binding Path=ProcessingData.IndexOfObject, Source={x:Static local:App.Project}}"
ItemsSource="{Binding Path=ObjectDescriptions}"
DisplayMemberPath="Name"
SelectionChanged="ObjectSelectionComboSelectionChanged" />
</Grid>
<TabControl Name="ChartContentTab">
Expand Down
35 changes: 19 additions & 16 deletions VianaNET/Modules/Chart/ChartWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace VianaNET.Modules.Chart
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
Expand Down Expand Up @@ -68,9 +69,9 @@ public partial class ChartWindow
public static readonly DependencyProperty ObjectDescriptionsProperty =
DependencyProperty.Register(
"ObjectDescriptions",
typeof(List<string>),
typeof(ObservableCollection<TrackObject>),
typeof(ChartWindow),
new FrameworkPropertyMetadata(new List<string>(), OnPropertyChanged));
new FrameworkPropertyMetadata(new ObservableCollection<TrackObject>(), OnPropertyChanged));



Expand Down Expand Up @@ -183,9 +184,9 @@ public ChartWindow()
/// <summary>
/// Gets or sets the index of the currently tracked object
/// </summary>
public List<string> ObjectDescriptions
public ObservableCollection<TrackObject> ObjectDescriptions
{
get => (List<string>)this.GetValue(ObjectDescriptionsProperty);
get => (ObservableCollection<TrackObject>)this.GetValue(ObjectDescriptionsProperty);

set => this.SetValue(ObjectDescriptionsProperty, value);
}
Expand Down Expand Up @@ -594,8 +595,8 @@ private void ObjectSelectionComboSelectionChanged(object sender, SelectionChange
return;
}

string entry = (string)this.ObjectSelectionCombo.SelectedItem;
App.Project.ProcessingData.IndexOfObject = int.Parse(entry.Substring(entry.Length - 1, 1)) - 1;
TrackObject entry = (TrackObject)this.ObjectSelectionCombo.SelectedItem;
App.Project.ProcessingData.IndexOfObject = entry.Index;
}

/// <summary>
Expand Down Expand Up @@ -1062,14 +1063,16 @@ private void PopulateObjectCombo()

for (int i = 0; i < App.Project.ProcessingData.NumberOfTrackedObjects; i++)
{
this.ObjectDescriptions.Add(VianaNET.Localization.Labels.DataGridObjectPrefix + " " + (i + 1).ToString(CultureInfo.InvariantCulture));
this.ObjectDescriptions.Add(new TrackObject(i, VianaNET.Localization.Labels.DataGridObjectPrefix + " " + (i + 1).ToString(CultureInfo.InvariantCulture)));
}

this.ObjectSelectionCombo.SelectedIndex = 0;

// this.ObjectSelectionCombo.ItemsSource = null;
this.ObjectSelectionCombo.ItemsSource = this.ObjectDescriptions;
Binding indexBinding = new Binding("ProcessingData.IndexOfObject") { Source = App.Project };
this.ObjectSelectionCombo.SetBinding(Selector.SelectedIndexProperty, indexBinding);
App.Project.ProcessingData.IndexOfObject++;
//this.ObjectSelectionCombo.ItemsSource = this.ObjectDescriptions;
//Binding indexBinding = new Binding("ProcessingData.IndexOfObject") { Source = App.Project };
//this.ObjectSelectionCombo.SetBinding(Selector.SelectedIndexProperty, indexBinding);
//App.Project.ProcessingData.IndexOfObject++;
}

/// <summary>
Expand All @@ -1083,13 +1086,13 @@ private void PopulateObjectCombo()
/// </param>
private void ProcessingDataPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "NumberOfTrackedObjects")
{
this.PopulateObjectCombo();
}
if (!Project.IsDeserializing)
{
if (e.PropertyName == "NumberOfTrackedObjects")
{
this.PopulateObjectCombo();
}
else if (e.PropertyName == "IndexOfObject")
if (e.PropertyName == "IndexOfObject")
{
this.Refresh();
}
Expand Down
Loading

0 comments on commit b17b5bb

Please sign in to comment.