Disclosure of Invention
The embodiment of the invention aims to provide a panoramic video self-adaptive illumination compensation method, and aims to solve the problems of poor image splicing effect and large calculated amount in the prior art.
The embodiment of the invention is realized in such a way that a panoramic video self-adaptive illumination compensation method comprises the following steps:
step J0: if the parameter par is judgedtIf the value is 1, the step J1 is carried out, otherwise, the step J3 is carried out;
step J1: computing
Is determined as statistic, including
Step J2: will be provided with
In descending order, is recorded as
The corresponding first, second and third distribution parameters are recorded as
The corresponding image is recorded as
Step J3: if (par)
t1 and
) Or (par)
t0 and par
t-1A global compensation mode is adopted during illumination compensation), and then the system enters the global compensation mode; otherwise, entering a local illumination compensation mode;
step J4: frame t image of N spliced code streams after illumination compensation
Carrying out conventional panoramic image splicing;
step J5: let t be t + 1;
step J6: if the code stream is spliced, ending; otherwise, re-enter step J0;
wherein,
a t frame image representing the nth spliced code stream;
to represent
The peak value parameter of (a);
respectively representing a first distribution parameter, a second distribution parameter and a third distribution parameter; par
tA judgment parameter representing the t-th frame panorama; par
t-1A judgment parameter representing the t-1 th frame panorama; thres
1Is the first decision threshold value for the first time,
another objective of an embodiment of the present invention is to provide a panoramic video adaptive illumination compensation system, which includes:
the parameter judgment module is used for judging whether the judgment parameter is 1 or not, entering the judgment statistic calculation device, and otherwise, entering the first judgment processing module;
the judgment parameter calculation method comprises the following steps:
wherein,
condition 1 represents that t is 1 or
For intra-predicted frames or (there is one)
) (ii) a Condition 2 represents
Is an intra-frame prediction block or at least comprises one intra-frame prediction sub-block; par
tA judgment parameter representing the t-th frame panorama;
representing the t frame image of the nth spliced code stream, wherein the initial value of t is 1;
representing an intermediate variable; n is the number of code streams of the spliced panoramic video; sum (variable | condition) represents summing the variables that satisfy the condition;
to represent
Line ii jj decoding block; the size of the block is 16x16(H264 standard), 64x64(HEVC), when the block is further divided, these smaller blocks are called sub-blocks; bkw and bkh respectively indicate the number of columns and the number of rows of a frame of image in units of blocks after the image is divided into blocks.
Judgment statistic calculation device, calculation
The judgment statistic of (1);
a peak parameter descending order module for aligning
The peak value parameters are arranged in a descending order, and the image peak value parameter sequence after the descending order is obtained, and the corresponding first distribution parameter sequence and the second distribution parameter sequenceThe distribution parameter sequence, the third distribution parameter sequence and the corresponding image sequence;
the method specifically comprises the following steps: will be provided with
In descending order, is recorded as
The corresponding first, second and third distribution parameters are recorded as
The corresponding image is recorded as
To represent
The peak value parameter of (a);
a t frame image representing the nth spliced code stream;
a first judgment processing module for judging if (par) is satisfied
t1 and
) Or (par)
t0 and par
t-1A global compensation mode is adopted during illumination compensation), and then the system enters a global illumination compensation device; otherwise, entering a local illumination compensation device; wherein par
t-1A judgment parameter representing the t-1 th frame panorama; thres
1Is a first decision threshold, Thres
1≤100;
Local illumination compensation means for judging if par
tWhen 1, then pair
Illumination compensation is carried out; otherwise, set up
Is composed of
The next frame of the code stream is spliced, and then the code stream is paired
Illumination compensation is carried out; wherein,
show that
The Nth image after descending order arrangement;
a t-1 frame image representing the nth spliced code stream;
the global illumination compensation device is used for carrying out global illumination compensation on the images corresponding to the N spliced code stream image peak value parameter sequences after the descending order arrangement;
the panoramic image splicing module is used for splicing t frame images of N spliced code streams after illumination compensation
Carrying out conventional panoramic image splicing;
a frame number setting module, configured to set t as t + 1;
and the second judgment processing module is used for judging that the code stream is spliced completely, ending the process, and otherwise, re-entering the parameter judgment module.
The invention has the advantages of
The method determines whether the illumination compensation parameters need to be recalculated or not through the code stream information so as to reduce the calculated amount of the multi-path code stream splicing. On the other hand, the method analyzes the brightness of the panoramic spliced image and determines the type needing illumination compensation; then, the identification degree of an object in the scene with insufficient illumination is improved by utilizing a global compensation mode; and solving the backlight defect image by using a local compensation mode, so that the spliced panoramic image has a virtual and natural light ray transition effect. Therefore, the advantages of panoramic video effect and calculated amount in applications such as monitoring and the like are improved.
Example one
FIG. 1 is a flow chart of a panoramic video adaptive illumination compensation method according to a preferred embodiment of the present invention; the method comprises the following steps:
step 0: if the judgment parameter is 1, then Step1 is entered, otherwise, Step3 is entered.
The judgment parameter calculation method comprises the following steps:
wherein,
condition 1 represents that t is 1 or
For intra-predicted frames or (there is one)
) (ii) a Condition 2 represents
Is an intra-frame prediction block or at least comprises one intra-frame prediction sub-block; par
tA judgment parameter representing the t-th frame panorama;
representing the t frame image of the nth spliced code stream, wherein the initial value of t is 1;
representing an intermediate variable; n is the number of code streams of the spliced panoramic video; sum (variable | condition) represents summing the variables that satisfy the condition;
to represent
Line ii jj decoding block; the size of the block is 16x16(H264 standard), 64x64(HEVC), when the block is further divided, these smaller blocks are called sub-blocks; bkw and bkh respectively indicate the number of columns and the number of rows of a frame of image in units of blocks after the image is divided into blocks.
Step 1: computing
N is more than or equal to 1 and less than or equal to N.
Step 11: computing
Wherein,
the luminance k distribution value of the t frame image of the nth spliced code stream is represented, k represents the luminance value, k is more than or equal to 0 and less than or equal to 255,
to represent
The luminance value of the ith row and jth column of pixels after decoding; width and height represent the length and width resolution of the image.
Step 12: calculating a set of splice statistics parameters comprising
Wherein,
to represent
The peak value parameter of (a); max (variable | condition) and min (variable | condition) respectively represent the maximum value and the minimum value of the variables satisfying the condition; arc max (variable | argument condition) represents the argument value corresponding to the maximum value of the variable, i.e., the argument value
Expression solution
Then the corresponding k value at this time is obtained, namely the expression
A value of (d);
respectively representing a first, a second and a third distribution parameter.
Step 2: will be provided with
In descending order, is recorded as
The corresponding first, second and third distribution parameters are recorded as
It corresponds toIs recorded as
To represent
The peak value parameter of (a);
a t frame image representing the nth spliced code stream;
step 3: if (par)
t1 and
) Or (par)
t0 and par
t-1A global compensation mode is adopted during illumination compensation), then a Step5 global compensation mode is entered; otherwise, entering Step4 local illumination compensation mode.
Wherein part-1A judgment parameter representing the t-1 th frame panorama; thres1For the first decision threshold, Thres may be generally taken1≤100。
FIG. 2 is a flow chart of a method of the local illumination compensation mode of FIG. 1;
step 4: if par
tWhen 1, then pair
Illumination compensation is carried out; otherwise, set up
Is composed of
The next frame of the code stream is spliced, and then the code stream is paired
And carrying out illumination compensation.
Wherein,
show that
The Nth image after descending order arrangement;
a t-1 frame image representing the nth spliced code stream;
step 40: obtaining
First and second reference images.
Wherein the first reference image is
The left stitched image and the second reference image are
And the right side is spliced with the image.
Case1 direct acquisition when the image capturing position is known
The first and second reference images of (1);
case 2: when the position relation of the spliced panoramic image sequence is unknown, the first reference image and the second reference image can be obtained by the following method.
If
par t1, then directly choose
The code stream corresponding to the first and second reference images is used as the next frame image
The first and second reference images of (1); otherwise, the first reference image is acquired by the following method:
step A1: computing
std (variable | condition) represents the mean square error of the variables satisfying the condition, and int represents the rounding operation.
To represent
The luminance value of the ith row and jth column of pixels after decoding;
representing the t frame image of the Nth spliced code stream, wherein the initial value of t is 1;
to represent
The luminance value of the ith row and the jth + width/2 column of pixels after decoding;
step A2:
expression solution
The minimum K value in the sequence is generally more than or equal to 1 and less than or equal to 5;
step A3: setting the image set corresponding to the minimum K values in the step A2 as an alternative set, and then using well-known image feature matching to the images in the alternative set to find out the final image
The first reference image of (1).
Acquiring a second reference image:
step (ii) ofB1: computing
Step B2:
expression solution
The minimum K value in the sequence is generally more than or equal to 1 and less than or equal to 5;
step B3: setting the image set corresponding to the minimum K values in the step B2 as an alternative set, and then using well-known image feature matching to the images in the alternative set to find out the final image
The second reference image of (1).
Step 41: calculating compensation parameters
refmaxMax (ref1_ y (i, j), ref2_ y | area condition 1)
Zone condition 1:
the region of the ref1_ y (i, j) ∈ right side 1/2 of the first reference image or the region of the ref2_ y (i, j) ∈ left side 1/2 of the second reference image;
ref1_ y (i, j) represents the luminance value of the ith row and jth column pixel of the first reference image;
ref2_ y (i, j) represents the luminance value of the ith row and jth column pixel of the second reference image;
refminmin (ref1_ y (i, j), ref2_ y | area condition 2);
zone condition 2:
the region of the right side 1/2 of the first reference image of ref1_ y (i, j) ∈ or the region of the left side 1/2 of the second reference image of ref2_ y (i, j) ∈
Wherein ref
max、ref
minIndicates the compensation parameters (
compensation parameter 1, compensation parameter 2); max (variable | Condition), min (variable | Condition)) Respectively representing the maximum and minimum values of variables meeting the conditions;
representing the brightness k distribution value of the Nth image;
the brightness k distribution value, max, of the t frame image representing the Nth spliced code stream
N、min
NIndicates the compensation parameters (compensation parameter 3, compensation parameter 4);
step 42: using compensation parameters, pair
The image is illumination compensated and then proceeds to Step 6.
FIG. 3 is a flow chart of a global illumination compensation pattern method of FIG. 1;
step 5: global illumination compensation mode.
Step 50: if par
tWhen equal to 0, set up
Is composed of
Splicing the next frame of the code stream; otherwise, go directly to Step 51.
Step 51: to pair
The image of (2) is first compensated for illumination.
Thres
2For the second determination of the threshold value, it is generally preferable
min (variable 1, variable 2) represents the minimum value between
variable 1 and variable 2;
stretching
Any linear or non-linear monotonically increasing function may be selected; compression
Any linear or non-linear monotonically increasing decreasing function may be selected.
Show that
After the peak parameters are arranged in a descending order, the nth peak parameter is obtained;
step 52: to pair
Illumination compensation is performed, and then Step6 is entered.
Case1 direct acquisition when the image capturing position is known
The first and second reference images of (1); then, the first and second reference images after illumination compensation are used for the image pair by using the method of Step41-Step42
Illumination compensation is performed, and then Step6 is entered.
Case 2: when the position relation of the spliced panoramic image sequence is unknown, the spliced panoramic image sequence without illumination compensation can be obtained by a method of Case2 in Step40
The first and second reference images of (1); then, the first and second reference images after illumination compensation are used for the image pair by using the method of Step41-Step42
Illumination compensation is performed, and then Step6 is entered.
Step 6: frame t image of N spliced code streams after illumination compensation
And carrying out conventional panoramic image stitching.
Step7:t=t+1。
Step 8: if the code stream is spliced, ending; otherwise, Step0 is re-entered.
Example two
FIG. 4 is a block diagram of a panoramic video adaptive illumination compensation system according to a preferred embodiment of the present invention; the system comprises:
the parameter judgment module is used for judging whether the judgment parameter is 1 or not, entering the judgment statistic calculation device, and otherwise, entering the first judgment processing module;
the judgment parameter calculation method comprises the following steps:
wherein,
condition 1 represents that t is 1 or
For intra-predicted frames or (there is one)
) (ii) a Condition 2 represents
For intra-frame prediction of blocks or at least packetsContaining an intra-frame prediction sub-block; par
tA judgment parameter representing the t-th frame panorama;
representing the t frame image of the nth spliced code stream, wherein the initial value of t is 1;
representing an intermediate variable; n is the number of code streams of the spliced panoramic video; sum (variable | condition) represents summing the variables that satisfy the condition;
to represent
Line ii jj decoding block; the size of the block is 16x16(H264 standard), 64x64(HEVC), when the block is further divided, these smaller blocks are called sub-blocks; bkw and bkh respectively indicate the number of columns and the number of rows of a frame of image in units of blocks after the image is divided into blocks.
Judgment statistic calculation device, calculation
N is more than or equal to 1 and less than or equal to N;
a peak parameter descending order module for aligning
The peak value parameters are arranged in a descending order, and an image peak value parameter sequence after the descending order, a first distribution parameter sequence, a second distribution parameter sequence, a third distribution parameter sequence and a corresponding image sequence are obtained;
the method specifically comprises the following steps: will be provided with
In descending order, is recorded as
The corresponding first, second and third distribution parameters are recorded as
The corresponding image is recorded as
To represent
The peak value parameter of (a);
a t frame image representing the nth spliced code stream;
a first judgment processing module for judging if (par) is satisfied
t1 and
) Or (par)
t0 and par
t-1A global compensation mode is adopted during illumination compensation), and then the system enters a global illumination compensation device; otherwise, entering the local illumination compensation device.
Wherein part-1A judgment parameter representing the t-1 th frame panorama; thres1For the first decision threshold, Thres may be generally taken1≤100。
Local illumination compensation means for judging if par
tWhen 1, then pair
Illumination compensation is carried out; otherwise, set up
Is composed of
The next frame of the code stream is spliced, and then the code stream is paired
Illumination compensation is carried out; wherein,
show that
The Nth image after descending order arrangement;
a t-1 frame image representing the nth spliced code stream;
the global illumination compensation device is used for carrying out global illumination compensation on the images corresponding to the N spliced code stream image peak value parameter sequences after the descending order arrangement;
the panoramic image splicing module is used for splicing t frame images of N spliced code streams after illumination compensation
And carrying out conventional panoramic image stitching.
A frame number setting module, configured to set t as t + 1;
and the second judgment processing module is used for judging that the code stream is spliced completely, ending the process, and otherwise, re-entering the parameter judgment module.
Further, the judgment statistic calculation means further includes:
an image brightness distribution value calculating module for calculating
Wherein,
the luminance k distribution value of the t frame image of the nth spliced code stream is represented, k represents the luminance value, k is more than or equal to 0 and less than or equal to 255,
to represent
The luminance value of the ith row and jth column of pixels after decoding; width and height represent the length and width resolution of the image.
The judgment statistic parameter set calculation module is used for calculating the splicing statistic parameter set;
wherein,
to represent
The peak value parameter of (a); max (variable | condition) and min (variable | condition) respectively represent the maximum value and the minimum value of the variables satisfying the condition; arc max (variable | argument condition) indicates that the variable is a maximum valueThe value of the time-dependent argument, i.e.
Expression solution
Then the corresponding k value at this time is obtained, namely the expression
A value of (d);
respectively representing a first, a second and a third distribution parameter.
FIG. 5 is a block diagram of the local illumination compensation apparatus of FIG. 4; further, the local illumination compensation apparatus further includes:
a local reference image acquisition module for acquiring
First and second reference images.
Wherein the first reference image is
The left stitched image and the second reference image are
And the right side is spliced with the image.
Case1 direct acquisition when the image capturing position is known
The first and second reference images of (1);
case 2: when the position relation of the spliced panoramic image sequence is unknown, the first reference image and the second reference image can be obtained by the following method.
If
par t1, then directly choose
The code stream corresponding to the first and second reference images is used as the next frame image
The first and second reference images of (1); otherwise, the first reference image is acquired by the following method:
acquiring a first reference image:
step A1: computing
std (variable | condition) represents the mean square error of the variables satisfying the condition, and int represents the rounding operation.
Wherein,
to represent
The luminance value of the ith row and jth column of pixels after decoding;
representing the t frame image of the Nth spliced code stream, wherein the initial value of t is 1;
to represent
The luminance value of the ith row and the jth + width/2 column of pixels after decoding;
step A2:
expression solution
The minimum K value in the sequence is generally more than or equal to 1 and less than or equal to 5;
step A3: setting the image set corresponding to the minimum K values in the step A2 as an alternative set, and then enabling the images in the alternative setFinding the final image by using known image characteristic matching
The first reference image of (1).
Acquiring a second reference image:
Step B2:
expression solution
The minimum K value in the sequence is generally more than or equal to 1 and less than or equal to 5;
step B3: setting the image set corresponding to the minimum K values in the step B2 as an alternative set, and then using well-known image feature matching to the images in the alternative set to find out the final image
The second reference image of (1).
The first compensation parameter calculation module is used for calculating a compensation parameter;
refmaxmax (ref1_ y (i, j), ref2_ y | area condition 1)
Zone condition 1:
the region of the ref1_ y (i, j) ∈ right side 1/2 of the first reference image or the region of the ref2_ y (i, j) ∈ left side 1/2 of the second reference image;
ref1_ y (i, j) represents the luminance value of the ith row and jth column pixel of the first reference image;
ref2_ y (i, j) represents the luminance value of the ith row and jth column pixel of the second reference image
refminMin (ref1_ y (i, j), ref2_ y | area condition 2)
Zone condition 2:
the region of the right side 1/2 of the first reference image of ref1_ y (i, j) ∈ or the region of the left side 1/2 of the second reference image of ref2_ y (i, j) ∈
Wherein ref
max、ref
minIndicates the compensation parameters (
compensation parameter 1, compensation parameter 2); max (variable | condition) and min (variable | condition) respectively represent the maximum value and the minimum value of the variables satisfying the condition;
representing the brightness k distribution value of the Nth image;
the brightness k distribution value, max, of the t frame image representing the Nth spliced code stream
N、min
NIndicates the compensation parameters (compensation parameter 3, compensation parameter 4);
a first illumination compensation module for using the compensation parameter
And performing illumination compensation on the image, and then entering a panoramic image splicing module. The method specifically comprises the following steps:
to represent
The luminance value of the ith row and jth column of pixels after decoding;
further, the global illumination compensation device is used for judging if par
tWhen equal to 0, set up
Is composed of
Splicing the next frame of the code stream; otherwise, directly pair
The image is subjected to illumination compensation in a first way and then is subjected to
Performing illumination compensation by a second mode; then entering a panoramic image splicing module;
the first mode is as follows:
Thres
2for the second determination of the threshold value, it is generally preferable
min (variable 1, variable 2) represents the minimum value between
variable 1 and variable 2;
stretching
Any linear or non-linear monotonically increasing function may be selected; compression
Any linear or non-linear monotonically increasing decreasing function may be selected.
Show that
After the peak parameters are arranged in a descending order, the nth peak parameter is obtained;
the second mode is as follows:
case1 direct acquisition when the image capturing position is known
The first and second reference images of (1); then, the first and second reference images after illumination compensation are used, and the first compensation parameter calculation module and the first illumination compensation module are used for matching
And performing illumination compensation, and then entering a panoramic image splicing module.
Case 2: when the position relation of the spliced panoramic image sequence is unknown, the spliced panoramic image sequence without illumination compensation can be firstly obtained by a method of Case2 in the local reference image obtaining module
The first and second reference images of (1); then, the first and second reference images after illumination compensation are used, and the first compensation parameter calculation module and the first illumination compensation module are used for matching
And performing illumination compensation, and then entering a panoramic image splicing module.
It will be understood by those skilled in the art that all or part of the steps in the method according to the above embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, such as ROM, RAM, magnetic disk, optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.