It's easy to cobble together socket code that can deal with a small amount of data, but massive images require more nuance. Even if you don't need the direct image access that BarcodeSink provides, you may be unable to use Cognex's Designer Script Console for this. In this post, we'll demonstrate BarcodeSink handling a single 300MB image and explain how it can handle it.
An advantage of BarcodeSink is that it makes it easy to add custom computer vision to a system using Cognex Dataman devices. This tutorial shows you how to send your images to Roboflow. If you've got an old Cognex device laying around or you want to update your computer vision software without changing out your facility's existing hardware, read on.
If you're using Matlab to connect to a remote device, like an Arduino or Cognex device, then you're probably using the TCP support of Matlab's Instrument Control Toolbox. Integrating Matlab with devices may be the first or only time you've written TCP code. This post will provide you with information on TCP and example Matlab code you can take and use—it's been tested on Matlab R2025a. After reading this, you'll be able to easily connect Matlab to devices over TCP sockets.