@@ -485,9 +485,27 @@ class BoundingBoxOutput(BaseInvocationOutput):
485
485
class BoundingBoxCollectionOutput (BaseInvocationOutput ):
486
486
"""Base class for nodes that output a collection of bounding boxes"""
487
487
488
- collection : list [BoundingBoxField ] = OutputField (
489
- description = "The output bounding boxes." ,
490
- )
488
+ collection : list [BoundingBoxField ] = OutputField (description = "The output bounding boxes." , title = "Bounding Boxes" )
489
+
490
+
491
+ @invocation (
492
+ "bounding_box" ,
493
+ title = "Bounding Box" ,
494
+ tags = ["primitives" , "segmentation" , "collection" , "bounding box" ],
495
+ category = "primitives" ,
496
+ version = "1.0.0" ,
497
+ )
498
+ class BoundingBoxInvocation (BaseInvocation ):
499
+ """Create a bounding box manually by supplying box coordinates"""
500
+
501
+ x_min : int = InputField (default = 0 , description = "x-coordinate of the bounding box's top left vertex" , title = "X1" )
502
+ y_min : int = InputField (default = 0 , description = "y-coordinate of the bounding box's top left vertex" , title = "Y1" )
503
+ x_max : int = InputField (default = 0 , description = "x-coordinate of the bounding box's bottom right vertex" , title = "X2" )
504
+ y_max : int = InputField (default = 0 , description = "y-coordinate of the bounding box's bottom right vertex" , title = "Y2" )
505
+
506
+ def invoke (self , context : InvocationContext ) -> BoundingBoxOutput :
507
+ bounding_box = BoundingBoxField (x_min = self .x_min , y_min = self .y_min , x_max = self .x_max , y_max = self .y_max )
508
+ return BoundingBoxOutput (bounding_box = bounding_box )
491
509
492
510
493
511
# endregion
0 commit comments