A computer-implemented method for unidirectional transfer of data from a sender device to a receiver device, wherein the sender device comprises or is connected to a display and the receiver device comprises or is connected to an image sensor, comprising: at the sender: - accessing data to be transmitted to the receiver device; - encoding respective parts of the data to generate respective 2D barcodes; - sequentially displaying the 2D barcodes on the display; at the receiver device: - using the image sensor, capturing the sequentially displayed 2D barcodes to obtain a series of captured images, and in each or a subset of the series of captured images: - detecting a position of a respective 2D barcode in the captured image; - scanning the 2D barcode at the identified position to obtain barcode data; - decoding the barcode data to, together with the barcode data obtained from other captured images, obtain a received version of the transmitted data, characterized by the method further comprising, at the sender device, generating a respective 2D barcode using a mask pattern (320, 410), and at the receiver device, decoding respective barcode data based on the mask pattern, wherein the mask pattern is a spatiotemporal mask pattern which is different for consecutive pairs of the sequentially displayed 2D barcodes. at the sender: - accessing data to be transmitted to the receiver device; - encoding respective parts of the data to generate respective 2D barcodes; - sequentially displaying the 2D barcodes on the display; - accessing data to be transmitted to the receiver device; - encoding respective parts of the data to generate respective 2D barcodes; - sequentially displaying the 2D barcodes on the display; at the receiver device: - using the image sensor, capturing the sequentially displayed 2D barcodes to obtain a series of captured images, and in each or a subset of the series of captured images: - detecting a position of a respective 2D barcode in the captured image; - scanning the 2D barcode at the identified position to obtain barcode data; - decoding the barcode data to, together with the barcode data obtained from other captured images, obtain a received version of the transmitted data, - using the image sensor, capturing the sequentially displayed 2D barcodes to obtain a series of captured images, and in each or a subset of the series of captured images: - detecting a position of a respective 2D barcode in the captured image; - scanning the 2D barcode at the identified position to obtain barcode data; - decoding the barcode data to, together with the barcode data obtained from other captured images, obtain a received version of the transmitted data, - detecting a position of a respective 2D barcode in the captured image; - scanning the 2D barcode at the identified position to obtain barcode data; - decoding the barcode data to, together with the barcode data obtained from other captured images, obtain a received version of the transmitted data, characterized by the method further comprising, at the sender device, generating a respective 2D barcode using a mask pattern (320, 410), and at the receiver device, decoding respective barcode data based on the mask pattern, wherein the mask pattern is a spatiotemporal mask pattern which is different for consecutive pairs of the sequentially displayed 2D barcodes.