Image acquisition method, device, terminal and storage medium

By performing binarization and expansion algorithm processing on the image, light spot detection is simplified, the problem of complex light spot detection and large calculation amount in the existing technology is solved, and the processing efficiency of the mobile terminal is improved.

CN109508713BActive Publication Date: 2024-10-18PING AN TECH (SHENZHEN) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN201811518644.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-12-12
Publication Date
2024-10-18
Estimated Expiration
2038-12-12

AI Technical Summary

Technical Problem

The light spot detection method in the existing technology is complex and requires a large amount of calculation, which affects the image processing efficiency. It is especially difficult to effectively deal with the effect of light spots on mobile terminals.

Method used

By performing binarization and dilation algorithm processing on the image, the range of the light spot area is obtained and its proportion to the image area is calculated to determine whether it is greater than the preset threshold. If so, a prompt message is sent to adjust the shooting.

Benefits of technology

It simplifies the spot detection process, reduces the amount of calculation, improves the processing efficiency of the terminal, and is suitable for the popular use of mobile terminals such as mobile phones.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN109508713B_ABST
    Figure CN109508713B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image matching technology. The present invention provides an image acquisition method, device, terminal and storage medium. The method comprises acquiring a picture of a target object that needs to be recognized by OCR; performing binarization and expansion algorithm processing on the picture in turn to obtain the range of a light spot area in the picture, and calculating the light spot ratio of the light spot area to the area of ​​the picture; judging whether the light spot ratio is greater than a preset ratio threshold, and if so, sending a preset prompt message. The present invention avoids the problems of complex technology and large amount of calculation, and improves the processing efficiency of the terminal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an image acquisition method, device, terminal and storage medium. Background Art

[0002] With the popularity of smart devices with camera functions, people are increasingly accustomed to recording or preserving materials by taking photos, especially for text records, to avoid copying word for word and affecting the recording speed. However, in the process of taking photos, they will be affected by the environment or the flash of the device, forming light spots on the picture, covering the effective content of the picture and affecting the recognition of the corresponding area. Therefore, using the light spot detection of the picture can improve the image quality.

[0003] In the traditional spot detection method, the original image needs to be converted into RGB color mode as the target image. The technology involved is complex and requires too much calculation. Summary of the invention

[0004] In order to overcome the above problems, especially the problems of complex technology and large amount of calculation in the prior art, the following technical solutions are proposed:

[0005] In a first aspect, the present invention provides a method for obtaining an image, comprising the following steps:

[0006] Get the image of the target object that needs OCR recognition;

[0007] The image is processed by binarization and expansion algorithm in sequence to obtain the range of the light spot area in the image, and the proportion of the light spot area in the image is calculated;

[0008] Determine whether the spot ratio is greater than a preset ratio threshold, and if so, send a preset prompt message.

[0009] In one embodiment, the step of sequentially performing binarization and dilation algorithm processing on the image to obtain the range of the light spot area in the image includes:

[0010] Acquire the image, and perform binarization processing on the image by setting a threshold value to obtain a binary image in which the light spot area is converted into a first white area;

[0011] Using the dilation algorithm, the distribution of the second white area processed by the dilation algorithm is obtained.

[0012] In one embodiment, the step of calculating the ratio of the light spot area to the image area includes:

[0013] Get the range of the second white area;

[0014] The area of ​​the second white area is calculated to obtain the light spot ratio of the light spot area range to the image area.

[0015] In one embodiment, the step of obtaining the range of the second white area includes:

[0016] Get the pixel values ​​of all pixels of the image;

[0017] Obtaining a pixel point having a large gradient change in the pixel value;

[0018] The pixel points are connected to form a closed curve to obtain the range of the second white area.

[0019] In one embodiment, the step of calculating the area of ​​the second white area comprises:

[0020] Get the range of the second white area;

[0021] Obtaining the area of ​​the minimum circumscribed rectangle of the second white area using the image coordinates;

[0022] The area of ​​the second white area is calculated according to the area of ​​the minimum circumscribed rectangle.

[0023] In one embodiment, the step of obtaining the area of ​​the second white area according to the area of ​​the minimum circumscribed rectangle includes: S=k×S 1

[0024] Where S is the area of ​​the second white area, k is the area ratio of the largest inscribed circle of the smallest circumscribed rectangle, S 1 is the area of ​​the minimum circumscribed rectangle of the second white area.

[0025] In one embodiment, before the step of sequentially performing binarization and dilation algorithm processing on the image to obtain the light spot area range in the image, and calculating the ratio of the area range where the light spot exists to the light spot ratio of the image, the step further includes:

[0026] The effective content area of ​​the picture is identified by using a pre-trained image recognition model to obtain the effective content area in the picture.

[0027] In a second aspect, the present invention provides a picture acquisition device, comprising:

[0028] The acquisition module is used to obtain the captured images of the target object that needs OCR recognition;

[0029] A light spot calculation module is used to perform binarization and expansion algorithm processing on the image in sequence to obtain the light spot area range in the image, and calculate the light spot ratio of the light spot area range to the area of ​​the image;

[0030] The determination module is used to determine whether the light spot ratio is greater than a preset ratio threshold, and if so, send a preset prompt message.

[0031] In a third aspect, the present invention provides a terminal, comprising:

[0032] one or more processors;

[0033] Memory;

[0034] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to: execute the image acquisition method described in any one of the above embodiments.

[0035] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the image acquisition method described in any one of the above embodiments is implemented.

[0036] The above-mentioned image acquisition method, device, terminal and storage medium pre-process the image of the target object that needs OCR recognition according to the binarization and expansion algorithm, highlight the light spot area, thereby obtaining the distribution and area of ​​the light spot area, and finally determine whether it is necessary to send a preset prompt information to the image, thereby avoiding the technical complexity and large amount of calculation caused by the need to convert the original image into RGB color mode as the target image in the prior art, improving the processing efficiency of the terminal, and making the solution of the present invention easier to popularize and use in mobile terminals such as mobile phones.

[0037] Additional aspects and advantages of the present invention will be given in part in the following description, which will become obvious from the following description, or may be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0039] Figure 1 This is a flow chart of a method for obtaining a picture in one embodiment of the present invention;

[0040] Figure 2 A schematic diagram of a picture acquisition device according to an embodiment of the present invention;

[0041] Figure 3The figure is a schematic diagram of the structure of a terminal according to an embodiment of the present invention. DETAILED DESCRIPTION

[0042] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.

[0043] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.

[0044] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as herein.

[0045] It will be understood by those skilled in the art that the "terminal" and "terminal device" used herein include both devices with wireless signal receivers, which are devices with only wireless signal receivers without transmission capabilities, and devices with receiving and transmitting hardware, which are devices with receiving and transmitting hardware capable of performing two-way communications on a two-way communication link. Such devices may include: cellular or other communication devices, which have a single-line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service), which may combine voice, data processing, fax and / or data communication capabilities; PDA (Personal Digital Assistant), which may include a radio frequency receiver, a pager, Internet / intranet access, a web browser, a notepad, a calendar and / or a GPS (Global Positioning System) receiver; conventional laptop and / or palmtop computers or other devices, which have and / or include a conventional laptop and / or palmtop computer or other device with and / or including a radio frequency receiver. The "terminal" or "terminal device" used herein may be portable, transportable, installed in a vehicle (air, sea and / or land), or adapted and / or configured to operate locally, and / or in a distributed form, at any other location on the earth and / or in space. The "terminal" or "terminal device" used herein may also be a communication terminal, an Internet terminal, a music / video playing terminal, such as a PDA, a MID (Mobile Internet Device) and / or a mobile phone with a music / video playing function, or a smart TV, a set-top box and other devices.

[0046] Those skilled in the art can understand that the remote network device used here includes but is not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud consisting of a plurality of servers. Here, the cloud is composed of a large number of computers or network servers based on cloud computing, wherein cloud computing is a type of distributed computing, a super virtual computer consisting of a group of loosely coupled computer sets. In the embodiments of the present invention, the remote network device, the terminal device and the WNS server can communicate through any communication method, including but not limited to mobile communications based on 3GPP, LTE, WIMAX, computer network communications based on TCP / IP, UDP protocols, and short-range wireless transmission methods based on Bluetooth and infrared transmission standards.

[0047] refer to Figure 1 As shown, Figure 1 A method for obtaining a picture in an embodiment includes the following steps:

[0048] S110, obtaining a picture of a target object that needs OCR recognition.

[0049] OCR (Optical Character Recognition) needs to first obtain the valid content of the object to be recognized. Before recognition, a common method is to obtain an image of the target object that needs to be recognized by OCR by shooting. At present, due to the popular use of mobile terminals, in many usage scenarios, mobile terminals such as mobile phones are usually used to shoot and obtain pictures, and the pictures are used as the basis for OCR recognition. However, when taking pictures, the imaging quality of the picture is usually affected by light factors. The most common one is that the image of the ambient light will form one or more light spots on the picture. If the light spot covers the effective content of the picture, the OCR recognition of the picture, especially the recognition effect of the text content, will be reduced. Therefore, before OCR recognition, it is necessary to perform light spot detection on the picture to ensure the quality of the subsequent OCR recognition effect.

[0050] In this step, the target object is a physical carrier of the content that needs to be OCR recognized, such as books, papers, photos, glass, wood boards, cloth and other materials that record the content that needs to be OCR recognized. The material can be flat or non-flat (such as curved or folded), as long as the content that needs to be OCR recognized can be clearly displayed in the acquired image.

[0051] The picture is a picture of the area on the target object where the OCR content is recorded. The picture can be a picture taken by a user by pressing a shooting key of a terminal, such as a shooting key on a mobile phone (such as a virtual shooting key on a smartphone in a shooting interface, or a physical shooting key) or a shutter in a camera. When the user presses the shooting key or shutter, a picture after the shooting is completed is formed on the memory of the terminal. The picture can also be image information obtained for a real-time preview interface, such as image information obtained in a preview or focus stage before shooting. For the real-time preview interface, the image information obtained can be processed frame by frame or at predetermined intervals / frames.

[0052] , S120, sequentially perform binarization and expansion algorithm processing on the image to obtain the light spot area range in the image, and calculate the light spot ratio of the light spot area range to the area of ​​the image.

[0053] This step mainly processes the image generated in the terminal to highlight the light spot area in the image, so as to facilitate calculation of the range of the light spot area to evaluate its impact on OCR recognition.

[0054] In processing the image generated in the terminal, the image is first binarized to form a binary image with only black and white colors, so as to remove color interference and highlight the area of ​​the light spot. Since the brightness of the light spot area is relatively large, the light spot area is a white area in the binary image. In this embodiment, the white area of ​​the binary image is defined as the first white area.

[0055] Then, the dilation algorithm is used on the binary image to expand the first white area, so that the similar first white areas form a whole, and the small first white areas are reduced, so that the white areas on the picture are integrated from the original scattered areas to relatively concentrated large white areas. In this embodiment, the white area processed by the dilation algorithm is positioned as the second white area. Since the second white area is a relatively concentrated large white area, compared with the first white area, the amount of calculation for calculating the range of the second white area will be relatively small, thereby reducing the amount of calculation of the terminal and not affecting the running speed of other programs.

[0056] As an embodiment, the binary image is obtained by setting a threshold value, and the threshold value is used to highlight the light spot area, that is, in the generated binary image, only the light spot area is converted into a white area, and the other parts are converted into a black area. The threshold value can be an empirical value, or a reference value obtained through training according to different environments, or a threshold value obtained by further calculating the grayscale value of each pixel point of the image by obtaining the grayscale value of each pixel point. The calculation method is specifically to obtain the grayscale value of each pixel point in the original image, form a histogram about the grayscale value, and then obtain the maximum variance value from the histogram. The grayscale value corresponding to the maximum variance value is the threshold value. In the formed binary image, the area less than the threshold value is a black area, and the area greater than the threshold value is a white area, that is, the light spot area.

[0057] According to the distribution of the second white area obtained in the above embodiment, the range of the second white area is obtained, and the area of ​​the second white area is further calculated, so as to obtain the ratio of the area range of the light spot on the picture to the light spot of the picture.

[0058] As an embodiment, the range of the second white area can be calculated by a contour detection algorithm. Specifically, the pixel values ​​of all pixels on the image are obtained. Since the gradient of the pixel values ​​between the black and white areas of the image processed by the binarization and dilation algorithm, that is, the boundary between the two, is relatively large, the pixel points from which the pixel values ​​are obtained with a large gradient can be identified as the boundary of the second white area. The above-obtained pixel points are connected into a closed curve to obtain the range of the second white area.

[0059] In order to further reduce the amount of computation for detecting the spot size, the minimum bounding rectangle of the second white area is obtained by using the image coordinates, and the area of ​​the minimum bounding rectangle is obtained by the following formula:

[0060] S 1 =(X max -X min )×(Y max -Y min ) (1)

[0061] Among them, S 1 is the area of ​​the minimum circumscribed rectangle of the second white area, X max is the maximum value of the minimum bounding rectangle on the x-axis of the image coordinate system, X min is the minimum value of the minimum bounding rectangle on the image coordinate x-axis, Y max is the maximum value of the minimum bounding rectangle on the y-axis of the image coordinate system, Y min is the minimum value of the minimum bounding rectangle on the y-axis of the image coordinate system.

[0062] Since the second white area does not occupy the entire space of the minimum circumscribed rectangle, in order to more accurately obtain the area S of the second white area, the area ratio k of the largest inscribed circle of the minimum circumscribed rectangle, such as 0.8, can be used to obtain the area S of the second white area. 1 , as shown in the following formula:

[0063] S=k×S 1 (2)

[0064] Regarding the step of obtaining the range of the second white area, when the second white area is within the boundary range of the image, according to the object type of the image, the pre-set image recognition model obtains that the second white area is within the blank area of ​​the image, that is, the light spot does not affect the OCR recognition of the image, and there is no need to re-shoot. If the object type is a file, the acquired image is the entire page of the file. Since files usually have blank areas around their edges, if the range of the second white area is within the blank area in the image recognition model, then the light spot does not affect the OCR recognition of the file, and there is no need to re-shoot. As an embodiment, before step S120, a pre-trained image recognition model can also be used to identify the effective content area of ​​the image to obtain the effective content area in the image.

[0065] For example, in the file of the photographed object of the picture, in order to avoid comparing the second white area with the blank area, it is directly determined whether the picture needs to be retaken by judging the area ratio of the light spot. According to the type of the photographed object, the effective content area of ​​the picture is identified using the image recognition model pre-trained for the object, and the area of ​​effective content in the picture of the object is obtained. According to the proportion of the second white area in the picture, it is determined whether the light spot ratio is greater than the set ratio threshold. If so, it is prompted to retake the picture.

[0066] S130, determining whether the light spot ratio is greater than a preset ratio threshold, and if so, sending a preset prompt message.

[0067] In this step, the preset prompt information can be based on different ways of obtaining pictures by users, and corresponding prompt information is given according to the settings.

[0068] For the pictures that have been taken, if the spot ratio obtained after processing in step S120 is greater than the set ratio threshold, then a prompt is given to retake the picture. In the case of image information obtained in the real-time preview interface, the focus or preview function of the terminal can be used to pre-focus or preview the photographed object, so as to pre-estimate the proportion of the spot in the picture before shooting. If it is greater than the set ratio threshold, the current focus shooting can be abandoned, and the object can be photographed again after readjustment; or, when it is detected that the spot ratio is greater than the preset ratio threshold, a prompt can be directly given to pay attention to the spot influence, so as to prompt the user to make corresponding adjustments to reduce the spot area; or, based on the acquired spot position information, the direction of the light causing the spot is pre-judged through auxiliary adjustment methods such as coordinate models, and the user is guided to adjust the angle and distance between the terminal and the target object according to the coordinate model, and the corresponding adjustment coordinate information can be used for prompting. The prompt information can further be prompt information when the user adjusts the terminal to the preset angle and distance.

[0069] The present invention provides a method for acquiring an image, which pre-processes an image of a target object that needs to be OCR-recognized according to a binarization and expansion algorithm, highlights the light spot area, thereby obtaining the distribution and area of ​​the light spot area, and finally determines whether it is necessary to send a preset prompt message to the image, thereby avoiding the technical complexity and large amount of calculation caused by the need to convert the original image into an RGB color mode as a target image in the prior art, improving the processing efficiency of the terminal, and making the solution of the present invention easier to popularize and use in mobile terminals such as mobile phones.

[0070] Based on the same inventive concept as the above-mentioned image acquisition method, the embodiment of the present invention also provides an image acquisition device, such as Figure 2 As shown, including:

[0071] An acquisition module 210 is used to acquire a photograph of a target object that needs OCR recognition;

[0072] The light spot calculation module 220 is used to perform binarization and expansion algorithm processing on the image in sequence to obtain the light spot area range in the image, and calculate the light spot ratio of the light spot area range to the area of ​​the image;

[0073] The determination module 230 is used to determine whether the light spot ratio is greater than a set ratio threshold, and if so, send a preset prompt message.

[0074] The light spot calculation module 220 may further execute:

[0075] Acquire the image, and perform binarization processing on the image by setting a threshold value to obtain a binary image in which the light spot area is converted into a first white area;

[0076] Using the dilation algorithm, the distribution of the second white area processed by the dilation algorithm is obtained.

[0077] Further, the range of the second white area is obtained; the area of ​​the second white area is calculated to obtain the ratio of the area where the light spot exists to the light spot of the picture.

[0078] The present invention provides a picture acquisition device, and pre-processes the picture acquired by the acquisition module 210 according to the binarization and expansion algorithm through the spot calculation module 220, highlights the spot area, thereby obtaining the distribution and area of ​​the spot area, and finally determines whether it is necessary to send the preset prompt information to the picture through the judgment module 230, thereby avoiding the technical complexity and large amount of calculation caused by the need to convert the original picture into the RGB color mode as a target recognition picture in the prior art, thereby improving the processing efficiency of the terminal and making the solution of the present invention easier to be popularized and used in mobile terminals such as mobile phones.

[0079] In another embodiment, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the image acquisition method described in the above embodiment is implemented. Wherein, the computer-readable storage medium includes but is not limited to any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (EraSable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or optical card. That is, the storage device includes any medium that can store or transmit information in a readable form by a device (for example, a computer, a mobile phone), which can be a read-only memory, a disk or an optical disk, etc.

[0080] A computer-readable storage medium provided by an embodiment of the present invention can realize obtaining a picture of a target object that needs to be recognized by OCR; performing binarization and expansion algorithm processing on the picture in turn to obtain the range of the light spot area in the picture, and calculating the light spot ratio of the light spot area to the area of ​​the picture; judging whether the light spot ratio is greater than a preset ratio threshold, and if so, sending a preset prompt message. The present invention provides a picture acquisition method, pre-processes the picture of the target object that needs to be recognized by OCR according to the binarization and expansion algorithm, highlights the light spot area, thereby obtaining the distribution and area of ​​the light spot area, and finally judges whether it is necessary to send the preset prompt information to the picture, thereby avoiding the technical complexity caused by the need to convert the original picture into RGB color mode as a target recognition picture in the prior art. The problem of large amount of calculation is solved, and the processing efficiency of the terminal is improved, so that the solution of the present invention is easier to be popularized and used in mobile terminals such as mobile phones.

[0081] The computer-readable storage medium provided in the embodiment of the present invention can implement the embodiment of the above-mentioned image acquisition method. For specific function implementation, please refer to the description in the method embodiment, which will not be repeated here.

[0082] In addition, in another embodiment, the present application also provides a terminal, such as Figure 3 As shown, the server processor 303, the memory 305, the input unit 307 and the display unit 309 and other devices. Those skilled in the art can understand that Figure 3The structural devices shown do not constitute a limitation on all servers, and may include more or fewer components than shown, or combine certain components. The memory 305 can be used to store the application 301 and each functional module, and the processor 303 runs the application 301 stored in the memory 305, thereby executing various functional applications and data processing of the device. The memory 305 can be an internal memory or an external memory, or include both internal and external memories. The internal memory may include a read-only memory (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), a flash memory, or a random access memory. The external memory may include a hard disk, a floppy disk, a ZIP disk, a U disk, a magnetic tape, etc. The memory disclosed in this application includes but is not limited to these types of memories. The memory 305 disclosed in this application is only used as an example and not as a limitation.

[0083] The input unit 307 is used to receive the input of the signal and the keyword input by the user. The input unit 307 may include a touch panel and other input devices. The touch panel can collect the user's touch operation on or near it (such as the user's operation on or near the touch panel using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program; other input devices may include but are not limited to one or more of a physical keyboard, a function key (such as a playback control key, a switch key, etc.), a trackball, a mouse, a joystick, etc. The display unit 309 can be used to display the information input by the user or the information provided to the user and various menus of the computer device. The display unit 309 can be in the form of a liquid crystal display, an organic light emitting diode, etc. The processor 303 is the control center of the computer device, which uses various interfaces and lines to connect various parts of the entire computer, and executes various functions and processes data by running or executing software programs and / or modules stored in the memory 303, and calling data stored in the memory. Figure 3 The one or more processors 303 shown in FIG. 1 are capable of executing, implementing Figure 2 The functions of the acquisition module 210, the spot calculation module 220, and the determination module 230 shown in FIG.

[0084] In one embodiment, the terminal includes one or more processors 303, one or more memories 305, and one or more applications 301, wherein the one or more applications 301 are stored in the memory 305 and are configured to be executed by the one or more processors 303, and the one or more applications 301 are configured to execute the image acquisition method described in the above embodiment.

[0085] A terminal provided in an embodiment of the present application can realize the acquisition of a picture of a target object that needs to be recognized by OCR; the picture is processed by binarization and expansion algorithm in sequence to obtain the range of the light spot area in the picture, and the proportion of the light spot area to the area of ​​the picture is calculated; it is determined whether the light spot ratio is greater than a preset ratio threshold, and if so, a preset prompt message is sent. The present invention provides a picture acquisition method, pre-processes the picture of the target object that needs to be recognized by OCR according to the binarization and expansion algorithm, highlights the light spot area, thereby obtaining the distribution and area of ​​the light spot area, and finally determines whether it is necessary to send the preset prompt information to the picture, thereby avoiding the technical complexity caused by the need to convert the original picture into RGB color mode as a target recognition picture in the prior art. The problem of large amount of calculation is solved, and the processing efficiency of the terminal is improved, so that the solution of the present invention is easier to be popularized and used in mobile terminals such as mobile phones.

[0086] The terminal provided in the embodiment of the present application can implement the embodiment of the image acquisition method provided above. For specific function implementation, please refer to the description in the method embodiment, which will not be repeated here.

[0087] The embodiment of the present invention also provides that the terminal may be a mobile terminal. For the sake of convenience, only the part related to the embodiment of the present invention is disclosed. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The mobile terminal may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a car computer, etc., taking the terminal as a mobile phone as an example:

[0088] The mobile phone includes components such as a radio frequency (RF) circuit, a memory, an input unit, a display unit, a sensor, an audio circuit, a wireless fidelity (Wi-Fi) module, a processor, and a power supply.

[0089] Among them, the sensors include light sensors, motion sensors and other sensors. Specifically, the light sensors may include ambient light sensors and proximity sensors, wherein the ambient light sensor can adjust the brightness of the display panel according to the brightness of the ambient light, and the proximity sensor can turn off the display panel and / or backlight when the mobile phone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured on the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.

[0090] The above descriptions are only some embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for obtaining a picture, characterized in that: The steps include: Obtain a picture of a target object to be OCR-recognized, wherein the picture includes image information obtained in a preview or focus stage before shooting; The image is processed by binarization and expansion algorithm in sequence to obtain the range of the light spot area in the image, and the proportion of the light spot area to the area of ​​the image is calculated; Determine whether the spot ratio is greater than a preset ratio threshold, and if so, send a preset prompt message and predict the direction of the light causing the spot through a coordinate model based on the acquired spot position information, and adjust the angle and distance between the terminal and the target object according to the coordinate model; The step of sequentially performing binarization and dilation algorithm processing on the image to obtain the light spot area range in the image, and calculating the light spot ratio of the light spot area range to the area of ​​the image, includes: Acquire the image, and perform binarization processing on the image by setting a threshold value to obtain a binary image in which the light spot area is converted into a first white area; the threshold value is used to highlight the light spot area; Using the dilation algorithm, the distribution of the second white area processed by the dilation algorithm is obtained.

2. The image acquisition method according to claim 1, characterized in that: The step of calculating the ratio of the light spot area range to the image area comprises: Get the range of the second white area; The area of ​​the second white area is calculated to obtain the light spot ratio of the light spot area range to the image area.

3. The image acquisition method according to claim 2, characterized in that: The step of obtaining the range of the second white area includes: Get the pixel values ​​of all pixels of the image; Obtaining a pixel point having a large gradient change in the pixel point value; The pixel points with large gradient changes are connected to form a closed curve to obtain the range of the second white area.

4. The image acquisition method according to claim 2, characterized in that: The step of calculating the area of ​​the second white area comprises: Get the range of the second white area; Obtaining the area of ​​the minimum circumscribed rectangle of the second white area using the image coordinates; The area of ​​the second white area is calculated according to the area of ​​the minimum circumscribed rectangle.

5. The image acquisition method according to claim 4, characterized in that: The step of obtaining the area of ​​the second white area according to the area of ​​the minimum circumscribed rectangle comprises: in, is the area of ​​the second white area, k is the area ratio of the largest inscribed circle of the smallest circumscribed rectangle, is the area of ​​the minimum circumscribed rectangle of the second white area.

6. The image acquisition method according to claim 1, characterized in that: Before the step of sequentially performing binarization and dilation algorithm processing on the image to obtain the light spot area range in the image, and calculating the proportion of the area range where the light spot exists in the image, the step also includes: The effective content area of ​​the picture is identified by using a pre-trained image recognition model to obtain the effective content area in the picture.

7. A picture acquisition device, characterized in that: include: An acquisition module is used to acquire a photograph of a target object that needs OCR recognition, wherein the photograph includes image information acquired in a preview or focus stage before shooting; The light spot calculation module is used to perform binarization and expansion algorithm processing on the image in sequence to obtain the light spot area range in the image, and calculate the light spot ratio of the light spot area range to the area of ​​the image A determination module, used to determine whether the light spot ratio is greater than a preset ratio threshold, and if so, send a preset prompt message and predict the direction of the light causing the light spot through a coordinate model according to the acquired position information of the light spot, and adjust the angle and distance between the terminal and the target object according to the coordinate model; Wherein, the light spot calculation module is specifically used for: Acquire the image, and perform binarization processing on the image by setting a threshold value to obtain a binary image in which the light spot area is converted into a first white area; the threshold value is used to highlight the light spot area; Using the dilation algorithm, the distribution of the second white area processed by the dilation algorithm is obtained.

8. A terminal, characterized in that: It includes: one or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to: execute the image acquisition method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the image acquisition method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Discharge ultraviolet imaging quantization parameter extraction method of high-voltage electric equipment

    CN103543394A

  • Card image reflective detection method and device

    CN106228168A

  • Spot detection method and apparatus

    CN106951891A

  • Beta-amyloid plaque recognition and measurement method based on image processing

    CN107561264A

  • Farmland green crop rapid segmentation method under outdoor changeable illumination condition

    CN108765442A