Summary of the invention
In order to solve the problems of the technologies described above, the object of the invention is: the image processing method of realizing low energy consumption, high compression rate and reliable in quality in a kind of wireless multimedia sensor network is provided.
The technical solution adopted in the present invention is: the image processing method in a kind of wireless multimedia sensor network, includes following steps:
A, read at least two historical frames;
B, determine the single goal region-of-interest of above-mentioned historical frames;
C, according to the single goal region-of-interest of the single goal region-of-interest prediction present frame of above-mentioned historical frames;
D, single goal region-of-interest based on present frame are encoded to present frame.
Further, described step B comprises following sub-step:
B1, above-mentioned historical frames is carried out to binary conversion treatment;
B2, determine the connection target area of the historical frames after binary conversion treatment;
B3, determine single goal region-of-interest according to above-mentioned connection target area.
Further, described step C is specially:
Calculate the movement tendency of single goal region-of-interest according to the single goal region-of-interest of above-mentioned historical frames, and according to the single goal region-of-interest of movement tendency prediction present frame.
Further, described step D comprises following sub-step:
D1, present frame is divided into the image block of 8*8;
D2, image block is carried out to dct transform;
D3, above-mentioned result is carried out to quantization and Zigzag sequence successively;
D4, to the above results through generating the image after compression after entropy coding.
Further, in described sub-step D2, the single goal region-of-interest to present frame in the time of dct transform arranges cutting coefficient, retains upper left corner low frequency DCT coefficient, part beyond the single goal region-of-interest of present frame is carried out to cutting to AC coefficient, by the AC coefficient part zero setting of DCT coefficient.
Further, described dct transform is specially based on foursquare method of cutting out.
Further, described dct transform is specially based on leg-of-mutton method of cutting out.
The invention has the beneficial effects as follows: the present invention is by predicting the scope of the region-of-interest of present frame to the processing of historical frames picture, and then according to region-of-interest, image is carried out to compressed encoding, not only keep lower energy consumption, greatly improve compressibility simultaneously, guaranteed reliable image reconstruction quality, especially made it to be applied to the wireless multimedia sensor network all receiving restriction aspect energy, calculating and storage.
Embodiment
Below in conjunction with accompanying drawing, the specific embodiment of the present invention is described further:
With reference to Fig. 1, the image processing method in a kind of wireless multimedia sensor network, includes following steps:
A, read at least two historical frames;
B, determine the single goal region-of-interest of above-mentioned historical frames;
C, according to the single goal region-of-interest of the single goal region-of-interest prediction present frame of above-mentioned historical frames;
D, single goal region-of-interest based on present frame are encoded to present frame.
The present invention is directed to the scene of environmental catastrophe, predict the scope of region-of-interest with the historical frames picture of having processed.Its embodiment is: first, to select two two field pictures that close in the image library of processed mistake, they are carried out to binary conversion treatment.Then, use the connected component labeling algorithm based on Run-Length Coding, calculate the area of bianry image connected region.Then according to connected region size, determine the scope of single goal region-of-interest.Then, infer the region-of-interest scope of present frame by the two frame single goal region-of-interests of determining.Finally use the improved JPEG method based on region-of-interest coding to carry out compressed encoding.
Be further used as preferred embodiment, described step B comprises following sub-step:
B1, above-mentioned historical frames is carried out to binary conversion treatment;
In embodiment, adopt the test pattern under the scene of parking lot, in the image library of processed mistake, find out two two field pictures that close on present frame of having processed, for example current need are to be processed is 0130 frame, from historical frames, extract 0128 frame and 0129 frame, here we are that 0129 frame calls historical frames 1 the previous frame of present frame, and the frame second from the bottom of processing is called to historical frames 2.For the ease of calculating connected region and the area thereof of region-of-interest in historical frames image, here adopt binary conversion treatment, historical frames 1 after variation is detected and the region-of-interest assignment of historical frames 2 are " 1 ", be " 0 " background area assignment, so to historical frames 2(0128 frame) and historical frames 1(0129 frame) image after binaryzation is respectively as shown in Fig. 3 and Fig. 2, remove beyond indivedual noise spots, body portion mainly concentrates on position, lower right, and vehicle body is moving to upper left side, although displacement is little, but still can find out movement tendency from Fig. 3 and Fig. 2 contrast.
B2, determine the connection target area of the historical frames after binary conversion treatment;
To having carried out the historical frames of binary conversion treatment, use the connected component labeling algorithm based on Run-Length Coding, calculate the area of bianry image connected region.In run length encoding method, using the distance of swimming as handling object, by the distance of swimming connected region obtaining that represents to line by line scan.General Run-Length Coding adopts three kinds of elements (starting coordinate, terminal point coordinate, run length) to represent.Need between run-length data structure and target volume data structure, transmit identification number herein, therefore identification number is added in run-length data structure as an element, and record current scanning row value, to record the extreme value of ordinate, so define new run-length data structure
rLE (code, start, end, length, Y).
Bianry image 4 connections refer to current pixel point
(x, y)centered by, it is around up and down
(x, y-1), (x, y+1), (x-1, y), (x+1, y)four adjacent pixels have identical value, 8 be communicated with refer to its around up and down and two diagonal line
(x, y-1), (x, y+1), (x-1, y), (x+1, y), (x-1, y-1), (x-1, y+1), (x+1, y-1), (x+1, y+1)8 pixels there is identical value.And 4 or 8 connections of the distance of swimming refer to that at least comprising a pixel energy in the current distance of swimming has 4 or 8 relations that are communicated with the pixel in the another one distance of swimming.In Fig. 4,5, represent background parts with white grid, black box represents distance of swimming part.Fig. 4 and Fig. 5 represent respectively the distance of swimming 4 connected sum 8 connected relations so.
Be provided with the distance of swimming
rLE1, RLE2, 4 connections and 8 are communicated with judgment rules respectively suc as formula shown in (1) and formula (2).
(
RLE1.start≥
RLE2.end)∪(
RLE1.end≤
B.start) (1)
(
RLE1.start≥
RLE2.end+1)∪(
RLE1.end≤
RLE2.start-1) (2)
This embodiment will adopt the mode of 8 connections to discuss.
The area of bianry image connected region is number of pixels sum in connected region, therefore, and definition
t (root, area, x_min, x_max, y_min, y_max)for target volume data structure, wherein
rootrepresent the radical sign code of this connected region, in algorithm, can need continuous correction according to this value of actual conditions,
arearepresent this connected region size, the number of pixels being communicated with,
x_min, x_max, y_min, y_maxbe respectively minimum value and the maximal value of horizontal ordinate and ordinate, for determining the border of connected region.The algorithm steps of determining connected region area is as follows:
Step 1: initialization.Set up run-length data structure chained list and target volume data structure chained list, be initialized as sky.
Step 2: image is lined by line scan, often scan a distance of swimming
rLEabe filled in run-length data structure chained list, then carry out the connectivity analysis of the distance of swimming according to connective rule formula (2) and lastrow data, the situation that at this moment may occur has following three kinds, as shown in Fig. 6-8, its middle twill identified areas represents the current distance of swimming monitoring, and black region represents respectively the independent connected component having detected, is kept in the chained list of target volume data structure.
1) do not have be communicated with rider section
With reference to Fig. 6, the connective schematic diagram a of the distance of swimming and upstream data, does not have and the distance of swimming
rLEathe distance of swimming being connected, thinks that this distance of swimming is an emerging objective body, sets up a new node in target volume data structure chained list
ti, will
rLEain identification number
codevalue passes to
tiin
root, to propagate radical sign code in the time of next line inspection and this row connectedness.Will
tiin
areavalue is defined as
rLEain
length, now size is the number of pixels in the distance of swimming,
x_min, x_maxcorresponding respectively
rLEain
start, end.Now
y_min, y_maxassignment is simultaneously
y.
2) be communicated with a rider section
With reference to Fig. 7, the connective schematic diagram b of the distance of swimming and upstream data, illustrates the distance of swimming
rLEabe a part for some objective bodies, suppose that the distance of swimming structure being communicated with is with it
rLEb.At this moment basis
rLEbin
codevalue is found corresponding with it target volume data structure, finds
rootvalue is
codenode
ti, will
rLEain relevant information add to
tiin, more new node
tiin each several part numerical value, and will
rootvalue passes to
rLEain
code.
3) be communicated with multiple rider sections
With reference to Fig. 8, the connective schematic diagram c of the distance of swimming and upstream data, when
rLEafind multiple rider structures that are communicated with it
rLEc1, RLEc2 ... RLEcntime, at this moment travel through all rider structures
rLEc1, RLEc2 ... RLEcn, determine minimum identification number
code_min, will
code_minpass to
rLEa's
code, basis simultaneously
rLEc1, RLEc2 ... RLEcnin
code, find out corresponding target volume data structure, by it
rootvalue all changes into
code_min.
Step 3: merge target volume data structure, will
rootall nodes that value equates merge.
B3, determine single goal region-of-interest according to above-mentioned connection target area.
Merging behind connection target area, in target volume data structure chained list, search
areabe worth maximum target information structure
t (root, area, x_min, x_max, y_min, y_max), according to
rootvalue can be determined connected region part, according to
areadetermine connected region number of pixels, and according to
x_min, x_max, y_min and y_maxdetermine the coordinate extreme value of this connected region, so determined single goal region-of-interest is just included in the definite rectangle of these four extreme values.Fig. 9 and Figure 10 are respectively after the connected component labeling algorithm using based on Run-Length Coding, and historical frames 1 and historical frames 2 select maximal value to be communicated with the result after area.Like this, the noise spot in bianry image will be removed, and retain body portion as single goal region-of-interest.
Be further used as preferred embodiment, described step C is specially:
Calculate the movement tendency of single goal region-of-interest according to the single goal region-of-interest of above-mentioned historical frames, and according to the single goal region-of-interest of movement tendency prediction present frame.
Can be determined respectively the target information structure of historical frames 1 and historical frames 2 by above method, determine single goal region-of-interest, suppose historical frames 2(0128 frame) four coordinate extreme values be
x_min2, x_max2, y_min2, y_max2, suppose historical frames 1(0129 frame) four coordinate extreme values be
x_min1, x_max1, y_min1, y_max1, calculate the difference of corresponding coordinate extreme value, select and differ maximum
xcoordinate and
ycoordinate, as predictor.
x_min=x_min1-x_min2, x_max=x_max1-x_max2, y_min=y_min1-y_min2, y_max=y_max1-y_max2,if
| x_min|>|x_max|,so
x=x_min, otherwise x=x_max.in like manner, if
| y_min|>|y_max|,so
y=y_min,otherwise
y=y_max.wherein
x, ybe respectively the predictor of x coordinate and y coordinate.
By the object construction information of historical frames 1, its four coordinate extreme values are determined
x_min1, x_max1, y_min1, y_max1, determined the predictor of x coordinate and y coordinate by the coordinate extreme value of historical frames 1 and historical frames 2
xwith
y, add that by the object construction information of historical frames 1 corresponding predictor can draw the region-of-interest scope of prediction,
pre_x_min=x_min1+x, pre_x_max=x_max1+x, pre_y_min=y_min1+y, pre_y_max=y_max1+y.
So the single goal region-of-interest bianry image of the present frame (0130 frame) being gone out by historical frames 0128 frame and 0129 frame coordinate prediction of extremum as shown in figure 11, the border up and down of Figure 11 region-of-interest is by historical frames 1 and the common decision of predictor.
With reference to Figure 12, be further used as preferred embodiment, described step D comprises following sub-step:
D1, present frame is divided into the image block of 8*8;
D2, image block is carried out to dct transform;
D3, above-mentioned result is carried out to quantization and Zigzag sequence successively;
D4, to the above results through generating the image after compression after entropy coding.
Be further used as preferred embodiment, in described sub-step D2, single goal region-of-interest to present frame in the time of dct transform arranges cutting coefficient, retain upper left corner low frequency DCT coefficient, to the part beyond the single goal region-of-interest of present frame to AC(Alternating Current) coefficient carries out cutting, by the AC coefficient part zero setting of DCT coefficient.In the each 8*8 image block of background area part, only retain DC(direct current) coefficient.So to the DCT coefficient cropping, can omit quantization and Zigzag sequence part, can directly carry out entropy coding, therefore can omit step D3 to the processing of background parts.
Be further used as preferred embodiment, described dct transform is specially based on foursquare method of cutting out.
After dct transform, energy signal is at DCT territory skewness, and DC coefficient and some medium and low frequency AC coefficients occupy most signal energy.Therefore, the AC coefficient of many high frequencies can abandon, and can not bring too much information dropout.Utilize this characteristic, can reduce the energy consumption of the basic operation in each stage in compression process, thereby reduce to greatest extent the energy consumption of each node.
S-DCT is the improvement algorithm of having introduced cutting DCT coefficient in the dct transform of JPEG, is a kind of based on foursquare method of cutting out.This improvement is that the number in order to make the operation that is compressed in each stage reduces, thereby when receiving end keeps each picture quality, has reduced the consumption of energy.Therefore, in S-DCT, only upper left DCT coefficient part is retained, cutting coefficient is
w, wherein
kthe size of piece, as Figure 13 (
w=3) and Figure 14 (
w=5).
Be further used as preferred embodiment, described dct transform is specially based on leg-of-mutton method of cutting out.
On the basis of S-DCT method of cutting out, propose based on leg-of-mutton method of cutting out T-DCT.The method is improved S-DCT method of cutting out, equally block size is cut, and the method no longer retains upper left square area, and it is only processed in Given Graph picture
k × k(the right-angle side length of reserve part is the upper left corner part of individual DCT coefficient
w), as Figure 15 (
w=3) and Figure 16 (
w=5).Other coefficient is not considered, also need not participate in the calculating of other steps, reduces so to greatest extent the energy consumption of source node.Therefore, in T-DCT, only the DCT coefficient part in the upper left corner is retained, cutting coefficient is
w, wherein
kit is the size of piece.
To sum up, in embodiment, adopt the prediction single goal region-of-interest method based on historical frames, the in the situation that of environmental catastrophe, can effectively lock the scope of region-of-interest; Adopt DCT coefficient tailoring technique, to the AC coefficient zero setting of non-region-of-interest, reduce the energy consumption of compression process, therefore in resource-constrained wireless multimedia sensor network, for wireless multimedia sensor network computing feature limited in one's ability, greatly save processing and the transmitting energy consumption of sensor node, can meet wireless multimedia sensor network and calculate the limited situation of storage capacity.
More than that better enforcement of the present invention is illustrated, but the invention is not limited to described embodiment, those of ordinary skill in the art can also make all equivalents or replacement under the prerequisite without prejudice to spirit of the present invention, and the distortion that these are equal to or replacement are all included in the application's claim limited range.