- Set up a ROS node on your robot that gathers the images from your camera in whichever manner you desire.
- Create a publisher for that node, publishing messages containing the images on your chosen topic name. I'd recommend sensor_msgs/Image or sensor_msgs/CompressedImage for simplicity of extraction later.
- Start the node publishing to make testing things easier later.
- Create a function that does the desired image processing. Make it accept the ROS message as input, and you can use readImage to extract the image from the message.
- Code up a rossubscriber to that topic.
- Make the image processing function the callback for the subscriber.
- If you started the ROS master outside of MATLAB, connect to it with rosinit.
- Run your subscriber code.
- Specify the correct network connection settings for connecting to the ROS network.
- Add a Subscribe block to your model, setting the properties appropriately to handle the correct topic and message type.
- Connect the output to your desired image processing functionality.
- (Optional) If you only want to call your image processing functionality when you receive a new message (likely), then put it all in a Triggered Subsystem, setting the IsNew output of the Subscribe block to be the trigger.
- Run the model.