def setUp(self): self.model = model.Model() fileModel = model.File("", self.model) self.stream = self.model.streams.addFile(fileModel) self.stromxStream = self.stream.stromxStream self.factory = stromx.runtime.Factory() stromx.register('libstromx_cvsupport.so.0.8.0', self.factory)
def setUp(self): # set up an operator factory factory = runtime.Factory() register("libstromx_runtime.so", factory) register("libstromx_cvsupport.so", factory) register("libstromx_test.so", factory) # get the operator kernels counterKernel = factory.newOperator('runtime', 'Counter') dumpKernel = factory.newOperator('runtime', 'Dump') deadlockKernel = factory.newOperator('test', 'DeadlockOperator') # create the stream operator stream = runtime.Stream() stream.setDelay(100) counter = stream.addOperator(counterKernel) deadlock = stream.addOperator(deadlockKernel) dump = stream.addOperator(dumpKernel) stream.initializeOperator(counter) stream.initializeOperator(deadlock) stream.initializeOperator(dump) # obtain write access in deadlock operator deadlock.setParameter(5, runtime.Bool(True)) stream.connect(counter, 0, deadlock, 0) stream.connect(deadlock, 1, dump, 0) thread = stream.addThread() thread.addInput(deadlock, 0) thread.addInput(dump, 0) self.stream = stream self.deadlock = deadlock
# you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # from stromx import register, runtime factory = runtime.Factory() register("libstromx_runtime.so", factory) stream = runtime.XmlReader().readStream("file.xml", factory) stream.start() timer = stream.operators()[1] for i in range(5): data = timer.getOutputData(1) count = runtime.ReadAccess(data) with runtime.ReadAccess(data) as count: print("Received {0}".format(count.get().get())) timer.clearOutputData(1)
# you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # from stromx import register, runtime, cvsupport factory = runtime.Factory() register("libstromx_runtime.so", factory) register("libstromx_cvsupport.so", factory) stream = runtime.XmlReader().readStream("camera.xml", factory) stream.start() camera = stream.operators()[0] convertPixelType = stream.operators()[2] for i in range(5): with convertPixelType.getOutputData(0) as data, runtime.ReadAccess(data) as image: print "Received image {0}x{1}, {2}".format( image.get().width(), image.get().height(), image.get().variant().title())
print "Failed to repackage {0}: {1}".format(filePath, e) parser = argparse.ArgumentParser() parser.add_argument('directory', type=str, nargs=1) parser.add_argument('--packages', metavar='NAME', nargs='+', default=[], help='extra packages basename, e.g. cvimgproc') group = parser.add_mutually_exclusive_group(required = True) group.add_argument('--extract', action='store_true') group.add_argument('--compress', action='store_true') group.add_argument('--repackage', action='store_true') args = parser.parse_args() if args.repackage: factory = stromx.runtime.Factory() stromx.register("libstromx_cvsupport.so", factory) stromx.register("libstromx_runtime.so", factory) stromx.register("libstromx_test.so", factory) for name in args.packages: stromx.register("libstromx_{0}.so".format(name), factory) for root, dirs, files in os.walk(args.directory[0]): if args.compress: for d in dirs: if re.match(r".+\.(zip|stromx).extracted", d): compressArchive(d, root) else: for f in files: if re.match(r".+\.(zip|stromx)", f): if args.extract: extractArchive(f, root)
# you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # from stromx import register, runtime, cvsupport factory = runtime.Factory() register("libstromx_runtime.so", factory) register("libstromx_cvsupport.so", factory) stream = runtime.XmlReader().readStream("camera.xml", factory) stream.start() camera = stream.operators()[0] convertPixelType = stream.operators()[2] for i in range(5): with convertPixelType.getOutputData(2) as data, runtime.ReadAccess( data) as image: print("Received image {0}x{1}, {2}".format( image.get().width(), image.get().height(),
dataStr = str(runtime.ReadAccess(newData).get().get()) threadName = "main" if thread: threadName = thread.name() print "{0}: {1} {2} of Operator '{3}/{4}' was set to: {5}".format( threadName, connector.type(), connector.id(), connector.op().info().package(), connector.op().info().type(), dataStr) factory = runtime.Factory() register("libstromx_runtime.so", factory) stream = runtime.XmlReader().readStream("file.xml", factory) source = stream.operators()[0] timer = stream.operators()[1] observer = MyObserver() source.addObserver(observer) timer.addObserver(observer) stream.start() for i in range(5): data = timer.getOutputData(0) timer.clearOutputData(0)
parser.add_argument('directory', type=str, nargs=1) parser.add_argument('--packages', metavar='NAME', nargs='+', default=[], help='extra packages basename, e.g. cvimgproc') group = parser.add_mutually_exclusive_group(required=True) group.add_argument('--extract', action='store_true') group.add_argument('--compress', action='store_true') group.add_argument('--repackage', action='store_true') args = parser.parse_args() if args.repackage: factory = stromx.runtime.Factory() stromx.register("libstromx_cvsupport.so", factory) stromx.register("libstromx_runtime.so", factory) stromx.register("libstromx_test.so", factory) for name in args.packages: stromx.register("libstromx_{0}.so".format(name), factory) for root, dirs, files in os.walk(args.directory[0]): if args.compress: for d in dirs: if re.match(r".+\.(zip|stromx).extracted", d): compressArchive(d, root) else: for f in files: if re.match(r".+\.(zip|stromx)", f): if args.extract: extractArchive(f, root)