Hi Pedro,
Thank you, this is a nice question. The basic idea is that in every frame we get a list of objects and we would like to loop through this list and apply the BinaryRegionExtremes operator to each one of these objects.
We can do this using the SelectMany operator, like so:
Inside the SelectMany we can create a pipeline that specifies what to do for each list of objects that arrives from the pipeline, like so:

You can use the detection pipeline that best works for you. A couple of main points to notice here:
1) I am using SortBinaryRegions to ensure that the largest objects are always placed at the beginning of the list.
2) Each time a new frame is processed, SelectMany gets a new list and runs the workflow inside. We need to flatten this list to get at the individual elements using Concat.
3) After applying BinaryRegionExtremes to each element of the list, we turn the sequence into an array again. This is to ensure the output of SelectMany is an array of extremes that we can now manipulate further.
The final PythonTransform is some custom code I wrote to pick out the extremes in order:
import clr
clr.AddReference("OpenCV.Net")
from OpenCV.Net import *
from System import Tuple
nanpoint = Point2f(float.NaN,float.NaN)
@returns(Tuple[Point2f,Point2f,Point2f,Point2f])
def process(value):
if len(value) == 0:
return Tuple.Create(nanpoint,nanpoint,
nanpoint,nanpoint)
elif len(value) == 1:
return Tuple.Create(value[0].Item1,value[0].Item2,
nanpoint,nanpoint)
else:
return Tuple.Create(value[0].Item1,value[0].Item2,
value[1].Item1,value[1].Item2)
I'm also attaching an example workflow with these operations.
Hope this helps.