## 2 Materials and Methods
### Data Processing: Identification Procedure
#### 2.3.3 Common Carp ROIs  
For carp identification, we used three different ROIs (Figure 6). ROI1 covers the body of the fish from the side (only the scales). The top-left corner is 30% of the fish's length (FL) from the left border and 18% of the fish's height (FH) from the top border (see Figure 4).  
Figure 4: Identification scheme. (**Left images**), fish detected in the original image (black and white mask) what is the output of the of fish detection procedure; (**Right images**), ROI (ROI(LL) for seabass (bottom image) and ROI1 for carp (upper image) localized in the fish bounding box by the defined percentage of fish width and height.  
Figure 5: Different seabass ROIs that were used for identification.  
The right-bottom corner is 58% of the FL from the left border and 52% of the FH from the top border. ROI2 refers to the same part of the body but longer and wider. The top-left corner is 27% of the fish's length (FL) from the left border and 23% of the fish's height (FH) from the top border. The right-bottom corner is 60% of the FL from the left border and 62% of the FH from the top border. ROI3 is the operculum part of the carp. The top-left corner is 12% of the fish's length (FL) from the left border and 43% of the fish's height (FH) from the top border. The right-bottom corner is 20% of the FL from the left border and 61% of the FH from the top border.  
All the ROIs were converted to feature vectors using the histogram of oriented gradients (HOG) descriptor [32], which offered the best accuracy in our previous experiments ([PERSON], 2021). In general, the descriptor codes the edges in the image. All ROIs were transformed into rectangles of different sizes (64 \(\times\) 64, 128 \(\times\) 128, 64 \(\times\) 128, and 128 \(\times\) 64) to facilitate efficient calculation of the HOG and achieve image-scale compensation. The best results were achieved with a size of 64 \(\times\) 64 pixels for all combinations, except ROI2 for carp when using the 01 * 02 combination, where the size was 64 \(\times\) 128. Two different settings of HOG were tested (cell sizes of two and four). The best results were achieved with a cell size of two for the majority of combinations, but some of them provided better accuracy with a cell size of four. The ROIs for carp data were as follows: ROI1, combinations 01 * 03 and 01 * 04; and ROI2, combinations 01 * 04, 03 * 04. Due to possible errors in localizing the ROIs on the fish body, the scanning approach was used to find the best match for the two ROI subsets. Only the subset of ROI without a border area was used for similarity measurements. Different sizes of borders (10, 16, 20, and 30 pixels) were tested. The best results were achieved with a border size of 10 pixels. The similarity between the two ROIs was measured using the similarity of the HOG features. HOG1 was calculated from the subset of the first ROI1 (reference fish). The subset was ROI1 without the borders of size, Offx and Offy (see Figure 7).  
HOG2 was calculated from a subset of ROI2 (unknown fish). This subset is defined by window scanning over ROI2. The similarity between HOG1 and all HOG2 feature vectors was calculated as the Euclidean length of the difference between the two HOG vectors. The minimal value of the similarity was then used along with the similarity between ROI1 and ROI2.  
Figure 6: Position of ROIs for carp identification.