Trophy Card Generator

Manipulation

Numerous websites have produced custom trophy cards, with varying levels of automation. In this article, the resulting trophy card is not intended to outdo the competition or even provide a customizable trophy card for users (apologies), although I will include code and ideas used to generate my own trophy card. Using information from the official Sony trophy cards for Playstation 3, and a template created featuring some awesome Playstation 3 titles, a short Matlab program extracts the information from the official card, inserts it into the custom template, and produces a custom trophy card. Of course, this does require user involvement for each update, but that's a seperate issue. The official Sony trophy card looks a bit like this:

Sony Trophy Card

Matlab has a simple command, imread, which organizes the image as a matrix. For a simple greyscale image, the vertical and horizontal image axes are simply interpreted as rows and columns of the matrix. A further dimension can be added to allow RGB (red, green, blue) images. For example, the trophy card above has dimensions 550x125 in pixels, leading to a matrix structure in Matlab with dimensions 125x550x3. Though the more testing part of this exercise is to create a template that you are happy with, the focus here is the transfer of numerical data from the official trophy card to the customized one. This is relatively easy in this case, since the numbers in the official card remain in fixed locations. Since the custom card has an identical layout where the numbers are required, it is simply a case of grabbing the relevant pixels from a particular area and inserting them in the new picture.

A more advanced version of this would be desirable, with a basic text reader a longer-term project focus, but there is stil scope for a little bit more flexibility in this situation. By locating the appropriate pixels (for example, the platinum trophies in the official card lie between 428 and 451 pixels horizontally, 26 and 37 pixels vertically) those elements of the matrix can be manipulated slightly. For example, noting that the grey level of the numbers is somewhat darker than the surrounding area, a simple loop can search each of the pixels, detecting each one that is below a particular grey level (a key threshold value). Once these matrix elements are found, they can be altered. In this custom trophy card, the numbers relating to a particular trophy type are colour coded. To do this, once the appropriate pixels are found, the red, green and blue values can be altered to any chosen colour.

MeteorStorm Trophy Card

The example code for the platinum box, including the colour change applied to the number (in this case blue), follows:

% Read in the images

A = imread('trophy_template.jpg');

B = imread('trophy_input.png');

% Platinum

A(15:26,439:450,1:3) = B(26:37,428:439,1:3);

for i = 15:26

for j=439:450

if A(i,j,3) < 172

A(i,j,1) = A(i,j,1) - 30;

A(i,j,2) = A(i,j,2) - 15;

A(i,j,3) = A(i,j,3) + 50;

end

end

end

Does it look more professional? Well, no, but it's my unprofessional mess, not an official one, and it was a fun warm-up test for image processing with Matlab.

MeteorStorm Random Quote Picker

QuoterQuoter

Commander Shepard

You'd better not stab me in the back, Grunt.

Grunt

I would never stab you in the back, Shepard. Military like you and me? Straight to the face.

Grunt

Kidding. Kidding!