A kind of method and system of dynamic image cachingTechnical field
The present invention relates to the method and system of a kind of dynamic image caching, belong to field of computer technology.
Background technology
Along with the most progressive social and each side is for an urgent demand of auto authentication fast and effectively, biologicalFeature identification technique has obtained development at full speed in recent decades.As a kind of inherent attribute of people, and have the strongestSelf stability and individual difference, biological characteristic becomes the most preferable foundation of auto authentication.Current biological characteristicIdentification technology mainly includes: fingerprint recognition, retina identification, iris identification, Gait Recognition, hand vein recognition, recognition of face etc..Compared with other recognition methodss, recognition of face is owing to having directly, friendly, convenient feature, user without any mental maladjustment,It is prone to be accepted by user, thus has obtained studying widely and applying.In addition, we can also be to the knot of recognition of faceThe most for further analysis, obtain the sex about people, expression, many extra abundant informations such as age, extend face and knowOther application prospect.Current face recognition technology has mainly been applied to the following aspects:
(1) criminal investigation and case detection public security department stores the photo of suspect in archives economy, when crime scene or by itAfter his approach obtains the photo of a certain suspect or the description of its facial characteristics, confirmation can be searched rapidly from data base,Substantially increase the accuracy and efficiency of criminal investigation and case detection.
(2) certificate verification is to check someone identity at many occasions (such as Haikou, airport, secret department etc.) certificate verificationA kind of conventional means, and identity card, a lot of other certificates such as driver's license have photo, use face recognition technology, it is possible toCompleted checking by machine and identify work, thus realize automatic intelligent management.
(3) video monitoring is in many banks, and company, public place etc. is designed with the video monitoring of 24 hours.Different when havingReason condition or when having stranger to swarm into, needs real-time tracking, monitoring, identifies and warning etc..The image collected is entered by these needsRow concrete analysis, and the detection of face to be used, follow the tracks of and identification technology.
(4) wide range of in-let dimple in-let dimple, had both included at building, the safety inspection of the porch such as house,Also include the authentication before entering computer system or intelligence channel.
(5) Expression analysis is according to the changes in faces feature in facial image, identifies and analyze the affective state of people, such as heightEmerging, angry etc..Additionally, face recognition technology is also at medical science, file administration, human face animation, the aspects such as face models, video conferenceAlso there is huge application prospect.
(6) recognition of face also has some interesting useful application, is such as capable of identify that the intelligent toy of mastership, familyPolitical affairs robot, there is the virtual game player etc. of true image surface.
Summary of the invention
The technical problem to be solved is not have data latency buffer area for prior art to exist, and so may be usedThe probability losing data can be had, may have serious consequences;Bus work frequently, may cause the burden of CPU moreCome the heaviest, finally result in system crash;In data handling, the current frame data that only process, so at time one-tenth for prior artCan be bigger on Ben;The deficiency that the time that processes in prior art is slower, it is provided that a kind of Double Register processes the dynamic image of imageThe method and system of caching.
The technical scheme is that a kind of method that dynamic image caches, including followingStep:
Step 1: receive the image of collecting device collection as present image;
Step 2: judge whether switch module is connected with the first buffer, if it is, using the first buffer as currentlyBuffer, the second buffer, as free buffer device, performs step 3;Otherwise, using the second buffer as current buffer, theOne buffer, as free buffer device, performs step 3;
Step 3: after being transferred in current buffer by present image, disconnects the connection of switch module and current buffer,Switch module is connected with free buffer device;
Step 4: present image is transferred to external equipment by current buffer;
Step 5: judge that collecting device the most also sends image, if it is, perform step 1;Otherwise, terminate.
The invention has the beneficial effects as follows: not frame losing processes, ad hoc two frames wait buffer, queue processing Frame;DoubleBuffer processing module, quickly carries out image comparison, waits buffer, queue processing Frame, it is achieved no by ad hoc two framesFrame losing processes;Data put together and carry out, into machine and storage, to avoid bus operation frequently, offloading the CPU;Speed is moreHurry up, it is achieved efficiently, economical;Image comparison time shortens, and reduces cost.
On the basis of technique scheme, the present invention can also do following improvement.
Further, in described step 3, after current buffer receives present image, the information that sends is to switch module;Control is openedClose module and disconnect the connection with current buffer, set up the connection with free buffer device.
Use above-mentioned further scheme to provide the benefit that, control switch module by information, connection can be made in time to breakOpen, it is to avoid occur that continuous image image being inputted same buffer and occur covers phenomenon, it is ensured that two buffers are alternatelyReceive image.
Further, step 12 is also included between described step 1 and step 2:
Present image is stored in temporary buffer as Waiting Graph picture, using the image that is stored in the earliest in temporary buffer asPresent image exports, and performs step 2.
Use above-mentioned further scheme to provide the benefit that, by the addition of temporary buffer, can delay first, secondThe image that storage has little time to process is stored temporarily in temporary buffer, it is to avoid asking of the frame losing occurred because of having little time to processTopic.
Further, all images stored are ranked up, according to advanced person by described temporary buffer according to the access timeFirst go out principle output image.
Use above-mentioned further scheme to provide the benefit that, ensure that picture frame by time-sequencing and first in first outBecause inserting temporary buffer, entanglement will not occur, enter temporary buffer and output temporary buffer ensures same order.
Further, the memory space of described temporary buffer is set as at least two frames.
Using above-mentioned further scheme to provide the benefit that, temporary buffer only plays the left and right of temporal cache, it is not necessary toExcessive memory space, it is possible to store the image that a few frame has little time to process, in the case of ensureing not frame losing, by reducingMemory space is that system takies less memory headroom, speed up processing.
The technical scheme is that the system that a kind of dynamic image caches, including:
Receiver module, receives the image that collecting device gathers;
Switch module, is connected with in two buffers, and by this connection, receiver module is sent to correspondenceIn buffer;
Two buffers, are alternately received the image transmitted by switch module, and the image received are sent to outsideIn equipment.
On the basis of technique scheme, the present invention can also do following improvement.
Further, said two buffer includes the first buffer and the second buffer, when switch module and the first cachingDevice is connected, and the first buffer receives image;When switch module and the second buffer are connected, the second buffer receives image.
Further, after described first buffer receives image, the information that sends is to switch module;Control switch module disconnect withThe connection of the first buffer, sets up the connection with the second buffer;
After described second buffer receives image, the information that sends is to switch module;Control switch module and disconnect slow with secondThe connection of storage, sets up the connection with the first buffer.
Use above-mentioned further scheme to provide the benefit that, control switch module by information, connection can be made in time to breakOpen, it is to avoid occur that continuous image image being inputted same buffer and occur covers phenomenon, it is ensured that two buffers are alternatelyReceive image.
Further, temporary buffer is also included between described receiver module and switch module:
Image is stored in temporary buffer as Waiting Graph picture, the image being stored in the earliest in temporary buffer by receiver moduleOutput.
Use above-mentioned further scheme to provide the benefit that, by the addition of temporary buffer, can delay first, secondThe image that storage has little time to process is stored temporarily in temporary buffer, it is to avoid asking of the frame losing occurred because of having little time to processTopic.
Further, all images stored are ranked up, according to advanced person by described temporary buffer according to the access timeFirst go out principle output image.
Use above-mentioned further scheme to provide the benefit that, ensure that picture frame by time-sequencing and first in first outBecause inserting temporary buffer, entanglement will not occur, enter temporary buffer and output temporary buffer ensures same order.
Further, the memory space of described temporary buffer is set as at least two frames.
Using above-mentioned further scheme to provide the benefit that, temporary buffer only plays the left and right of temporal cache, it is not necessary toExcessive memory space, it is possible to store the image that a few frame has little time to process, in the case of ensureing not frame losing, by reducingMemory space is that system takies less memory headroom, speed up processing.
Accompanying drawing explanation
Fig. 1 is the method flow diagram of a kind of dynamic image caching described in the embodiment of the present invention 1;
Fig. 2 is the system structure schematic diagram of a kind of dynamic image caching described in the embodiment of the present invention 1.
In accompanying drawing, the list of parts representated by each label is as follows:
1, receiver module, 2, switch module, 3, buffer, 4, temporary buffer, the 31, first buffer, the 32, second cachingDevice.
Detailed description of the invention
Being described principle and the feature of the present invention below in conjunction with accompanying drawing, example is served only for explaining the present invention, andNon-for limiting the scope of the present invention.
As it is shown in figure 1, the method for a kind of dynamic image caching described in the embodiment of the present invention 1, comprise the following steps:
Step 1: receive the image of collecting device collection as present image;
Step 2: judge whether switch module is connected with the first buffer, if it is, using the first buffer as currentlyBuffer, the second buffer, as free buffer device, performs step 3;Otherwise, using the second buffer as current buffer, theOne buffer, as free buffer device, performs step 3;
Step 3: after being transferred in current buffer by present image, disconnects the connection of switch module and current buffer,Switch module is connected with free buffer device;
Step 4: present image is transferred to external equipment by current buffer;
Step 5: judge that collecting device the most also sends image, if it is, perform step 1;Otherwise, terminate.
In described step 3, after current buffer receives present image, the information that sends is to switch module;Control switch moduleDisconnect the connection with current buffer, set up the connection with free buffer device.
Step 12 is also included between described step 1 and step 2:
Present image is stored in temporary buffer as Waiting Graph picture, using the image that is stored in the earliest in temporary buffer asPresent image exports, and performs step 2.
The all images stored are ranked up, according to first in first out by described temporary buffer according to the access timeOutput image.
The memory space of described temporary buffer is set as at least two frames.
As in figure 2 it is shown, the system cached for a kind of dynamic image described in the embodiment of the present invention 2, including:
Receiver module 1, receives the image that collecting device gathers;
Switch module 2, is connected with in two buffers, and by this connection, receiver module is sent to correspondenceIn buffer;
Two buffers 3, are alternately received the image transmitted by switch module, and the image received are sent to outsideIn equipment.
Said two buffer 3 includes the first buffer 31 and the second buffer 32, when switch module and the first buffer31 are connected, and the first buffer 31 receives image;When switch module and the second buffer 32 are connected, and the second buffer 32 receivesImage.
After described first buffer 31 receives image, the information that sends is to switch module;Control switch module to disconnect and firstThe connection of buffer 31, sets up the connection with the second buffer 32;
After described second buffer 32 receives image, the information that sends is to switch module;Control switch module to disconnect and secondThe connection of buffer 32, sets up the connection with the first buffer 31.
Temporary buffer 4 is also included between described receiver module 1 and switch module 2:
Image is stored in temporary buffer as Waiting Graph picture, the figure being stored in the earliest in temporary buffer 4 by receiver module 1As output.
The all images stored are ranked up by described temporary buffer 4 according to the access time, former according to first in first outThen export image.
The memory space of described temporary buffer 4 is set as at least two frames.
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all spirit in the present invention andWithin principle, any modification, equivalent substitution and improvement etc. made, should be included within the scope of the present invention.