--
ConcettoUNICT - 14 May 2011
To save hard disk space the extracted fish masks have been encoded with an algorithm that converts pixels’ gray level values in integers.
The implemented algorithm consists of the following steps:
1. Vertically scans the pixels of the image and reads their value. 0 is assigned for a black pixel, whereas 1 is assigned for a white one.
2. By grouping the acquired values in sets of 8 pixels, an 8 bit number is formed.
3. The binary representation of these 8 pixels is then converted to an unsigned integer number (8 bits -> 0-255 range of values).
4. The integer number is written followed by a comma.
5. Repeat until the end of the image
6. Pad the remaining pixels (<7) with zeros
7. Insert the image string in the database.
Example:
Suppose that we want to encode the following image with the aforementioned algorithm.
By scanning vertically the first column, the following binary sequence is achieved:
01001010
Then the integer value is obtained by converting the binary number in an integer:
01001010
2 = 74
10
By iterating the process over the whole image, the final string image will be:
74,36,1,16,164,1,72,9
Note: Because of a bug in the first version of the coding functions the first number in the database should be ignored when parsing images.
So, the example’s image string will be found in the database as:
X,74,36,1,16,164,1,72,9
with X in (-255,255).
Topic revision: r1 - 14 May 2011 - 08:18:42 - Main.cspampin_40gmail_2ecom