Skip to content
This repository was archived by the owner on Jun 29, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
</StackPanel>
</StackPanel>
</StackPanel>
<ComboBox x:Name="comboBox_webcamSelector" SelectionChanged="WebcamComboBox_SelectionChanged" HorizontalAlignment="Left" Margin="32,490,0,0" VerticalAlignment="Top" Width="310" Height="24"/>
</Grid>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ void OnResponseReceivedHandler(object sender, SpeechResponseEventArgs e)
{
this.fullText += e.PhraseResponse.Results[i].DisplayText + " ";
userInput.Text = fullText;
/* userInput.Text = e.PhraseResponse.Results[i].DisplayText;
this.fullText += " " + userInput.Text;*/
/* userInput.Text = e.PhraseResponse.Results[i].DisplayText;
this.fullText += " " + userInput.Text;*/
pingPong = 0;
}));
}
Expand Down Expand Up @@ -564,7 +564,7 @@ private void UpdateUIWithFaces(Face[] faces, double widthRatio, double heightRat
//FaceMarker fm = new FaceMarker(age, face.Attributes.Gender);

FaceMarker fm = new FaceMarker(face as NamedFace);

fm.Height = Math.Round(face.FaceRectangle.Height / heightRatio);
fm.Width = Math.Round(face.FaceRectangle.Width / widthRatio);
canvas.Children.Add(fm);
Expand All @@ -573,11 +573,11 @@ private void UpdateUIWithFaces(Face[] faces, double widthRatio, double heightRat
Canvas.SetTop(fm, Math.Round(face.FaceRectangle.Top / heightRatio));
Canvas.SetLeft(fm, Math.Round(face.FaceRectangle.Left / widthRatio));

/* HumanIdentification identification = new HumanIdentification();
identification.Age = face.Attributes.Age.ToString() + " years old";
identification.Id = face.Attributes.Gender;
identification.HairlineColor = brushList[index++];
Ids.Children.Add(identification);*/
/* HumanIdentification identification = new HumanIdentification();
identification.Age = face.Attributes.Age.ToString() + " years old";
identification.Id = face.Attributes.Gender;
identification.HairlineColor = brushList[index++];
Ids.Children.Add(identification);*/
}
}
}
Expand Down Expand Up @@ -664,14 +664,14 @@ private void btnPrint_Click(object sender, RoutedEventArgs e)


PrintDialog printDialog = new PrintDialog();

// Set image and adjust to new size
layout.ImageToPrint.Source = OutputImage.Source;

// Add face markers
if (RecognizedFaces != null && RecognizedFaces.Length > 0)
{

int index = 0;
foreach (var face in RecognizedFaces)
{
Expand All @@ -694,7 +694,7 @@ private void btnPrint_Click(object sender, RoutedEventArgs e)

TransformGroup transGroup = new TransformGroup();
layout.CardToPrint.LayoutTransform = transGroup;

System.Printing.PrintCapabilities capabilities = printDialog.PrintQueue.GetPrintCapabilities(printDialog.PrintTicket);
transGroup.Children.Add(new ScaleTransform(capabilities.PageImageableArea.ExtentWidth / layout.CardToPrint.Width,
capabilities.PageImageableArea.ExtentHeight / layout.CardToPrint.Height));
Expand Down Expand Up @@ -722,14 +722,16 @@ private void Window_Loaded(object sender, RoutedEventArgs e)

if (this.MediaDeviceList.Count > 0)
{
this.SelectedVideoDevice = this.MediaDeviceList[this.MediaDeviceList.Count - 1];
//bind the combobox to the list
comboBox_webcamSelector.ItemsSource = this.MediaDeviceList;
comboBox_webcamSelector.DisplayMemberPath = "DisplayName";
comboBox_webcamSelector.SelectedItem = this.MediaDeviceList[this.MediaDeviceList.Count - 1];
}
else
{
this.SelectedVideoDevice = null;
}

CameraVideoDeviceControl.VideoSourceId = SelectedVideoDevice.UsbId;
}


Expand Down Expand Up @@ -796,5 +798,18 @@ public IList<MediaInformation> MediaDeviceList
this.mediaDeviceList = value;
}
}


/// <summary>
/// Set the video device in the webcam control to whichever device is selected in the dropdown
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void WebcamComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var cb = sender as ComboBox;
this.SelectedVideoDevice = cb.SelectedItem as MediaInformation;
CameraVideoDeviceControl.VideoSourceId = SelectedVideoDevice.UsbId;
}
}
}