
 
In Case 1, and in order to detect the letterbox top 
bar (its presence and width), the algorithm starts by 
scanning each frame line, from the top to the bottom 
of the frame, applying conditions (1) and (2) to each 
pixel to verify if it corresponds to a black pixel; if 
line i is the first one for which those conditions are 
not verified, the top horizontal bar width is set to i-1. 
To detect a horizontal bar on the bottom of the 
frame, the procedure is repeated but carrying out the 
scanning from the bottom to the top of the frame. To 
detect the bars due to the pillarbox effect, a similar 
procedure is applied along the horizontal direction of 
the frame. 
For Case 2, consider Fig. 4 where the typical 
positioning of subtitles and logos is represented. To 
detect the letterbox top bar, the algorithm starts by 
scanning each image line (from top to bottom, as in 
Case 1), but considering only the pixels situated 
between the limits j
min
=0.25×Width and 
j
max
=0.75×Width, where Width  is the horizontal 
resolution, in pixels, of the video. This strategy 
reduces the inclusion of pixels from logos. 
Conditions (1) and (2) are applied to each pixel 
along the scan line. Let F
b
 be the fraction of pixels, 
along the current picture line, that verifies those 
conditions. The line in question is considered has a 
potential black bar line if F
b 
 F
T
, where F
T
 is a user 
defined threshold (by default, F
T
 = 0.8). With this 
criterion, lines of the image where a certain fraction 
of pixels is not black due to the existence of subtitles 
on the black margins (which will be confirmed by 
the procedure described in section 3.3), can still be 
considered as belonging to a black border. 
When a set of N
c 
consecutive lines (by default 
N
c
=20), does not check the condition  
F
b 
  F
T
, it is considered that the limits of the bar 
have been overpassed; the width of the bar will be 
given by the i  coordinate of the last line that has 
verified the condition F
b 
 F
T
. 
To detect a horizontal bar on the frame bottom, 
the procedure is repeated but carrying out the 
scanning from bottom to top. To detect the bars due 
to the pillarbox effect, a similar procedure is applied 
along the horizontal direction, but with the 
controlling parameters set to N
c
 = 1 and F
T
 = 0, since 
no text is expected over those bars; i
min
 and i
max 
are 
respectively set (by default) to 0.25×Heigth and 
0.75× Height, where Height is the number of lines 
per frame. 
In both cases 1 and 2, and to minimize false 
detections, it is required that the resulting aspect 
ratio should be present in a minimum number, N
F,
 of 
consecutive frames, before accepting it as valid. By 
default, N
F
 = 125 (5 seconds of video for a frame 
rate of 25 Hz).  
3.3  Logo and Subtitles Detection 
This section describes the procedure for detecting 
logos and hard subtitles that may exist over the 
pillarbox and letterbox black bars. The distinction 
between logos and subtitles detection can be done by 
its spatial location, as the subtitles are typically 
centered on the bottom or on the top of the frame, 
occupying the space of one or two lines of text, and 
logos tend to be located in the corners of the frame, 
as depicted in Fig. 4. Accordingly, logos are 
searched for on the part of the bars area situated 
between the frame limits and 1/10 of the height (for 
vertical bars) and 1/10 of the width (for horizontal 
bars) of the frame; subtitles (their vertical limits) are 
searched for in the area of the letterbox bars 
comprised between j
min
 and j
max
.  
      For  subtitles  detection each line within the 
search area is scanned on the horizontal, from 
bottom to top, searching for non-black rows of 
pixels. The vertical limits (signalized by the red lines 
in Fig. 5) of the subtitles are considered to be the 
position of the first and last non-black rows found. 
The procedure is repeated on the horizontal 
direction, scanning along the image columns inside 
the searching area, in order to find the lateral limits 
of the subtitles (signalized by the yellow lines in Fig. 
5). Note that if a subtitle text line intercepts the 
active image area boundary, only three subtitle 
limits will be found (Fig. 6). Logo detection is 
carried out with a similar procedure but with the 
scan first performed along the image columns, 
within the logo searching area, and in order to 
determine the lateral limits of it (signalized by the 
green lines in Fig. 5). If the search zone contains 
only a part of the logo (case in which just one of the 
limits will be found), the search proceeds outside the 
initial search area, column by column, until the 
second limit is found. In order to find the vertical 
limit (signalized by the orange line in Fig. 5), the 
process is repeated on the perpendicular direction. 
 
 
 
Figure 5: Logo (green and orange lines) and subtitle (red 
and yellow lines) limits.   
SIGMAP2014-InternationalConferenceonSignalProcessingandMultimediaApplications
284