4 import matplotlib.pylab
12 img_array = numpy.random.uniform(0., 255., (240, 320)).astype(numpy.float32)
15 yarp_image = yarp.ImageFloat()
16 yarp_image.setExternal(img_array, img_array.shape[1], img_array.shape[0])
22 output_port = yarp.Port()
23 output_port.open(
"/python-image-port")
24 yarp.Network.connect(
"/python-image-port",
"/view01")
25 output_port.write(yarp_image)
33 input_port = yarp.Port()
34 input_port.open(
"/python-image-port")
35 yarp.Network.connect(
"/icubSim/cam",
"/python-image-port")
38 img_array = numpy.zeros((240, 320, 3), dtype=numpy.uint8)
39 yarp_image = yarp.ImageRgb()
40 yarp_image.resize(320, 240)
41 yarp_image.setExternal(img_array, img_array.shape[1], img_array.shape[0])
47 input_port.read(yarp_image)
50 matplotlib.pylab.imshow(img_array)
57 """Object that reads an image from a port, transforms it and sends the result to another port.
59 The object reads RGB images and sends monochrome ones with calculated sobel filter.
60 Note: this class uses the alternative implementation of setExternal together with numpy array interface.
63 def __init__(self, input_port_name, output_port_name):
77 self.
_input_buf_array_input_buf_array = numpy.zeros((240, 320, 3), dtype = numpy.uint8)
82 self.
_output_buf_array_output_buf_array = numpy.zeros((240, 320), dtype = numpy.float32)
108 if __name__==
"__main__":
116 assert yarp.Network.connect(
"/sobel:out",
"/view01")
117 assert yarp.Network.connect(
"/icubSim/cam",
"/sobel:in")
121 image_filter.cleanup()
def __init__(self, input_port_name, output_port_name)
bool read(yarp::os::Searchable &cfgtotal, pc104Data &pc104data)
bool write(const std::string filename, const FullRegulation ®)