Apparatus and method for performing optical character recognition

By applying optical character recognition technology in medical devices, by receiving and processing image data, identifying and segmenting character columns, the problems of drug mismatch and data input errors in the injection device are solved, and high-precision optical character recognition is achieved.

CN112733836BActive Publication Date: 2025-06-06SANOFI AVENTIS DEUT GMBH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011575695.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2014-07-10
Filing Date
2015-07-09
Publication Date
2025-06-06
Estimated Expiration
2035-12-16

AI Technical Summary

Technical Problem

In medical devices, especially in injection devices, it is difficult for the prior art to achieve high-precision optical character recognition, resulting in problems such as drug mismatch and data input errors.

Method used

By receiving image data, determine the number of black pixels in each column, define a vertical separation threshold, exclude columns with the number of black pixels below the threshold, identify the pixel group of the leftmost character column, and determine whether there are two character columns, so as to accurately identify the boundaries of the character column.

Benefits of technology

Accurate segmentation and isolation of characters in image data is achieved, and the accuracy and reliability of optical character recognition is improved, which is especially suitable for medical applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112733836B_ABST
    Figure CN112733836B_ABST
Patent Text Reader

Abstract

The present application relates to an apparatus and method for performing optical character recognition, and in particular to a method for performing character isolation in an optical character recognition process, the method comprising: receiving image data representing one or more character columns; determining the number of black pixels in each column in the image data; defining a vertical separation threshold, which is the maximum number of black pixels in the column; dividing the column into different pixel groups and excluded column groups by excluding any column whose number of black pixels is lower than the vertical separation threshold; identifying the pixel group representing the leftmost character column in the image data; determining whether there is one or two pixel groups representing the character column in the image data; and if it is determined that there are two pixel groups representing the character column, using a predetermined width value for the rightmost character column to identify the right-hand boundary of the rightmost character column.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application based on an invention patent application with an application date of July 9, 2015, application number 201580048263.2 (international application number PCT / EP2015 / 065669), and name “Device and method for performing optical character recognition”. Technical Field

[0002] The present invention relates to a device and method for performing optical character recognition (OCR). The device may be an auxiliary device for attachment to and use with a medical device such as an injection device. Background Art

[0003] In the field of medical devices, OCR technology is not often used in situations where very high accuracy is required, such as to prevent mis-dosing of medications. Therefore, many mechanical-based devices also have a dose scale or readout that must be read manually and the dose recorded manually. This is time-consuming for the user and can potentially lead to errors. In addition, if the data is to be transmitted electronically and / or analyzed electronically, the data must first be manually entered into a separate electronic device. In addition, some patients (e.g., patients with poor eyesight) may have difficulty reading the typically small mechanical readouts.

[0004] There are many diseases that need to be treated regularly by injecting medicaments. This injection can be carried out by using an injection device, injected by medical staff or the patient himself. As an example, type 1 and type 2 diabetes can be treated by the patient himself by injecting insulin doses, such as once or multiple times a day. For example, a pre-filled disposable insulin pen can be used as an injection device. As an alternative, a reusable pen can be used. The reusable pen allows the empty drug cartridge to be replaced with a new cartridge. Any pen can be provided with a set of disposable needles, which are replaced before each use. Then the insulin dose to be injected can be manually selected at the insulin pen, for example, by turning the dose knob and observing the actual dose from the dose window or display of the insulin pen. Then the dose is injected by inserting the needle into the appropriate skin part and pressing the injection button of the insulin pen. In order to monitor insulin injection, for example, to prevent the wrong operation of the insulin pen or to keep track of the dose that has been applied, it is desirable to measure information related to the condition and / or use of the injection device, such as information about the type and dose of insulin injected. Summary of the invention

[0005] A first aspect of the present invention provides a method for performing character isolation in an optical character recognition process, the method comprising:

[0006] receiving image data representing one or more character strings;

[0007] determining the number of black pixels in each column of the image data;

[0008] defining a vertical separation threshold, the vertical separation threshold being the maximum number of black pixels in a column;

[0009] dividing the columns into different pixel groups and excluded column groups by excluding any columns having a number of black pixels below the vertical separation threshold;

[0010] identifying a group of pixels representing a leftmost character column in the image data;

[0011] determining whether there are one or two pixel groups representing character columns in the image data; and

[0012] If it is determined that there are two pixel groups representing character columns, a predetermined width value is used for the rightmost character column to identify the right hand boundary of the rightmost character column.

[0013] This method allows the characters in the rightmost character column to be correctly segmented and isolated even if they merge with the right hand margin / frame area. Proper segmentation and isolation of characters in image data allows an accurate and reliable OCR process to be performed, which is particularly important for using OCR technology in medical applications.

[0014] Identifying a group of pixels representing a leftmost character column in the image data may include identifying a group of pixels immediately to the right of a leftmost exclusion column group.

[0015] Identifying the pixel group representing the leftmost character column in the image data may include: if the pixel group immediately to the right of the leftmost excluded column group is less than a minimum digital width threshold, then excluding the pixel group, thereby defining the second pixel group to the right of the leftmost excluded column group as the leftmost character column in the image data. This process takes into account (and ignores) the smaller "1" printed between "0" and "2" in many devices that can use the character isolation method.

[0016] Determining whether there are one or two pixel groups representing character columns in the image data may include determining the width of the leftmost excluded column group. The leftmost excluded column group represents the blank space to the left of the leftmost digit group. The width of this area depends on whether the visible digits each include one or two digits.

[0017] If it is determined that the width of the leftmost exclusion column group is less than the maximum left margin threshold, the method may also include determining that there are two pixel groups representing character columns in the image data.

[0018] The method may also include determining a width of a leftmost column of characters in the image data. The method may also include using the determined width of the leftmost column of characters in the image data to determine whether the leftmost column of characters includes only narrow digits or only wide digits. If it is determined that the leftmost column of characters includes only narrow digits, the method may also include setting the maximum effective dose result to "19". Since the digit "1" is significantly different in width from every other digit, it is important for the accuracy of the subsequent OCR process to identify whether the leftmost digit is "1".

[0019] The method may also include excluding any pixel groups that touch the left hand edge of the image.In some cases, there may be a left hand border area that should be identified as not representing character data and should be excluded.

[0020] The method may also include identifying a left hand boundary of the right hand character column by identifying an exclusion column group located between the left hand character column and the right hand character column. The process identifies gaps between digits in a two-digit number. The OCR algorithm may require that each digit be isolated in order to be correctly recognized.

[0021] The method may also include determining whether the left-hand character column is wider than a maximum digit width threshold, and if so, determining that the digits in the image data are within the range of 8 to 10. This may occur when the digit "8" can be seen in the image data above or below the digit "10". In this case, it is difficult to separate the characters into columns. However, by limiting the potential valid results to "8", "9" or "10", an accurate result can still be returned.

[0022] A second aspect of the present invention provides a processor for performing character isolation in an optical character recognition process, the processor being configured to:

[0023] receiving image data representing one or more character strings;

[0024] determining the number of black pixels in each column of the image data;

[0025] defining a vertical separation threshold, the vertical separation threshold being the maximum number of black pixels in a column;

[0026] dividing the columns into different pixel groups and excluded column groups by excluding any column having a number of black pixels below a vertical separation threshold;

[0027] identifying a pixel group representing a leftmost character column in the image data;

[0028] determining whether there are one or two pixel groups representing character columns in the image data; and

[0029] If it is determined that there are two pixel groups representing character columns, a predetermined width value is used for the rightmost character column to identify the right hand boundary of the rightmost character column.

[0030] The processor may be configured to identify the group of pixels representing the leftmost character column in the image data by identifying the group of pixels immediately to the right of the leftmost excluded column group.

[0031] The processor may be configured to determine whether there are one or two groups of pixels representing character columns in the image data by determining the width of the leftmost excluded column group.

[0032] A third aspect of the present invention provides a supplementary device for attachment to an injection device, the supplementary device comprising:

[0033] an imaging assembly configured to capture one or more images present on a movable component of the injection device; and

[0034] A processor according to a second aspect of the present invention.

[0035] Specifically, the present invention relates to the following:

[0036] 1. A method for performing character isolation in an optical character recognition process, the method comprising:

[0037] receiving image data representing one or more character strings;

[0038] determining the number of black pixels in each column of the image data;

[0039] defining a vertical separation threshold, the vertical separation threshold being the maximum number of black pixels in a column;

[0040] dividing the columns into different pixel groups and excluded column groups by excluding any column having a number of black pixels below the vertical separation threshold;

[0041] identifying a pixel group representing a leftmost character column in the image data;

[0042] determining whether there are one or two pixel groups representing character columns in the image data; and

[0043] If it is determined that there are two pixel groups representing character columns, a predetermined width value is used for the rightmost character column to identify the right hand boundary of the rightmost character column.

[0044] 2. The method of claim 1, wherein identifying the pixel group representing the leftmost character column in the image data comprises: identifying the pixel group immediately to the right of the leftmost exclusion column group.

[0045] 3. A method according to item 1, wherein identifying the pixel group representing the leftmost character column in the image data includes: if the pixel group immediately to the right of the leftmost exclusion column group is below a minimum digital width threshold, then excluding the pixel group immediately to the right of the leftmost exclusion column group, thereby defining the second pixel group to the right of the leftmost exclusion column group as the leftmost character column in the image data.

[0046] 4. A method according to any one of items 1 to 3, wherein determining whether there is one or two pixel groups representing character columns in the image data includes: determining the width of the leftmost excluding column group.

[0047] 5. A method according to item 4, wherein if it is determined that the width of the leftmost exclusion column group is below a maximum left margin threshold, it is determined that there are two pixel groups representing character columns in the image data.

[0048] 6. A method according to any one of the preceding items, further comprising determining the width of a leftmost column of characters in the image data.

[0049] 7. The method according to item 6 further comprises using the determined width of the leftmost character column in the image data to determine whether the leftmost character column includes only narrow numerals or only wide numerals.

[0050] 8. A method according to item 7, wherein if it is determined that the leftmost character column only includes narrow digits, the maximum effective dose result is set to "19".

[0051] 9. A method according to any preceding clause, further comprising excluding any group of pixels that touches the left-hand boundary of the image.

[0052] 10. The method according to any of the preceding clauses, further comprising identifying a left-hand boundary of a right-hand character column by identifying an exclusion column group located between a left-hand character column and a right-hand character column.

[0053] 11. A method according to any one of the preceding items, further comprising determining whether the left-hand character column is wider than a maximum digit width threshold, and if so, determining that the digits in the image data are within the range of 8 to 10.

[0054] 12. A processor for performing character isolation in an optical character recognition process, the processor being configured to:

[0055] receiving image data representing one or more character strings;

[0056] determining the number of black pixels in each column of the image data;

[0057] defining a vertical separation threshold, the vertical separation threshold being the maximum number of black pixels in a column;

[0058] dividing the columns into different pixel groups and excluded column groups by excluding any column having a number of black pixels below the vertical separation threshold;

[0059] identifying a pixel group representing a leftmost character column in the image data;

[0060] determining whether there are one or two pixel groups representing character columns in the image data; and

[0061] If it is determined that there are two pixel groups representing character columns, a predetermined width value is used for the rightmost character column to identify the right hand boundary of the rightmost character column.

[0062] 13. A processor according to item 12, wherein the processor is configured to identify the pixel group representing the leftmost character column in the image data by identifying the pixel group immediately to the right of the leftmost exclusion column group.

[0063] 14. A processor according to item 12 or 13, wherein the processor is configured to determine whether there are one or two groups of pixels representing character columns in the image data by determining the width of the leftmost excluded column group.

[0064] 15. An auxiliary device for attachment to an injection device, the auxiliary device comprising:

[0065] an imaging assembly configured to capture one or more digital images present on a movable component of the injection device; and

[0066] A processor according to any one of clauses 12 to 14. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] The accompanying drawings show:

[0068] Figure 1a : Exploded view of the drug delivery device;

[0069] Figure 1b Shows Figure 1a a perspective view of some details of a drug delivery device;

[0070] Figure 2a : according to one aspect of the present invention, releasably attachable to Figure 1a and 1b Schematic diagram of a sensor device for a drug delivery device;

[0071] Figure 2b : releasably attachable to Figure 1a and 1bA perspective view of a sensor device of a drug delivery device;

[0072] Figure 2c : releasably attached to Figure 1a and 1b A perspective view of a sensor device of a drug delivery device;

[0073] Figure 3 : A schematic diagram of a sensor device attached to a drug delivery device, showing components of the sensor device;

[0074] Figure 4 : An example of an image of the dose window after binarization;

[0075] Figure 5 :shows the Figure 4 The result of vertical projection of the image;

[0076] Figure 6 :shows the Figure 4 A result graph of the image data applying the blur function;

[0077] Figure 7 : Apply various thresholds to Figure 4 Results for image data;

[0078] Figure 8 : Dose window An example of an image after binarization, showing small "1"s used to indicate a single unit of medication;

[0079] Fig. 9 : A flowchart showing exemplary operations of a processor according to aspects of the present invention. DETAILED DESCRIPTION

[0080] Hereinafter, embodiments of the present invention will be described with reference to an insulin injection device. However, the present invention is not limited to such applications and can also be deployed with injection devices for injecting other drugs, or with other types of medical devices such as syringes, needle-free injectors and inhalers.

[0081] Figure 1a is an exploded view of an injection device 1 , which may, for example, represent Sanofi's Solostar(R) insulin injection pen.

[0082] Figure 1aThe injection device 1 is a pre-filled disposable injection pen, which comprises a housing 10 and contains an insulin container 14, to which a needle 15 can be fixed. The needle is protected by an inner needle cap 16 and an outer needle cap 17, which in turn can be covered by a cap 18. The dose of insulin injected from the injection device 1 can be selected by turning a dose knob 12, and the selected dose is then displayed by a dose window 13, for example in multiples of so-called international units (IU), where one IU is the biological equivalent of about 45.5 micrograms of pure crystalline insulin (1 / 22 mg). An example of a selected dose displayed in the dose window 13 can be, for example, 30 IU, such as Figure 1a As shown. It should be noted that the selected dose can be displayed in different ways just as well. A label (not shown) is provided on the housing 10. The label includes information about the medicament contained in the injection device, including information identifying the medicament. The information identifying the medicament may be in the form of text. The information identifying the medicament may also be in the form of color. The information identifying the medicament may also be encoded as a barcode, QR code, etc. The information identifying the medicament may also be in the form of a black and white pattern, a color pattern, or a shaded pattern.

[0083] Rotating the dose knob 12 generates a mechanical click sound to provide auditory feedback to the user. The number displayed in the dose window 13 is presented on a sleeve by printing, which is contained in the housing 10 and mechanically interacts with the piston in the insulin container 14. When the needle 15 is inserted into the skin portion of the patient and then the injection button is pushed, the insulin dose displayed in the display window 13 will be injected from the injection device 1. When the needle 15 of the injection device 1 remains in the skin portion for a certain time after pushing the injection button 11, a high proportion of the dose is actually injected into the patient's body. The injection of the insulin dose also causes a mechanical click sound, but the click sound is different from those sounds produced when the dose knob 12 is used.

[0084] Figure 1b A perspective view of the dose button end of the injection device 1 is shown. The injection device has a guide rib 70 located on the housing 10 adjacent to the dose knob 12. The injection device 1 also has two indentations 52 located on the housing 10. They may be symmetrical with respect to the guide rib 70. The guide rib 70 and the indentation 52 are used to fix an auxiliary device (described in detail below) in the correct position on the injection device 1.

[0085] The injection device 1 can be used for several injection sessions until the insulin container 14 is empty or the expiration date of the injection device 1 is reached (eg 28 days after the first use).

[0086] Furthermore, before using the injection device 1 for the first time, it may be necessary to perform a so-called "initial injection" to remove air from the insulin container 14 and the needle 15, for example by selecting two units of insulin and then pressing the injection button 11 while holding the injection device 1 with the needle pointing upwards.

[0087] For the sake of simplicity of presentation, it will be assumed hereinafter by way of example that the expelled dose substantially corresponds to the injected dose, so that, for example, when a dose to be injected next is proposed, this dose is equal to the dose to be expelled by the injection device 1. However, differences (e.g. losses) between the expelled dose and the injected dose may of course be taken into account.

[0088] Figure 1b is a close-up of the end of the injection device 1. The injection device has a guide rib 70 located on the housing 10 adjacent to the dose knob 12. The injection device 1 also has two indentations 52 located on the housing 10. They may be symmetrical with respect to the guide rib 70. The guide rib 70 and the indentation 52 are used to fix the auxiliary device (described in detail below) in the correct position on the injection device 1.

[0089] Figure 2a is releasably attached to Figure 1a A schematic diagram of an embodiment of an auxiliary device 2 of an injection device 1. The auxiliary device 2 comprises a housing 20, the housing 20 having a coupling unit, and the coupling unit is configured to hold Figure 1a The housing 10 of the injection device 1 is attached to the auxiliary device 2 so that the auxiliary device 2 rests tightly against the housing 10 of the injection device 1 but is still removable from the injection device 1 , for example when the injection device 1 is empty and needs to be replaced. Figure 2a is highly schematic, details of the actual arrangement are given below Figure 2b describe.

[0090] The supplemental device 2 contains optical and acoustic sensors for collecting information from the injection device 1. At least part of this information, such as the selected dose (and optionally the unit of this dose) is displayed by a display unit 21 of the supplemental device 2. The dose window 13 of the injection device 1 is blocked by the supplemental device 2 when attached to the injection device 1.

[0091] The auxiliary device 2 also includes at least one user input transducer, which is shown as a button by way of example. These input transducers allow the user to switch the auxiliary device 2 on / off, to trigger an action (e.g., to cause a connection to be established or to pair with another device, and / or to trigger the transfer of information from the auxiliary device 2 to another device), or to confirm something.

[0092] Figure 2b is releasably attached to Figure 1aSchematic diagram of a second embodiment of an auxiliary device 2 for an injection device 1. The auxiliary device 2 comprises a housing 20 having a coupling unit configured to hug the housing 10 of the injection device 1 of FIG. 1 , so that the auxiliary device 2 rests tightly against the housing 10 of the injection device 1 but is still removable from the injection device 1 .

[0093] The information is displayed by the display unit 21 of the supplementary device 2. The dose window 13 of the injection device 1 is blocked by the supplementary device 2 when the injection device 1 is attached.

[0094] The auxiliary device 2 also includes three user input buttons or switches. The first button 22 is a power on / off button, via which the auxiliary device 2 can, for example, be turned on and off. The second button 33 is a communication button. The third button 34 is a confirmation or OK button. The buttons can be any suitable form of mechanical switches. These input buttons allow the user to turn the auxiliary device 2 on / off, trigger an action (e.g., cause a connection to be established or paired with another device, and / or trigger the transmission of information from the auxiliary device 2 to another device), or confirm something.

[0095] Figure 2c is releasably attached to Figure 1a Schematic diagram of a third embodiment of an auxiliary device 2 of an injection device 1. The auxiliary device 2 comprises a housing 20 having a coupling unit configured to hold the auxiliary device 2. Figure 1a The housing 10 of the injection device 1 is adapted so that the supplemental device 2 rests tightly against the housing 10 of the injection device 1 , but is still removable from the injection device 1 .

[0096] The information is displayed by the display unit 21 of the supplementary device 2. The dose window 13 of the injection device 1 is blocked by the supplementary device 2 when attached to the injection device 1 .

[0097] The auxiliary device 2 also includes a touch-sensitive input transducer 35. It also includes a single user input button or switch. The button is a power on / off button, by which the auxiliary device 2 can, for example, be turned on and off. The touch-sensitive input transducer 35 can be used to trigger an action (e.g., cause a connection to be established with another device or pairing with another device, and / or trigger the transfer of information from the auxiliary device 2 to the other device 100), or to confirm something.

[0098] Figure 3 Shows Figure 2a , 2b or 2c auxiliary device 2 is attached to Figure 1a Schematic diagram of the injection device 1 in a state.

[0099] A plurality of components are housed in a housing 20 of the auxiliary device 2. These components are controlled by a processor 24, which may be, for example, a microprocessor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or the like. The processor 24 executes program code (e.g., software or firmware) stored in a program memory 240, and uses a main memory 241, for example, to store intermediate results. The main memory 241 may also be used to store a log of executed ejections / injections. The program memory 240 may be, for example, a read-only memory (ROM), and the main memory may be, for example, a random access memory (RAM).

[0100] In such Figure 2b In the embodiment shown, the processor 24 interacts with the first button 22, via which the auxiliary device 2 can, for example, be switched on and off. The second button 33 is a communication button. The second button can be used to trigger the establishment of a connection with another device, or to trigger the transmission of information to another device. The third button 34 is a confirmation or OK button. The third button 34 can be used to confirm information presented to the user of the auxiliary device 2.

[0101] In such Figure 2c In the embodiment shown, two of the buttons may be omitted. Instead, one or more capacitive sensors or other touch sensors are provided.

[0102] The processor 24 controls a display unit 21, presently shown as a liquid crystal display (LCD). The display unit 21 is used to display information to a user of the supplemental device 2, for example information about the current settings of the injection device 1 or the next injection to be performed. The display unit 21 may also be implemented as a touch screen display, for example for receiving user input.

[0103] The processor 24 also controls an optical sensor 25, which is represented as an optical character recognition (OCR) reader, capable of capturing an image of the dose window 13 in which the currently selected dose is displayed (by means of numbers, characters, symbols or glyphs presented on the sleeve 19 installed in the injection device 1, which numbers, characters, symbols or glyphs can be seen through the dose window 13). The OCR reader is also capable of recognizing characters (such as numbers) from the captured image and providing this information to the processor 24. Alternatively, the unit in the supplementary device 2 may be only an optical sensor, such as a camera, for capturing an image and providing information about the captured image to the processor 24. The processor 24 is then responsible for performing OCR on the captured image. The processor 24 may be configured to perform more than two different OCR processes, each using a different algorithm.

[0104] The processor 24 also controls a light source such as a light emitting diode (LED) 29 to illuminate the dose window 13, in which the currently selected dose is displayed. A diffuser may be used in front of the light source, such as a diffuser made of a piece of acrylic glass. In addition, the optical sensor may include a lens system, such as including two aspherical lenses, resulting in magnification. The magnification (image size to object size ratio) may be less than 1. The magnification may be in the range of 0.05 to 0.5. In one embodiment, the magnification may be 0.15.

[0105] The processor 24 also controls a photometer 26, which is configured to determine an optical property, such as a color or a shadow, of the housing 10 of the injection device 1. The optical property may only exist in a specific portion of the housing 10, such as the color or color coding of the sleeve 19 or insulin container included in the injection device 1, which color or color coding may be seen, for example, through another window in the housing 10 (and / or in the sleeve 19). The information about the color is then provided to the processor 24, which may then determine the type of injection device 1 or the type of insulin contained in the injection device 1 (e.g., SoloStar Lantus with purple and SoloStar Apidra with blue). Alternatively, a camera unit may be used instead of the photometer 26, and an image of the housing, sleeve or insulin container may then be provided to the processor 24 to determine the color of the housing, sleeve or insulin container by image processing. In addition, more than one light source may be provided to improve the reading of the photometer 26. The light source may provide light of a specific wavelength or spectrum to improve the color detection of the photometer 26. The light source may be arranged in a manner such as to avoid or reduce undesirable reflections through the dosage window 13. In an example embodiment, instead of or in addition to the photometer 26, a camera unit may be deployed to detect a code (e.g. a barcode, which may be, for example, a one-dimensional or two-dimensional barcode) associated with the injection device and / or the medicament contained therein. The code may, for example, be located on the housing 10 or on a medicament container contained in the injection device 1, to name just a few examples. The code may, for example, indicate the type of injection device and / or medicament, and / or other properties (e.g., expiration date).

[0106] The processor 24 also controls (and / or receives signals from) an acoustic sensor 27 that is configured to sense sounds produced by the injection device 1. Such sounds may be produced, for example, when a dose is dialed by rotating the dose knob 12 and / or when a dose is expelled / injected by pressing the injection button 11, and / or when a pre-injection is performed. These actions are mechanically similar, but still make different sounds (the same is true for electronic sounds indicating these actions). The acoustic sensor 27 and / or the processor 24 may be configured to distinguish between these different sounds, for example to be able to safely identify that an injection has occurred (rather than just an initial injection).

[0107] The processor 24 also controls an acoustic signal generator 23, which is configured to generate an acoustic signal that may, for example, be related to an operating state of the injection device 1, for example as feedback to a user. For example, an acoustic signal may be emitted by the acoustic signal generator 23 as a reminder of the next dose to be injected, or as a warning signal, for example in case of misuse. The acoustic signal generator may, for example, be implemented as a buzzer or a speaker. In addition to or as an alternative to the acoustic signal generator 23, a tactile signal generator (not shown) may also be used to provide tactile feedback, for example by vibration.

[0108] Processor 24 controls wireless unit 28, and wireless unit 28 is configured to send information to another device in a wireless manner, and / or receive information from another device. This transmission can be based on radio transmission or optical transmission, for example. In certain embodiments, wireless unit 28 is a Bluetooth transceiver. As an alternative, wireless unit 28 can be replaced or supplemented by a wired unit, which is configured to send information to another device in a wired manner, for example via a cable or optical fiber connection, and / or receive information from another device. When sending data, the unit of the transmitted data (value) can be defined explicitly or implicitly. For example, in the case of insulin dosage, international units (IU) can be used generally, or the unit used can be clearly transmitted, for example, in coded form.

[0109] The processor 24 receives input from a pen detection switch 30 which is operable to detect the presence of a pen, ie whether a supplemental device 2 is connected to the injection device 1. A battery 32 provides power to the processor 24 and other components via a power supply 31 .

[0110] Figure 3 The supplementary device 2 is thus able to determine information related to the condition and / or use of the injection device 1. This information is displayed on the display unit 21 for use by a user of the device. This information may be processed by the supplementary device 2 itself, or may be provided at least in part to another device (e.g. a blood glucose monitoring system).

[0111] The injection device 1 and supplemental device 2 are configured such that the field of view of the optical sensor 25 is substantially centrally located over the centre of the dose window 13. Manufacturing tolerances may mean that the field of view is slightly off-centre in both the lateral and vertical directions.

[0112] In some embodiments, due to space limitations and the need to limit the number to a certain size, only even numbers are printed on the number sleeve 19. In some other embodiments, only odd numbers can be printed on the number sleeve. However, any number of units of medicament can be dialed into the injection device 1. In some alternative embodiments, each number, i.e., an increasing integer, can be printed on the sleeve. In these embodiments, half-unit doses can be dialed into the injection device. The injection device can be limited to dialing a maximum of 80 units of dose. In other alternative embodiments, only every third number, every fourth number, or every fifth number can be printed. The dosage positions between the printed numbers can be marked with scale lines. The term "printed" is used herein to indicate that the number is marked on the surface of the number sleeve, but those skilled in the art will understand that the number can be printed, etched, marked, affixed, or visible to the optical sensor 25 of the auxiliary device 2 in a variety of known ways.

[0113] In the following embodiments it will be assumed that only even numbers are printed on the dose sleeve 19, but any number of units may be dialed into the injection device.

[0114] The processor 24 is configured to execute an algorithm that allows the digital numbers (or portions of digital numbers) visible in the field of view of the optical sensor 25 to be separated and prepared for comparison with the stored templates in order to identify these digital numbers. The algorithm performs an optical character recognition (OCR) process on the visible digital numbers and uses the results of the OCR process in order to accurately determine the dose currently dialed into the injection device 1. The algorithm may be implemented in software or firmware and may be stored in the program memory 240 of the supplemental device 2. The processor 24 and the memory 240 storing the algorithm may be referred to herein as a "processor assembly".

[0115] The whole algorithm can be divided into preprocessing part, OCR part and post-processing part, each of which usually contains several steps.

[0116] In the preprocessing section, evaluate and improve the image data quality by performing the following steps:

[0117] Defective and bad pixel correction

[0118] Light correction

[0119] Distortion and tilt correction

[0120] For example, the exposure control algorithm discards pictures that are too bright or too dark, and takes new pictures with adjusted exposure parameters. The numbers may be printed on a bevel to facilitate human identification and location, but may be more easily decoded if the bevel is removed. For the purposes of the invention described and claimed herein, preprocessing is an optional feature. The OCR portion of the algorithm may be designed to perform the desired standard without preprocessing the images, and / or the optical sensor 25 may be configured to produce images of sufficient quality to perform OCR directly on them.

[0121] In the OCR part, the image data is then further processed and at the end the recognized characters can be obtained. The OCR process includes the following steps:

[0122] Binarization

[0123] ·segmentation

[0124] Pattern matching

[0125] Position calculation

[0126] Post-processing may involve various checks and producing results for display. Post-processing includes the following steps:

[0127] Perform integrity checks

[0128] Hysteresis calculation

[0129] Display the final result on the monitor

[0130] The invention described and claimed herein relates to the segmentation portion of the OCR process.For purposes of the invention described and claimed herein, pre-processing, post-processing and other portions of the OCR process are optional features.

[0131] Due to the high reliability requirements for the sensor device 2, in some embodiments there may be two OCR algorithms operating in parallel. The two OCR algorithms have the same input (image) and are intended to provide the same output. They both perform similar steps, however the individual methods used in each step may vary. The two OCR algorithms may differ in one of the binarization, segmentation, pattern matching and position calculation steps or in more than one of these steps. The two OCR parts use different methods to provide the same result, increasing the reliability of the entire algorithm because the data has been processed in two independent ways.

[0132] The key challenge is to implement image capture and the subsequent OCR process, which includes segmentation into a small system that can reliably recognize numbers, characters and / or glyphs from the display to determine the dose value. The system is battery powered, small in size, and has limited imaging and processing capabilities due to compact design and service life requirements. The processor used for this type of device typically has a clock frequency of about 100MHz or less, up to 32kByte RAM and 512kb flash memory (these specifications are exemplary and not intended to be limiting). However, the results of the OCR process should be available in real time, meaning that when the user dials a dose, the dose can be read from the auxiliary device at the same time as the dose is dialed. Typical calculation time is about 70ms.

[0133] Figure 4 An example of an image 400 of the dose window 13 after binarization is shown, wherein a dose of "47" units is dialed in. The solid horizontal line 402 represents the center line of the field of view of the optical sensor 25. The image of the dose window 13 is first captured by the optical sensor 25. After applying the above pre-processing steps, the grayscale image is converted into a pure black and white image by the binarization process. According to the design of the injection pen with dark numbers on a light sleeve, the black and white image will indicate the presence of numbers with black pixels and the absence of numbers with white pixels.

[0134] In some embodiments, a fixed threshold is used to divide between black and white pixels. In the binarized image, pixels with grayscale values ​​equal to or above the threshold become white, and pixels with grayscale values ​​below the threshold become black. A high threshold will result in artifacts (black parts in white areas), while a low threshold has the risk of losing part of the digits in some cases. In some embodiments, the threshold is chosen so that no part of the digits is lost under any circumstances, because the algorithm is robust to artifacts (i.e., an accurate OCR process can be performed in the presence of some artifacts). In tests, a sensor capable of detecting 256 grayscale values ​​was used, and a threshold of 127 showed good results.

[0135] In a proposed algorithm, a segmentation process is then performed, which analyzes the binarized image from right to left. In this process, the right-hand margin is excluded and the location of the right-hand digit column is identified. Then, it is determined whether there is a left-hand digit column. For digits 0-8, there is only one right-hand digit column. Finally, the tick marks at the left-hand side are excluded, leaving only the isolated (one or several) digit columns. The proposed algorithm works well as long as the right-hand digit column is clearly separated from the right-hand margin.

[0136] from Figure 4As can be seen in the diagram, in some cases the digits are moved far enough to the right that the right column of digits merges with the right hand margin. In this case the algorithm will exclude the entire right column of digits and therefore will not correctly identify the dose dialed.

[0137] The algorithm of the present invention analyzes the image data in a different manner so as to correctly isolate the right-hand digit sequence even when the right-hand digit sequence merges with the right-hand boundary, as will now be described.

[0138] The processor 24 first performs a "vertical projection" in which the columns of pixels constituting the binarized image are analyzed. Each column of pixels is analyzed individually and the sum of the number of black pixels in each column is calculated.

[0139] Figure 5 The curve 500 in FIG. Figure 4 The result of this vertical projection of the image 400 in FIG. The original data is then blurred by combining adjacent columns according to the following formula:

[0140] C y =B y-2 +4B y-1 +6B y +4B y+1 +B y+2

[0141] Among them, C y is the blurred projection value, B y is the sum of the black pixels in column 'y'.

[0142] As an alternative, the following formula can be used:

[0143] C y =B y-2 +4B y-1 +8B y +4B y+1 +B y+2

[0144] Figure 6 Curve 600 in FIG. Figure 4 The result of applying a blur function to the image data. This blurring eliminates small disturbances and prevents them from adversely affecting the results of the algorithm. In practice, any formula with a blurring function to eliminate the influence of small disturbances can be used, and the specific formula above is given only as an example.

[0145] The algorithm then separates the columns of pixels into different pixel groups and excludes column groups by using a number of different thresholds, which are shown in uppercase letters below. When the curve is below the VERICAL_SEPARATE_THRESHOLD, the pixels on either side of the curve are assumed to be in different entities and are placed into different pixel groups. The column with the smallest number of black pixels is used as a splitter and is not part of any pixel group.

[0146] When the curve is below VERICAL_WHITESPACE_THRESHOLD, the region is assumed to be empty, i.e. white. After isolating and identifying pixel groups, each pixel group is pruned from both sides by removing columns with less than VERICAL_THRESHOLD black pixels at the edges.

[0147] Figure 7 Applying these thresholds to Figure 4 Resulting image data. The separated pixel groups are identified by shading / hatching and by letters a)-d). Excluded column groups are not shaded.

[0148] In the algorithm proposed previously, if the curve rises above VERTICAL_INVALID_THRESHOLD, the pixel group is marked as invalid, which only occurs when a black vertical line passes through an image that has almost no white pixels, as is the case with the right margin represented by pixel group a). Pixel group a) may also be described as a right-hand edge area or region, a right-hand frame area or region, or a right-hand border area or region in this article, and these terms can be used interchangeably in this article. In this case, "invalid" means that the pixel group is not considered to represent the printed digital number. However, when the gap between pixel group a) and pixel group b) is unclear, that is, the curve is not lower than VERICAL_SEPARATE_THRESHOLD, the previous algorithm excludes pixel group a) and b) together. Because pixel group b) represents the right-hand character column, the algorithm will not correctly identify the digital number in the image. Therefore, the present invention does not use VERTICAL_INVALID_THRESHOLD, but separates pixel group b) from the right-hand border in a different way, as described below.

[0149] The task of the algorithm is to identify groups of pixels representing character columns. Generally speaking, each character column includes more than one character arranged vertically. These characters are separated from each other in subsequent steps. In some embodiments, the algorithm is configured to invalidate the pixel group when it touches the left-hand border of the image (optionally, and when it touches the right-hand border of the image). Similarly, "invalid" as used here means that the pixel group is excluded from consideration as a digital number. This results in pixel group d) being excluded from consideration.

[0150] The algorithm identifies the pixel group that represents the leftmost character column in the image data. This is done by identifying the pixel group that is immediately to the right of the leftmost exclusion column group. For example, this can be accomplished by identifying the first group of pixels (with a higher column number) to the right of the first column that is below the VERICAL_SEPARATE_THRESHOLD. Thus, pixel group c) is identified as representing the leftmost character column.

[0151] Next, the algorithm determines whether there are one or two pixel groups representing character columns in the image data. This is done by determining the width of the leftmost exclusion column group (i.e. Figure 7 The first gap is implemented by excluding the columns between the pixel groups d) and c). If the digits visible in the image (i.e., the digits 0-8) are arranged in a single column, the width of the first gap will be greater than when the image contains two columns of digits. Therefore, if the first exclusion column group is wider than the threshold value MAX_LEFT_MARGIN_TWO_DIGITS, it is determined that the image data includes only a single column of digits. If the first exclusion column group is narrower than the threshold value, it is assumed that there are two character columns.

[0152] In cases where the algorithm determines that there are two groups of pixels in the image that represent character columns, the extent of the right-hand digits can be inferred. Therefore, even if the right-hand digits are merged with the black edge area on the right side of the image, these digits can be isolated for analysis.

[0153] First, the exclusion column group to the right of the leftmost column of characters is identified. In most cases this will be the second exclusion column group from the left side of the image. It will then generally be clear where the left hand border of the right hand column of characters is located (see description below for some special cases). The width (in pixels) of the digits appearing in the image data is known, since the design of the injection device 1 and the auxiliary device 3 means that the optical sensor is located at a predetermined distance from the dose window 13. In one example, the width of each digit except "1" is fourteen pixels, which is seven pixels wide. Each digit may have a height of 26 pixels. However, the exact number of pixels depends on the font size of the digits printed and the type of font used, the sensor device 2 and its arrangement relative to the injection device 1, and any magnification caused by a lens in the sensor device or by the window 13. Continuing with the above example, since only even numbers are printed on the digit sleeve 19, the digit "1" can only appear in the left hand column of characters (digits 10-18), and therefore the right hand column of characters will only contain a width of 14 pixels. Thus, once the left hand boundary of the right hand character column is identified, the right hand boundary is defined to be fourteen pixels further to the right. To increase reliability, the digital width may be set to a number of pixel columns greater than the desired width.

[0154] After the character column is split horizontally into individual digits, an optional digital trimming process can be implemented as follows to take into account the tolerances of the optical system and the printing tolerances of the digits, such as digit width and position. This process can be applied to the left and right edges of any digit, but is particularly useful when applied to the right-hand edge of the right-hand digit to ensure that they are sufficiently separated from the right-hand edge (pixel group a)) for accurate OCR analysis. Therefore, this optional trimming can make OCR recognition more accurate.

[0155] The numbers have been separated into right and left character columns.

[0156] Using the right-hand digit as an example, first perform a vertical projection on the rightmost pixel column of the right-hand character column to determine the number of black pixels in the column. In this example, the expected height of the digit is 26 pixels. For example, if more than 19 of the 26 pixels in the column are black, the column is determined to be most likely part of the pixel group a), rather than part of the digit, and is then discarded. This is particularly important for distinguishing between the digits 6 and 8, respectively, where the black vertical column on the right can easily lead to misunderstanding, i.e., mistaking "6" for "8" in the character recognition step.

[0157] On the other hand, in the case where 6 or fewer pixels in the rightmost pixel column are black, the column can also be discarded, since no OCR step is necessary. Since only even numbers (2, 4, 6, 8) appear in the right-hand character column, there are always more black pixels in the column immediately to the left of the rightmost pixel column. Therefore, discarding the last column has no negative impact on OCR.

[0158] In some injection device designs, a small "1" is used to indicate a single unit of medication. This small 1 is located vertically between the "0" and "2", but offset to the left, such as Figure 8 8. This "1" is less than the 1 for the digit 10-18. In the event that this special case exists, the algorithm has an additional step to recognize this case and ensure that the digit is decoded correctly. This involves calculating the width of the first character column as described above. If this width is below the threshold DIGIT_MIN_ONE_WIDTH, then it is inferred that the column represents Figure 8 . This column is then invalidated and not used in the subsequent OCR and position detection steps. If the first character column is equal to or wider than DIGIT_MIN_ONE_WIDTH, but below the threshold DIGIT_MAX_ONE_WIDTH, then it is inferred that the first character column contains a "normal" 1 (such as the 1 in the digits 10-18). This information is then used in the OCR process by setting the maximum possible valid result to "19".

[0159] Another special case is when "9" units are dialed into the injection device 1. In this case, the digits "8" and "10" appear partially or completely in the image, with the digit "8" being approximately above the gap between the 0 and 1 of the "10". Therefore, the algorithm performs an additional check to see if the left-hand column of characters is wider than a threshold value MAX_DIGIT_WIDTH (too wide to be a single digit). If this is the case, it is inferred that the number sleeve 19 is between the digits 8 and 10. The threshold used to divide the column of characters can then be adjusted accordingly to allow the digits to be isolated for analysis.

[0160] Fig. 9 A flow chart illustrating exemplary operations performed by processor 24 in analyzing images captured by optical sensor 25 is shown.

[0161] In step 900, the processor 24 receives image data from the optical sensor 25. The image data may be binarized data, or the processor 24 may perform a binarization process. Alternatively, the processor may perform the following steps on a grayscale image. In step 902, the processor 24 analyzes the image data to determine the number of black pixels per column in the image. In step 904, a vertical separation threshold is defined. In practice, the threshold may be predefined and preprogrammed into the memory of the auxiliary device. However, it may also be dynamically defined by the processor based on light levels, etc.

[0162] In step 906, processor 24 divides the columns of the image into a number of pixel groups separated by exclusion column groups. This is done by excluding any columns with a number of black pixels below a previously defined vertical separation threshold. In step 908, the processor identifies the pixel group representing the leftmost character column in the image. This is done by identifying the pixel group immediately to the right of the leftmost exclusion column group.

[0163] In step 910, processor 24 determines whether there are one or two groups of pixels representing character columns in the image. This is accomplished by determining the width of the leftmost exclusion column group. If the leftmost exclusion column group is below a predetermined width, then it is assumed that there are two character columns. If the leftmost exclusion column group is above a predetermined width, then it is assumed that there is one character column.

[0164] At step 912, in the case where it is determined that there are two character columns in the image data, a predetermined width value (in pixels) is used for the right-hand character column in the OCR algorithm. This may include determining the left-hand boundary of the right-hand character column by identifying an exclusion column group between the left and right character columns. The right-hand boundary is then defined as further to the right by the predetermined width value (in pixels). After this new vertical segmentation process, the remainder of the OCR algorithm is performed.

[0165] Several further steps are required before the processor 24 can output a result for the number of medicament units dialled into the injection device 1. These steps are described below for completeness, however they are optional and not essential to defining the invention.

[0166] The processor 24 then performs a "horizontal projection" in which the rows of pixels that make up the binarized image are analyzed. This process is performed in the same manner as described above for the vertical projection. The results of the horizontal projection are added to the results of the vertical projection, and the edges of the visible digits are identified. In many cases, some of the digits in the image will be only partially visible. Therefore, not all edges of the partially visible digits are detected. The processor 24 can be pre-programmed with the expected height of the full digit (in pixel rows) and is therefore able to identify the presence of partially visible digits.

[0167] It can be clearly seen that the "horizontal projection" and "vertical projection" can be equally well based on an analysis that instead calculates the sum of white pixels, assuming that the expected number of white pixels in each row and column is known.

[0168] The next step in the OCR process is to select one of the visible digits for decoding and identification. This is achieved by designating one of these digits as the "primary digit row". The primary digit row is selected based on which of the visible digits has the greatest height. This is because all digits printed on the sleeve have approximately the same height, and it can be assumed that the digit with the greatest height will be fully visible and therefore easy to decode with high certainty. If two digits (with different vertical positions) are visible and have the same height, the topmost digit is selected as the primary digit row. The primary digit row is the digit that is subsequently used to determine the dose dialed into the injection device 1.

[0169] A pattern matching process is then performed to identify the numbers in the main number row. Templates for each number can be stored in a memory of the auxiliary device 2, and the identified numbers can then be compared with these templates. In a straightforward approach, pattern matching can be performed on a pixel-by-pixel basis. However, this may require high computing power. In addition, this method is prone to problems with positional changes between the image and the template. In some other embodiments, a feature recognition process is performed. Features can be horizontal lines, vertical lines or diagonals, curves, circles or closed loops, etc. These features can be identified in the image of the selected number and compared with the template.

[0170] In other embodiments, the pattern matching algorithm can be based on a vector comparison process. For example, the template can be in vector form, describing the position and length of each row of black pixels (continuous continuation) relative to a vertical line extending through the center of the template. Each digital binary image captured can be similarly converted into a vector and compared with each stored template in turn to find the best match.

[0171] When the vector of the captured image is compared to a particular digital template, any deviation results in a penalty for the likelihood of a match between the image and the template. The magnitude of the penalty may depend on the number of black pixels missing or extra in the image compared to the template. After the digital image is compared to each template and all penalties have been applied, a decision is made as to which digit is present. Under good optical conditions, the correct template will have a very low penalty, while all other templates will have a high penalty. If the main digit row consists of two digits, the process is performed for both digits, and the processor 24 then combines the results to produce the final result for the digital number.

[0172] There may be special measures for certain digits. For example, "1" deviates significantly from all other digits in width, leading to common false detections. To address this, if the binarized image of a digit is wider than the expected width of "1", it receives an additional detection penalty when compared to the stored vector template "1".

[0173] In some exceptional cases, if the confidence level of the main digit row pattern match result is below a certain threshold (e.g., 99%), the processor may perform a second pattern matching process on one or more other visible or partially visible digits. Since the sequence of the digits is known, this second pattern match can be used as a check that the first pattern match returned the correct result. If the confidence level in the result is still not high enough, a second image can be captured by the optical sensor 25 and the process repeated. Alternatively, an error message can be displayed.

[0174] Once the number or numbers of the main number row have been successfully identified, a weighting function is applied in order to determine the dose dialed into the injection device 1. In order to formulate the weighting function, the vertical position of the main number row relative to the center of the image is determined. This can be done by calculating the deviation of the middle pixel row including the main number row relative to the pixel row representing the center line of the image in the optical sensor 25.

[0175] For example, in some embodiments, the optical sensor comprises a rectangular 64×48 array of photosensitive elements. The resulting binarized image is an array of pixels having these same dimensions. The 24th and / or 25th pixel row can be designated as the center row of the image. The position of the middle pixel row comprising the main digit row is determined. The deviation between the middle pixel row comprising the main digit row and the center row (or several center rows) of the image is then calculated in pixel rows. This deviation can be positive or negative, depending on the direction of the deviation. The deviation is converted into a fraction by dividing the deviation by the distance between consecutive digits (in pixel rows) before being applied accordingly to the determined digital code. Thus, the deviation allows the rotational position of the digital code relative to the sensor to be determined. If the center pixel row of the main digit row is the same as the center pixel row of the image, the deviation is zero and the position is equal to the main digit row number. However, due to manufacturing tolerances in the auxiliary device 2 and / or in the injection device 1 and due to the pressure applied by the user on the digital sleeve, some deviation may exist in most code cases.

[0176] The distance between consecutive numbers printed on the number sleeve is constant because the numbers represent doses associated with discrete mechanical movements of the injection device mechanism. Therefore, the distance (in pixel rows) between consecutive numbers in the captured image should also be constant. The expected height of the numbers and the spacing between numbers are pre-programmed into the algorithm.

[0177] As an example, the expected height of each digit may be 22 pixels, and the expected height of the interval between digits may be 6 pixels. Thus, the distance between the center pixel rows of consecutive digits will be 28 pixels.

[0178] Continuing with the example, if the rows of pixels are numbered sequentially from the top to the bottom of the image, the application of the weighting function can be defined mathematically as:

[0179] Position = Main digit row number + [2 x deviation / (expected height of digit + expected height of interval)]

[0180] Wherein, deviation amount = center image row number - main digital row center row number

[0181] Therefore, if the main number line is in the upper half of the image, the deviation is positive, and if the main number line is in the lower half of the image, the deviation is negative. For example, if the number displayed in the main number line is "6" and the deviation is zero, the calculated position will be:

[0182] Position = 6 + [2 × 0 / (28)] = 6

[0183] Therefore, a result of "6" is returned as expected.

[0184] Considering another example where 75 units are dialed into the injection device 1, if the top digit "74" is selected as the primary digit row and there is a positive deviation of 11 pixel rows according to the above equation, and again assuming a combined digit / space height of 28 pixels, the calculated position would be:

[0185] Position = 74 + [2 × 11 / (28)] = 74.79

[0186] The result is then rounded to the nearest integer to give a position determination of "75" as expected.

[0187] After applying the final post-processing portion, the processor 24 causes the result to be displayed on the display unit 21 of the supplemental device 2. As previously mentioned, due to space limitations, not every number can be printed on the digital sleeve. In some embodiments, only even numbers are printed on the digital sleeve. The above-mentioned position determination step allows the supplemental device 2 to display dose values ​​even though these values ​​may not appear on the digital sleeve. Thus, a clearer indication of the dialed dose is provided to the user of the supplemental device 2.

[0188] If the user is dialing a dose slowly (i.e., slowly turning the dose knob 12), the above position rounding may cause the display to flicker between two digits. To prevent this, the post-processing step may include a hysteresis rule so that the displayed digit depends to some extent on the previously displayed digit. This hysteresis calculation may be the last step performed in the algorithm before displaying the result.

[0189] Those skilled in the art will appreciate that the above weighting function and position determination represent only one example, and many other calculation methods can be used to obtain the same result. Those skilled in the art will also appreciate that the above mathematical calculations can be modified and improved to shorten the calculation time. Therefore, the exact form of the weighting function code is not necessary.

[0190] The algorithm can also be configured to perform other types of manipulations on the image digits, such as changing the size of more than one digit, cropping digits to defined pixel areas, and cropping digits printed in italics to an upright position. These operations can be performed before pattern matching comparisons with stored templates. Alternatively, these operations can be performed in an image preprocessing step on the captured image before the binarization process. Additional shading, distortion, and exposure corrections can also be performed.

Claims

1. A method for performing character isolation in an optical character recognition process, the method include: receiving image data representing one or more character strings; determining the number of black pixels in each column of the image data; defining a vertical separation threshold, the vertical separation threshold being the maximum number of black pixels in a column; dividing the columns into different pixel groups and excluded column groups by excluding any column having a number of black pixels below the vertical separation threshold; Identifying a pixel group representing a leftmost character column in the image data, further comprising: Identify the leftmost group of excluded columns; determining that the group of pixels immediately to the right of the leftmost exclusion column group is below a minimum digital width threshold; and The pixel group immediately to the right of the leftmost exclusion column group is excluded.

2. The method of claim 1, comprising determining a second pixel group to the right of a leftmost exclusion column group as a leftmost character column in the image data.

3. A method according to claim 1 or 2, comprising determining whether there are one or two pixel groups representing character columns in the image data.

4. The method of claim 3, wherein determining whether there are one or two pixel groups representing character columns in the image data comprises determining a width excluding a leftmost column group.

5. The method of claim 4, wherein if it is determined that the width of the leftmost excluded column group is lower than a maximum left margin threshold, it is determined that there are two pixel groups representing character columns in the image data.

6. The method according to claim 1 or 2, further comprising determining a width of a leftmost character column in the image data.

7. The method of claim 6, further comprising using the determined width of the leftmost character column in the image data to determine whether the leftmost character column includes only narrow numerals or includes wide numerals.

8. The method of claim 7, wherein if it is determined that the leftmost character column includes only narrow digits, the maximum effective dose result is set to "19".

9. The method of claim 1 or 2, further comprising excluding any group of pixels that touches a left-hand boundary of the image.

10. The method of claim 1 or 2, further comprising identifying a left-hand boundary of a right-hand character column by identifying an exclusion column group located between the left-hand character column and the right-hand character column.

11. The method according to claim 1 or 2, further comprising determining whether the left-hand character column is wider than a maximum digit width threshold, and if so, determining that the digits in the image data are in the range of 8 to 10.

12. A processor for performing character isolation in an optical character recognition process, the processor being configured to: receiving image data representing one or more character strings; determining the number of black pixels in each column of the image data; defining a vertical separation threshold, the vertical separation threshold being the maximum number of black pixels in a column; dividing the columns into different pixel groups and excluded column groups by excluding any column having a number of black pixels below the vertical separation threshold; The pixel group representing the leftmost character column in the image data is identified by: Identify the leftmost exclusion column group; determining that the group of pixels immediately to the right of the leftmost exclusion column group is below a minimum digital width threshold; and The pixel group immediately to the right of the leftmost exclusion column group is excluded.

13. The processor according to claim 12, in, The processor is configured to determine a second pixel group to the right of a leftmost excluded column group as a leftmost character column in the image data.

14. The processor according to claim 12, in, The processor is configured to determine whether one or two pixel groups representing character columns are present in the image data.

15. The processor according to claim 14, in, The processor is configured to determine whether there are one or two pixel groups representing character columns in the image data by determining the width of the leftmost excluded column group.

16. The processor according to claim 15, in, In response to determining that the width of the immediately leftmost excluded column group is below the maximum left margin threshold, it is determined that there are two pixel groups representing character columns in the image data.

17. An auxiliary device for attachment to an injection device, the auxiliary device include: an imaging assembly configured to capture one or more digital images present on a movable component of the injection device; as well as A processor as claimed in any one of claims 12 to 16.

Citation Information

Patent Citations

  • Device and method for determining information related to a medical device

    WO2011117212A1