-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added jevois module generation for python
- Loading branch information
Showing
6 changed files
with
113 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
ui/src/main/resources/edu/wpi/grip/ui/codegeneration/python/PipelineJevoisRunner.vm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#set($enums = []) | ||
#set($lines = false) | ||
import libjevois as jevois | ||
import cv2 | ||
import numpy as np | ||
import $moduleName | ||
|
||
class GRIPRunner: | ||
|
||
def __init__(self): | ||
self.pipeline = $moduleName.$className() | ||
|
||
def process(self, inframe, outframe = None): | ||
# Execute the pipeline | ||
img = inframe.getCvBGR() | ||
self.pipeline.process(img) | ||
|
||
# stream to USB output if current mapping is setup for that | ||
if outframe is not None: | ||
#foreach($step in $pipeline.getSteps())#if($foreach.last)#foreach($output in $step.getOutputs()) | ||
#set($oName = $tMeth.pyName($output.name())) | ||
#if($oName.contains("contour") || $oName.contains("hull")) | ||
cv2.drawContours(img,self.pipeline.$tMeth.pyName($output.name()), -1, (0,255,0),2) | ||
#end#end#end#end | ||
outframe.sendCvBGR(img) | ||
|
||
# TODO: send contour report over USB | ||
# TODO: add parameter(s) to enable/disable individual values of the report over USB | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters