Method for processing ballot information
Technical field
The invention belongs to the information processing method of ballot paper.
Background technology
Existing ballot paper information approach is handled automatically based on computer system, generally comprise ballot paper image recognition, ballot paper information processing, ballot paper information analysis and ballot paper result treatment step, wherein the ballot paper image recognition adopt technology such as image scanning with on the ballot paper with full-filling or draw the selection information that form such as hook done and carry out image recognition, in ballot paper information processing step, add up then, in ballot paper information analysis step, obtain alternative people information, in ballot paper result treatment step, deposit the ballot paper result in database.
Selection information the such as mostly said process of prior art, the appendix information of ballot paper are that the candidate is only arranged, alternative people cause when relying on image recognition that ballot paper information processing precision is low, the information processing kind is few and cause accuracy not ideal enough; Can only adapt to single election regulation, promptly each election regulation just must design one be overlapped message processing flow, causes the bad adaptability of ballot paper information processing.
Summary of the invention
The objective of the invention is to solve that the processing accuracy that existing method for processing ballot information exists is low, accuracy is not high and the problem of bad adaptability, a kind of new ballot paper information approach is provided, after multiple information by presetting ballot paper and the Image Acquisition with the coupling of preset information, improve ballot paper information processing precision and information processing kind, and, make the adaptability of this method wideer by optional election regulation coupling ballot paper information.
Purpose of the present invention realizes by following technical proposals:
Method for processing ballot information, comprise ballot paper image recognition, ballot paper information processing, ballot paper information analysis and ballot paper result treatment step, described disposal route also comprises the ballot paper image segmentation step before the ballot paper image recognition step, also has the voting pattern obtaining step before the ballot paper image segmentation step.
Voting pattern in the described voting pattern obtaining step comprises ballot paper size, basic point information, election regulation, recognition rule and ballot paper pattern information.
Described basic point information comprises that ballot paper anchor point, ballot paper ticket head and ballot paper clock track (promptly are printed on the locating piece that the ballot paper both sides are used for message block location, correction, clock track is to occur in pairs, the all corresponding a pair of clock track of each row message block, clock track and this row message block are on the same horizontal line) information, and the region of search of basic identification point, the physical size size and the identification error range information of anchor point.
Described ballot paper pattern comprises ballot paper title, subclass title (being the job title that conducts an election in the ballot paper), number of candidates, candidate's name, candidate message piece number, the functional definition of candidate message piece, each candidate message piece theoretical coordinate and theoretical size, alternative piece number, each alternative piece theoretical coordinate and theoretical size information.
In the described voting pattern obtaining step, from the data in server storehouse, obtain the object instance (being the data structure instance of voting pattern) of filling voting patterns after the voting pattern data with these data, and be kept in the internal memory of server.
In the described ballot paper image segmentation step: after utilizing image acquiring device to obtain the image of ballot paper, cut apart, mate the ballot paper anchor point according to the basic point information in the voting pattern, to obtain the actual location point coordinate of this ballot paper image, if can't discern the ballot paper anchor point, then this ballot paper is handled as invalid ballots, in the ballot paper result, noted simultaneously the ballot paper reason of makeing mistakes; Ballot paper ticket head is cut apart, mated in conjunction with ballot paper actual location point coordinate according to basic point information then, to obtain the draft bank and the ballot paper incidence information of ballot paper, if can't discern ballot paper draft bank or ballot paper incidence information then this ballot paper is handled as invalid ballots, in the ballot paper result, note the ballot paper reason of makeing mistakes simultaneously; Obtain to verify at first whether this ballot paper is that this elects employed ballot paper after the ballot paper draft bank, if not, then this ballot paper is handled as invalid ballots, in the ballot paper result, note the ballot paper reason of makeing mistakes simultaneously; After the checking of ballot paper draft bank, according to basic point information the ballot paper clock track is cut apart, mated, to obtain clock track quantity, the coordinate information in this ballot paper image; Then with the ballot paper pattern relatively, with the correctness of checking clock track,, then this ballot paper is handled as invalid ballots if the checking result proves that clock track is wrong, in the ballot paper result, note the ballot paper reason of makeing mistakes simultaneously; After having obtained correct clock track quantity, coordinate information, obtain each candidate message piece and actual coordinate and the size of selecting piece else in this ballot paper image in conjunction with the ballot paper pattern, to form all identified region information of this ballot paper.
In the described ballot paper information processing step, selection situation to each all message block of candidate is added up, to draw each candidate's choice situation, according to the candidate message piece functional definition in the ballot paper pattern gained vote situation of this candidate under this choice situation carried out functional interpretation again, to obtain this candidate's gained vote situation, with each candidate's of obtaining every ballot paper gained vote situation, and above-mentioned information inserted in the election results.
In the described ballot paper information analysis step, the candidate who obtains every each subclass of ballot paper wins the vote situation and this subclass by the alternative piece number of full-filling, according to election regulation each subclass of ballot paper is carried out validity and judges, produces following two kinds of subclass result datas:
A. subclass full-filling situation meets election regulation, and then the effective subclass of this subclass will be inserted the gained vote situation information of agreeing with poll, opposition poll, abstention poll, alternative poll and each candidate in this subclass in election results;
B. the subclass full-filling does not meet election regulation, and then this subclass is invalid subclass, will insert agreeing with poll, oppose poll in this subclass, abstention poll, alternative poll and each candidate's gained vote situation and the subclass reason of makeing mistakes in election results.
In the described ballot paper result treatment step, handle respectively according to the ballot paper result of normal ballot paper result, the ballot paper result who comprises invalid subclass and invalid ballots:
(1) normal ballot paper result's processing is handled respectively by following two steps:
A. the normal subclass of not having alternative people information
The ballot paper result is saved in local database server and remote database server respectively;
B., the normal subclass that alternative people information is arranged
The ballot paper result is saved in local database server and remote database server respectively, and the image cut of each alternative people information is got off to be saved in respectively local database server and remote database server;
(2) to comprising the ballot paper result treatment of invalid subclass
Earlier deposit the ballot paper error message in local data base and remote data base respectively together with the double-edged image information of invalid ballots, handle respectively by following three steps then:
A. the normal subclass of not having alternative people information
The ballot paper result is saved in local database server and remote database server respectively;
B., the normal subclass that alternative people information is arranged
The ballot paper result is saved in local database server and remote database server respectively, and the image cut of each alternative people information is got off to be saved in respectively local database server and remote database server;
C. invalid subclass
The reason that this subclass is made mistakes is saved in local database server and remote database server respectively;
(3) to the ballot paper result treatment of invalid ballots
Deposit the make mistakes information of reason of ballot paper in local data base and remote data base respectively together with the double-edged image information of invalid ballots.
The present invention added voting pattern and obtains before ballot paper image recognition step, the ballot paper image segmentation step, comprise multiple information category (election regulation particularly by in database, presetting, recognition rule, the ballot paper anchor point, ballot paper ticket head, the ballot paper clock track, various information such as identification error scope) voting pattern information, and voting pattern information appendix on ballot paper, to form correspondence, with these voting pattern information as auxiliary, the coordinate that obtains in conjunction with the image segmentation of ballot paper, draft bank, information such as clock track, form confirmation, can improve the precision of ballot paper information processing; By the selected of election regulation carried out efficiency analysis with the subclass to ballot paper, can improve the adaptability of ballot paper information processing, only need to set different election regulation, all can use this method and handle; Handle for the subclass efficiency analysis judgement of ballot paper information and ballot paper result's classification, can obtain more comprehensive poll information, invalid ballots can be included in the ballot paper information processing, conform to real ballot situation, outside the ballot paper information processing, (enter ballot box) and cause reality to have thrown ticket processed or add up not ballot and avoided prior art that invalid ballots are stoped as prevention, or because of scanning error cause valid ballot to be treated to invalid ballots, prior art causes above-mentionedly either way is not inconsistent with true ballot situation, so that the result of ballot paper information processing can not reflect real ballot situation, and the present invention has then avoided this situation; By the ballot paper result is kept at local data base and remote database server respectively, formation backups each other, can improve reliability, the fault-tolerance of ballot paper information processing, guarantee net result and the accuracy that true ballot situation conforms to, avoid the mistake that causes in the data handling procedure.
As seen, adopt the present invention of above-mentioned steps, compared with prior art, have higher ballot paper information processing precision and accuracy, wideer accommodation, higher reliability, applicable to the ballot paper information processing of various elections.
Embodiment
The present invention is further illustrated below in conjunction with specific embodiment.
Method for processing ballot information comprises that voting pattern obtains, ballot paper image segmentation, ballot paper image recognition, ballot paper information processing, ballot paper information analysis and ballot paper result treatment step.
Set in advance voting pattern information, and with these information appendix to the ballot paper and deposit in the database.
The particular content of each step is as follows.
1, voting pattern obtaining step
From database, obtain the voting pattern information data, fill the object instance (promptly the data structure by the voting pattern of setting formats processing to above-mentioned data, so that system call) of voting pattern with these data, and be saved in the internal memory.
Voting pattern in this step comprises ballot paper size, basic point information, election regulation, recognition rule and ballot paper pattern information.
The ballot paper size can be B5 or two kinds of specifications of A4.
Basic point information comprises that ballot paper anchor point, ballot paper ticket head and ballot paper clock track (promptly are printed on the locating piece that the ballot paper both sides are used for message block location, correction, clock track is to occur in pairs, the all corresponding a pair of clock track of each row message block, clock track and this row message block are on the same horizontal line) information, and the region of search of basic identification point, the physical size size and the identification error range information of anchor point.
The ballot paper pattern comprises ballot paper title, subclass title (being the job title that conducts an election in the ballot paper), number of candidates, candidate's name, candidate message piece number, the functional definition of candidate message piece, each candidate message piece theoretical coordinate and theoretical size, alternative piece number, each alternative piece theoretical coordinate and theoretical size information.
Election regulation is set corresponding rule according to different elections, as elects rule, secondary election regulation etc. directly.
2, election image segmentation step
After utilizing image acquiring device to obtain the image of ballot paper, cut apart, mate the ballot paper anchor point according to the basic point information in the voting pattern, to obtain the actual location point coordinate of this ballot paper image, if can't discern the ballot paper anchor point, then this ballot paper is handled as invalid ballots, in the ballot paper result, noted simultaneously the ballot paper reason of makeing mistakes;
Ballot paper ticket head is cut apart, mated in conjunction with ballot paper actual location point coordinate according to basic point information then, to obtain the draft bank and the ballot paper incidence information of ballot paper, if can't discern ballot paper draft bank or ballot paper incidence information then this ballot paper is handled as invalid ballots, in the ballot paper result, note the ballot paper reason of makeing mistakes simultaneously;
Obtain to verify at first whether this ballot paper is that this elects employed ballot paper after the ballot paper draft bank, if not, then this ballot paper is handled as invalid ballots, in the ballot paper result, note the ballot paper reason of makeing mistakes simultaneously;
After the checking of ballot paper draft bank, according to basic point information the ballot paper clock track is cut apart, mated, to obtain clock track quantity, the coordinate information in this ballot paper image; Then with the ballot paper pattern relatively, with the correctness of checking clock track,, then this ballot paper is handled as invalid ballots if the checking result proves that clock track is wrong, in the ballot paper result, note the ballot paper reason of makeing mistakes simultaneously;
After having obtained correct clock track quantity, coordinate information, obtain each candidate message piece and actual coordinate and the size of selecting piece else in this ballot paper image in conjunction with the ballot paper pattern, to form all identified region information of this ballot paper.
3, ballot paper image recognition step
This step is discerned the full-filling situation of all identified regions in the ballot paper according to the recognition rule in the voting pattern, whether to obtain each message block and alternative piece by the judgement of full-filling.
4, ballot paper information processing step
At first the full-filling situation of each all message block of candidate is carried out statistical study, draw each candidate's full-filling situation, according to the candidate message piece functional definition in the ballot paper pattern gained vote situation of this candidate under this full-filling situation made an explanation again, to obtain this candidate's gained vote situation.Each opens each candidate's of ballot paper gained vote situation so final acquisition, and these information are inserted in the election results.
5, ballot paper information analysis step
The candidate who obtains every each subclass of ballot paper wins the vote situation (comprising the poll of agreeing with, oppose, waiving the right) and this subclass by the alternative piece number of full-filling, according to election regulation each subclass of ballot paper is carried out validity and judges, produce following two kinds of subclass result datas:
A. subclass full-filling situation meets election regulation, and then the effective subclass of this subclass will be inserted the gained vote situation information of agreeing with poll, opposition poll, abstention poll, alternative poll and each candidate in this subclass in election results;
B. the subclass full-filling does not meet election regulation, and then this subclass is invalid subclass, will insert agreeing with poll, oppose poll in this subclass, abstention poll, alternative poll and each candidate's gained vote situation and the subclass reason of makeing mistakes in election results.
6, ballot paper result step
Just formed the ballot paper object information after finishing the ballot paper information analysis and judgment, the ballot paper result has three kinds of situations, handles respectively according to the ballot paper result of normal ballot paper result, the ballot paper result who comprises invalid subclass and invalid ballots:
(1) normal ballot paper result's processing is handled respectively by following two steps:
A. the normal subclass of not having alternative people information
The ballot paper result is saved in local database server and remote database server respectively;
B., the normal subclass that alternative people information is arranged
The ballot paper result is saved in local database server and remote database server respectively, and the image cut of each alternative people information is got off to be saved in respectively local database server and remote database server;
(2) to comprising the ballot paper result treatment of invalid subclass
Earlier deposit the ballot paper error message in local data base and remote data base respectively together with the double-edged image information of invalid ballots, handle respectively by following three steps then:
A. the normal subclass of not having alternative people information
The ballot paper result is saved in local database server and remote database server respectively;
B., the normal subclass that alternative people information is arranged
The ballot paper result is saved in local database server and remote database server respectively, and the image cut of each alternative people information is got off to be saved in respectively local database server and remote database server;
C. invalid subclass
The reason that this subclass is made mistakes is saved in local database server and remote database server respectively;
(3) to the ballot paper result treatment of invalid ballots
Deposit the make mistakes information of reason of ballot paper in local data base and remote data base respectively together with the double-edged image information of invalid ballots.The tow sides image information of invalid ballots is preserved respectively, make that manually checking ballot paper information has had the basis, the ballot paper of system's erroneous judgement can be revised, guarantee realistic to greatest extent ballot situation.