Summary of the invention
One of them object of the present invention is to provide a kind of Symbol Recognition for medical report list and system, for providing the recognition accuracy of OCR system, improves medical report list analyzing efficiency.
First aspect, embodiments provides a kind of Symbol Recognition for medical report list, comprising:
According to the latent structure training sample training classifier of distinct symbols;
From medical report free hand drawing sheet, foreground image gathers distinct symbols, obtains the feature of distinct symbols to construct symbol guide;
Utilize described sorter identification and detected symbol template, for obtaining abnormal index in medical report list and position.
Alternatively, described structure training sample training classifier adopts logistic regression method, comprises the following steps:
Structure training sample;
Described training sample is carried out size normalization, obtains the characteristics of image of same dimension;
The image feature value of calculation training sample;
Train described sorter according to described image feature value, obtain described classifier parameters.
Alternatively, before from medical report free hand drawing sheet, foreground image gathers distinct symbols, the method also comprises pre-treatment step, specifically comprises:
Utilize Hough transformation method to obtain the apex coordinate of foreground image, determine the dimensional information of described foreground image;
Perspective transform method is utilized to carry out slant correction to described foreground image, to obtain the described foreground image of orthogonal projection;
Utilize local thresholding method that described foreground image is divided into some regions, binaryzation is carried out to each described region.
Alternatively, described from medical report free hand drawing sheet foreground image gather distinct symbols, also comprise this step of height of determining often to compose a piece of writing, comprising:
That reads in described foreground image is text filed, carries out dilation and erosion obtain connected domain to described text;
When the horizontal projection energy of described connected domain is greater than energy preset value, the maximum difference of the position of described horizontal projection is height originally of often composing a piece of writing.
Alternatively, when the symbol that foreground image gathers is arrow, comprise the following steps:
According to the latent structure vertical line template of vertical line;
All separable vertical lines in foreground image according to described vertical line Template Location;
According to described vertical line structure of transvers plate arrow template;
Construct training sample respectively, training study obtains classifier parameters;
Arrow locations is detected in the position of separable vertical line.
Alternatively, the described latent structure vertical line template according to vertical line, comprising:
Pixel value when the position up and down of continuous line segment is 0, and when being greater than predetermined threshold value with the matching degree of symbol guide correspondence position, marking continuous line segment is separable vertical line;
Travel through described foreground image, separable vertical lines all in the foreground image of location.
Alternatively, according to described vertical line structure of transvers plate arrow template, comprising:
In the position at each separable vertical line place, in the region identical with vertical line template size, carry out horizontal projection;
Calculated level projection energy value is greater than the maximum difference of the position of energy preset value, obtains the live width of vertical line.
Alternatively, the function expression of described sorter is:
Wherein, P (t) is classification results, and t is the weighted sum of proper vector;
N is the dimension of feature, w
ibe the weight coefficient of the i-th dimensional feature, x
iit is the eigenwert of the i-th dimensional feature.
Second aspect, the embodiment of the present invention additionally provides a kind of symbol recognition system for medical report list, comprising:
Sorter generation module, for the latent structure training sample training classifier according to distinct symbols;
Symbol guide constructing module, gathers distinct symbols for foreground image from medical report free hand drawing sheet, obtains the feature of distinct symbols to construct symbol guide;
Template matches module, utilizes described sorter identification and detected symbol template, for obtaining abnormal index in medical report list and position.
Compared with prior art, the present invention not only compensate for traditional OCR deficiency low to special symbol discrimination, and the typesetting format also having adapted to text is complicated and diversified; This recognition methods is applied in the parsing of medical report list of medical domain simultaneously, utilize upwards or a certain index that describes in medicalization verification certificate of downward arrow there is situation higher or on the low side, abnormal index is characterized with this, fast resolving medical report list can be realized, there is high using value and vast potential for future development.
Embodiment
In order to more clearly understand above-mentioned purpose of the present invention, feature and advantage, below in conjunction with the drawings and specific embodiments, the present invention is further described in detail.It should be noted that, when not conflicting, the feature in the embodiment of the application and embodiment can combine mutually.
Set forth a lot of detail in the following description so that fully understand the present invention; but; the present invention can also adopt other to be different from other modes described here and implement, and therefore, protection scope of the present invention is not by the restriction of following public specific embodiment.
On the one hand, the present invention proposes a kind of Symbol Recognition for medical report list, as shown in Figure 1, comprising:
S10, latent structure training sample training classifier according to distinct symbols;
S20, from medical report free hand drawing sheet, foreground image gathers distinct symbols, obtains the feature of distinct symbols to construct symbol guide;
S30, utilize described sorter identification and detected symbol template, for obtaining abnormal index in medical report list and position.
Will be understood that, traditional Chinese medicine report picture of the present invention refers to picture medical report list being placed on somewhere shooting; Foreground image then refers to the imaging of medical report singly in picture.
For the problem that OCR system in prior art is low to special symbol discrimination in text, the Symbol Recognition that the embodiment of the present invention provides, train different sorters according to distinct symbols, then gather symbol from medical report list and set up template, template matches is carried out to sorter.Not only compensate for the deficiency that traditional OCR is low to special symbol discrimination, can be applied in the parsing of medical report list simultaneously, thus carry out fast resolving medical report list, be conducive to improving analyzing efficiency.
Generally, the image obtained by scanner is all orthogonal projection, and image does not have angular deviation, is conducive to the Text region in image.And during camera acquisition image, being subject to restriction and the interference of various condition, the figure sector-meeting of captured object deforms (such as near big and far smaller), needs could use through certain distortion correction process, to ensure not occur error to during image recognition.As shown in Figure 1, the picture of the medical report list of video camera shooting, there is significantly distortion in this picture, therefore needs to carry out pre-service to image.
Alternatively, before from medical report free hand drawing sheet, foreground image gathers distinct symbols, the method also comprises pre-treatment step, specifically comprises:
Utilize Hough transformation method to obtain the apex coordinate of foreground image, determine the dimensional information of described foreground image;
Utilize local thresholding method that described foreground image is divided into some regions, binaryzation is carried out to each described region.
First, introduce the apex coordinate utilizing Hough transformation method to obtain foreground image, determine the step of the dimensional information of described foreground image.
The present invention utilizes Hough transformation method to detect the foreground image edge of medical report free hand drawing sheet, determines the size of foreground image.According to the duality of point with line, curve representation form given for input picture space is become the point of parameter space, thus the test problems of given curve in input picture is converted into the spike problem found in parameter space.Be about to detect global feature and be converted into detection local characteristics, like this by obtaining the edge line equation of foreground image, and the intersection point of straight line, the apex coordinate of foreground image and the dimensional information of foreground image can be obtained.Then, the width value then after correcting using width and maximal value highly as foreground image respectively and height value.
Secondly, introduction utilizes perspective transform method to carry out slant correction to described foreground image, to obtain the step of the described foreground image of orthogonal projection.
After determining the size of foreground image, slant correction is carried out to foreground image.In the present invention, foreground image is mapped in shot object plane, is equivalent to by video camera perpendicular to medical report list, thus obtain desirable picture shape, and do not lose the information that foreground image comprises.
In practical application, those skilled in the art realize the correction to tilted image, and other preprocess methods also can be adopted to solve the problems of the technologies described above, and realize basic effect, the present invention is not construed as limiting.
Finally, introduce and utilize local thresholding method that described foreground image is divided into some regions, binaryzation is carried out to each described region.
Because foreground image comprises 256 brightness degrees, for reducing the complexity calculated, improve the recognition efficiency of special symbol.The present invention carries out binary conversion treatment to this foreground image.
When image binaryzation process, the present invention adopts local thresholding method.This foreground image is divided into several regions, a threshold value is arranged to each region and carries out binaryzation, thus obtain the foreground image of binaryzation, in binaryzation foreground image, better can distinguish target and background.
After pre-service is carried out to Fig. 2, the foreground image after correcting can be obtained, see Fig. 3.
The medicalization verification certificate image that the present invention utilizes video camera to take is example, identifies the arrow wherein occurred, and obtains its positional information, more accurately and fast to determine the abnormal index item of patient.
1) template of vertical line is constructed, all separable vertical lines in the foreground image of location.According to the feature of vertical line, the pixel value namely above vertical line, below, in the preset range on the left side and the right side is 0, structure vertical line template.
According to the vertical line template constructed, the horizontal and vertical direction of foreground image adopts different step-lengths to travel through, orient all separable vertical lines in foreground image.Such as, in the embodiment of the present invention, height and the width of initialization vertical line template are respectively 40,3, and the horizontal direction moving step length of window is 4, vertical direction moving step length is 2, and the size of moving window is the width of vertical line template, adds moving step length on horizontal and vertical direction respectively highly again.Then, utilize vertical line template and moving step length scanning foreground image, according to the feature of separable vertical line, (namely line segment is continuous print, and the pixel value of vertical line up and down in certain limit is 0), when the vertical line matching degree of correspondence position is greater than predetermined threshold value in the line segment in foreground image and this vertical line template, then this line segment is labeled as vertical line.In practical application, the size of predetermined threshold value can be determined by test of many times.After having traveled through this foreground image, the coordinate of the position of all separable vertical lines can be obtained, and by it stored in being used for follow-up identification in text.
2) the row height of text and the live width of vertical line is determined.Carry out base conditioning to foreground image Chinese version region, such as dilation and corrosion, obtains connected domain, determines according to the width of connected domain height originally of often composing a piece of writing.And using this size of height originally as initialization arrow of often composing a piece of writing, i.e. the height of arrow.Constantly upgraded and revised in testing process.
To all separable vertical lines oriented, the embodiment of the present invention adopts difference method to calculate the live width of vertical line.
First structure detects the template of arrow.Arrow is made up of vertical line and symmetrical oblique line, and therefore on vertical line template basis, construct arrow template, namely the horizontal ordinate of vertical line gets 3,6 step-lengths respectively to left and right in the horizontal direction, and the ordinate of vertical line upwards gets 2 step-lengths.Then, get in the region identical with vertical line template size, carry out horizontal projection in the position at each vertical line place.The energy finding out horizontal projection is greater than position during energy preset value, then calculates the difference of this position.When obtaining the maximum difference of this position, it is exactly the live width of arrow vertical line.Certainly, the height of the acquisition vertical line that uses the same method can also be adopted.
Such as: horizontal projection energy is greater than position during energy preset value, is set to 1, otherwise be 0, the array of a multiline text can be obtained:
A=[0,0,0,1,1,1,1,1,0,0];
To the data step-by-step negate in this array A, obtain array B:
B=[1,1,1,0,0,0,0,0,1,1];
Namely the position having 1 in array B is respectively los=1,2,3,8,9;
And ask expectation difference in position:
c=diff(los)=(1,1,5,1)
d=max(c)=5。
The live width that can obtain this vertical line is 5.
3) arrow template is trained.According to the feature of arrow, embodiment of the present invention structure training sample.By continuous training study, obtain the parameter of sorter, for detecting the arrow in foreground image.The feature continuing to utilize sorter to judge whether to meet arrow to have in the position at vertical line place, if be identified as arrow, write down position now, and it is abnormal to think that the index of medical report list this journey occurs.
After determining arrow live width and line height, according to the feature of arrow, detection arrow is divided into upper and lower two parts.Wherein, the first half comprises symmetrical oblique line, and the pixel value around the latter half vertical line of arrow simultaneously outside predeterminable range is 0 entirely.Such as, in the first half, whether comprise in the scope detecting the live width of each one times of the arranged on left and right sides of vertical line in the embodiment of the present invention and comprise oblique line; In the latter half, within the scope of the live width of each one times of the both sides of oblique line, pixel value is 0.
Therefore, the present invention is by training and determining that the method for sorter distinguishes separable vertical line and arrow.According to the component characteristic of arrow, construct training sample respectively, by continuous training study, try to achieve classifier parameters, for the detection identification division of arrow.
Alternatively, utilize logistic regression method to obtain sorter, comprising:
Structure training sample;
Described training sample is carried out size normalization, obtains the characteristics of image of same dimension;
The image feature value of calculation training sample;
Train described sorter according to image feature value, obtain described classifier parameters.
The present invention's preferred Logistic logistic regression sorter trains vertical line both sides whether containing oblique line and blank, and Logistic logistic regression sorter has the advantages such as calculated amount is very little, speed is very fast, storage resources is low when realizing simple, classification.Logistic is a kind of linear classifier, and function expression is:
Wherein, P (t) is classification results, and t is the weighted sum of proper vector;
N is the dimension of feature, w
ibe the weight coefficient of the i-th dimensional feature, x
iit is the eigenwert of the i-th dimensional feature.
In the embodiment of the present invention, adopt logistic regression method (Logistic) to obtain sorter, comprising:
(1) training sample set is constructed.Collect a large amount of arrow sample images and be used for training, in training process, to select on the left of arrow vertical line using the line width values of certain multiple as wide and high structure square template in the first half, due to symmetrical, only need flip horizontal can obtain on the right side of the first half template.Same method, structure arrow the latter half, the template of arranged on left and right sides, extracts above tetrameric characteristics of image and is used for training classifier.
(2) image of all samples of training sample set is carried out size normalization, now can obtain the characteristics of image of same dimension, for the training of sorter.
(3) eigenwert of calculation training sample.Using the pixel value after the binaryzation of foreground image and conversion thereof as characteristics of image, representation is simple, and computation complexity is low.
(4) train Logistic sorter, obtain classifier parameters.
(5) classifier parameters trained is utilized, for carrying out the position of marker arrow according to vertical line coordinate.As shown in Figure 4, the position of arrow has been marked with dotted line frame 2 in the enlarged drawing of dotted line frame 1.The abnormal index in this medical report list can be obtained by the position of arrow.As shown in Figure 5, arrow has marked an abnormal index: the 20th index monocyte absolute value in medical report list is higher.
The embodiment of the present invention is only illustrated Symbol Recognition in conjunction with arrow.In practical application, Symbol Recognition provided by the invention can also be applied in the identification of other symbols, such as plus sige, minus sign, the number of being more than or equal to, the number of being less than or equal to, fullstop, exclamation, percentage sign, Roman number and asterisk etc.According to the feature of distinct symbols, two symmetrical semicircles can be seen as in such as fullstop, exclamation can be divided into vertical line and put two parts, percentage sign can be divided into oblique line and the circle being positioned at these oblique line both sides etc., the Symbol Recognition that the embodiment of the present invention can be utilized to provide carries out identifying and other symbols detected in medical report list, does not repeat them here.
On the other hand, the embodiment of the present invention additionally provides a kind of symbol recognition system for medical report list, as shown in Figure 6, comprising:
Sorter generation module, obtains sorter for the latent structure training sample according to distinct symbols;
Symbol guide constructing module, from medical report free hand drawing sheet, foreground image gathers distinct symbols, obtains the feature of distinct symbols to construct symbol guide;
Template matches module, utilizes described sorter identification and detected symbol template, for obtaining abnormal index in medical report list and position.
Based on same inventive concept, a kind of symbol recognition system for medical report list that the embodiment of the present invention provides, this symbol recognition system realizes owing to adopting above-mentioned Symbol Recognition, thus can solve same technical matters, and obtain identical technique effect, no longer detailed at this.
It should be noted that in describing the invention, term " on ", the orientation of the instruction such as D score or position relationship be based on orientation shown in the drawings or position relationship, only the present invention for convenience of description and simplified characterization, instead of indicate or imply that the device of indication or element must have specific orientation, with specific azimuth configuration and operation, therefore can not be interpreted as limitation of the present invention.
Although describe embodiments of the present invention by reference to the accompanying drawings, but those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, such amendment and modification all fall into by within claims limited range.