TWiki> F4K Web>FishBoundaryEncodingF4kDB (14 May 2011, Main.cspampin_40gmail_2ecom)EditAttach

-- 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.


Suppose that we want to encode the following image with the aforementioned algorithm.

Fish Mask

By scanning vertically the first column, the following binary sequence is achieved:


Then the integer value is obtained by converting the binary number in an integer:

010010102 = 7410

By iterating the process over the whole image, the final string image will be:


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:


with X in (-255,255).

Topic revision: r1 - 14 May 2011 - 08:18:42 - Main.cspampin_40gmail_2ecom
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
This Wiki uses Cookies