1. A computerized method of generating a readable two-dimensional code encoding a message based on an input image, the two-dimensional code including function patterns and cells, the method comprising: calculating the function patterns; and calculating decoded values for the cells based on at least the encoded message, such that an appearance of a portion of the cells complies with a visual similarity criterion when compared with respective areas of the input image associated with the portion of the cells.