The easiest way to read images from files is to set up a virtual camera in the Virtual Camera ribbon of the Builder. You can select the images there. Then, pick your virtual camera from the drop-down list of the Camera Id input parameter of an Image Source tool.
All images passed between tools must be allocated by the platform. Therefore, you cannot directly return an image that is allocated by an OpenCV function. Otherwise the platform wouldn't be able to correctly deallocate it when it is no longer needed.
What you can do is to allocate a new output image using for example kuvio_image_alloc_copy and then copying the data from the image allocated by an OpenCV function call. If you place that image to the
out struct of your custom tool implementation, you get the picture out.