Skip to content

Commit

Permalink
Improved VideoAnnotation example.
Browse files Browse the repository at this point in the history
  • Loading branch information
hgmarques committed Jun 1, 2024
1 parent 3b44ae6 commit ae3b9ef
Show file tree
Hide file tree
Showing 4 changed files with 582 additions and 8 deletions.
2 changes: 2 additions & 0 deletions docs/articles/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
href: vision_camera_calibration.md
- name: ColumnwiseOperations
href: vision_columnwise_operations.md
- name: VideoAnnotation
href: vision/video_annotation.md
- name: Neuro Tasks
items:
- name: Neuro
Expand Down
9 changes: 9 additions & 0 deletions docs/articles/vision/video_annotation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Vision: Region Tracking RGB

## Workflow

:::workflow
![Example](~/workflows/examples.starter/Vision/RegionTrackingRGB/RegionTrackingRGB.bonsai)
:::

Testing text
Original file line number Diff line number Diff line change
@@ -1,12 +1,149 @@
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cv="clr-namespace:Bonsai.Vision;assembly=Bonsai.Vision"
xmlns:num="clr-namespace:Bonsai.Numerics;assembly=Bonsai.Numerics"
xmlns:p1="clr-namespace:Bonsai.Numerics.Distributions;assembly=Bonsai.Numerics"
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:wie="clr-namespace:Bonsai.Windows.Input;assembly=Bonsai.Windows.Input"
xmlns:cv="clr-namespace:Bonsai.Vision;assembly=Bonsai.Vision"
xmlns:drw="clr-namespace:Bonsai.Vision.Drawing;assembly=Bonsai.Vision"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
<Expression xsi:type="Combinator">
<Combinator xsi:type="num:CreateRandom">
<num:Seed xsi:nil="true" />
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:CreateContinuousUniform">
<p1:Lower>0</p1:Lower>
<p1:Upper>639</p1:Upper>
</Combinator>
</Expression>
<Expression xsi:type="rx:BehaviorSubject">
<Name>Random Distribution X</Name>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="num:CreateRandom">
<num:Seed xsi:nil="true" />
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:CreateContinuousUniform">
<p1:Lower>0</p1:Lower>
<p1:Upper>479</p1:Upper>
</Combinator>
</Expression>
<Expression xsi:type="rx:BehaviorSubject">
<Name>Random Distribution Y</Name>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="wie:KeyDown">
<wie:Filter>None</wie:Filter>
<wie:SuppressRepetitions>false</wie:SuppressRepetitions>
</Combinator>
</Expression>
<Expression xsi:type="GroupWorkflow">
<Name>Get Random Point</Name>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="GroupWorkflow">
<Name>Get X</Name>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>Random Distribution X</Name>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:WithLatestFrom" />
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>Item2</Selector>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:Sample" />
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="2" Label="Source1" />
<Edge From="1" To="2" Label="Source2" />
<Edge From="2" To="3" Label="Source1" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="PropertyMapping">
<PropertyMappings>
<Property Name="X" />
</PropertyMappings>
</Expression>
<Expression xsi:type="GroupWorkflow">
<Name>Get Y</Name>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>Random Distribution Y</Name>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:WithLatestFrom" />
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>Item2</Selector>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:Sample" />
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="2" Label="Source1" />
<Edge From="1" To="2" Label="Source2" />
<Edge From="2" To="3" Label="Source1" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="PropertyMapping">
<PropertyMappings>
<Property Name="Y" />
</PropertyMappings>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="cv:CreatePoint2f">
<cv:X>78.57643</cv:X>
<cv:Y>58.90158</cv:Y>
</Combinator>
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="0" To="3" Label="Source1" />
<Edge From="0" To="5" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
<Edge From="2" To="5" Label="Source2" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="4" To="5" Label="Source3" />
<Edge From="5" To="6" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="rx:BehaviorSubject">
<Name>Circle Position</Name>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="cv:CameraCapture">
<cv:Index>0</cv:Index>
Expand Down Expand Up @@ -65,11 +202,19 @@
<drw:Interpolation>Linear</drw:Interpolation>
</Combinator>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>Circle Position</Name>
</Expression>
<Expression xsi:type="PropertyMapping">
<PropertyMappings>
<Property Name="Center" />
</PropertyMappings>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="drw:Circle">
<drw:Center>
<drw:X>72</drw:X>
<drw:Y>288</drw:Y>
<drw:X>79</drw:X>
<drw:Y>59</drw:Y>
</drw:Center>
<drw:Radius>10</drw:Radius>
<drw:Color>
Expand All @@ -89,15 +234,23 @@
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="2" To="6" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
<Edge From="5" To="6" Label="Source2" />
<Edge From="6" To="9" Label="Source1" />
<Edge From="6" To="7" Label="Source1" />
<Edge From="7" To="8" Label="Source1" />
<Edge From="8" To="9" Label="Source2" />
<Edge From="9" To="10" Label="Source1" />
<Edge From="10" To="11" Label="Source1" />
<Edge From="11" To="15" Label="Source1" />
<Edge From="12" To="13" Label="Source1" />
<Edge From="13" To="14" Label="Source1" />
<Edge From="14" To="15" Label="Source2" />
<Edge From="15" To="18" Label="Source1" />
<Edge From="16" To="17" Label="Source1" />
<Edge From="17" To="18" Label="Source2" />
<Edge From="18" To="21" Label="Source1" />
<Edge From="19" To="20" Label="Source1" />
<Edge From="20" To="21" Label="Source2" />
<Edge From="21" To="22" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder>
Loading

0 comments on commit ae3b9ef

Please sign in to comment.