WO2018219005A1 - File processing method and terminal - Google Patents

File processing method and terminal Download PDF

Info

Publication number
WO2018219005A1
WO2018219005A1 PCT/CN2018/078154 CN2018078154W WO2018219005A1 WO 2018219005 A1 WO2018219005 A1 WO 2018219005A1 CN 2018078154 W CN2018078154 W CN 2018078154W WO 2018219005 A1 WO2018219005 A1 WO 2018219005A1
Authority
WO
WIPO (PCT)
Prior art keywords
layer
image data
layers
color
value
Prior art date
Application number
PCT/CN2018/078154
Other languages
French (fr)
Chinese (zh)
Inventor
赵冬晓
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2018219005A1 publication Critical patent/WO2018219005A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image

Definitions

  • the present invention relates to the field of file processing, and in particular to a method and terminal for processing a file.
  • a color photograph is obtained during scanning or photographing, and then directly stored or grayscale processed, and the color photograph is processed into a black and white grayscale photograph.
  • the trace of the writing thus, in the process of black and white binarization, the loss of the pixel is serious, and the edge loss of the resulting photo text is compared. Large, there will be fine text, and there are often lost strokes for handwritten text.
  • the printing body and the handwriting part cannot be distinguished very well. For some scenes that require text recognition, the mixing of handwritten characters will have a great influence on the recognition of the characters.
  • the embodiment of the invention provides a method and a terminal for processing a file, so as to solve at least the problem that the pixel loss of the image obtained by scanning or photographing the file in the related art is serious.
  • a method for processing a file includes: performing image data collection by a first light to be processed file, obtaining a color value of a pixel in the first image data of the to-be-processed file, and the First coordinate information of the pixel of the first image data in the first image data; image data acquisition of the file to be processed by the second light, to obtain a pixel point in the second image data of the file to be processed First coordinate information; adjusting pixel points corresponding to coordinate information of pixel points in the first image data in the second image data according to color values of pixel points in the first image data.
  • the adjusting, according to the color value of the pixel point in the first image data, the pixel point corresponding to the coordinate information of the pixel point in the first image data in the second image data comprises: Presetting a plurality of color value intervals to group the pixel points in the first image data to obtain a plurality of grouped layers, wherein color values of the pixel points in the same layer are in the same color value interval Adjusting, according to a color value of a pixel point in one or more layers, a color value of a pixel point corresponding to coordinate information of a pixel point in the one or more layers in the second image data, and/ Or adjusting a position of a pixel point corresponding to coordinate information of a pixel point in the one or more layers in the second image data.
  • the adjusting includes: adjusting, to the plurality of color values of the pixel points corresponding to the coordinate values other than the coordinate values corresponding to the first layer of the plurality of layers in the second image data
  • the color values of the first layer in the layers are the same; wherein the first layer is the background layer of the file to be processed.
  • the adjusting includes: adjusting, to the plurality of color values of the pixel points corresponding to the coordinate values other than the coordinate values corresponding to the second layer of the plurality of layers in the second image data
  • the color values of the second layer in the plurality of layers are the same; wherein the second layer is another layer other than the ground layer in the plurality of layers, and the second layer includes One or more sublayers.
  • the second image data is divided by the coordinate values corresponding to the second layer of the plurality of layers. After the color values of the pixel points corresponding to the other coordinate values are adjusted to be consistent with the color values of the second layer in the plurality of layers, the color values of the second image data are consistent with the color values of the second layer.
  • the color values of the partial sub-layers of the plurality of sub-layers are adjusted to be consistent with the color values of the first layer; wherein the first layer is a ground color layer of the to-be-processed file; and/or Adjusting a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to the plurality of layers
  • the color values of a part of the sub-layers of the plurality of sub-layers in the second image data that match the color values of the second layer are adjusted to be opposite to the plurality of sub-layers
  • One of the sublayers in the layer has the same color value.
  • the performing, according to the color value of the pixel point in the one or more layers, the position of the pixel point in the second image data corresponding to the coordinate information of the pixel point in the one or more layers includes: acquiring coordinate information of the second layer in the first coordinate data in the first coordinate information; and moving a pixel corresponding to the coordinate information of the second layer in the second image data a location; wherein the second layer is another layer other than the ground color layer of the plurality of layers, and the second layer includes one or more sub-layers.
  • the first light is invisible light
  • the second light is visible light
  • a terminal comprising: a fill light assembly configured to emit first light and second light; and an image capture component configured to perform image data collection by the first light to be processed file And performing image data collection on the to-be-processed file by using the second light; and the processor is configured to obtain, according to the image data acquired by the first light, a color of a pixel in the first image data of the to-be-processed file a value and first coordinate information of the pixel of the first image data in the first image data; and obtaining pixel points in the second image data of the file to be processed according to the image data acquired by the second light First coordinate information; and adjusting pixel points corresponding to coordinate information of pixel points in the first image data in the second image data according to color values of pixel points in the first image data.
  • the processor is further configured to group the pixels in the first image data according to a preset plurality of color value intervals to obtain a plurality of layers after the grouping, wherein the same layer The color values of the pixels in the same color value interval; and the coordinates of the pixel points in the second image data and the one or more layers according to the color values of the pixels in the one or more layers The color values of the pixel points corresponding to the information are adjusted, and/or the positions of the pixel points corresponding to the coordinate information of the pixel points in the one or more layers in the second image data are adjusted.
  • the processor is further configured to set, in the second image data, a color of a pixel corresponding to a coordinate value other than a coordinate value corresponding to the first layer of the plurality of layers a value adjusted to coincide with a color value of the first layer of the plurality of layers; wherein the first layer is a ground color layer of the file to be processed.
  • the processor is further configured to set, in the second image data, a color of a pixel point corresponding to a coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers a value adjusted to be consistent with a color value of a second layer of the plurality of layers; wherein the second layer is a layer other than the underlying layer of the plurality of layers, And the second layer includes one or more sub-layers.
  • the processor is further configured to divide the second image data with a second one of the plurality of layers
  • the color value of the pixel corresponding to the coordinate value other than the coordinate value of the layer is adjusted to be consistent with the color value of the second layer in the plurality of layers
  • the second image data is The color values of the partial sub-layers of the plurality of sub-layers whose color values of the two layers are consistent are adjusted to be consistent with the color values of the first layer; wherein the first layer is the background color of the to-be-processed file a layer; and/or, adjusting a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to After matching the color values of the second layer of the plurality of layers, color of a portion of the plurality of sub-layers in the second image data that are consistent with the color values of the second layer The value is adjusted to coincide with a color value
  • the processor is further configured to acquire coordinate information of the second layer in the first image data in the first coordinate information; and move in the second image data and the second image a position of the pixel corresponding to the coordinate information of the layer; wherein the second layer is another layer other than the ground layer in the plurality of layers, and the second layer includes one or more Sublayers.
  • the camera assembly includes: a filter switching component and a photosensitive component; wherein, in a case where the filter component filters out the second light, the photosensitive component processes a file by using the first light Performing image data acquisition; in the case that the filter component filters out the first light, the photosensitive component performs image data acquisition by the second light to be processed file.
  • the first light is invisible light
  • the second light is visible light
  • a storage medium having stored therein a computer program, wherein the computer program is configured to execute the steps of any one of the method embodiments described above.
  • an electronic device comprising a memory and a processor, wherein the memory stores a computer program, the processor being arranged to run the computer program to perform any of the above The steps in the method embodiments.
  • the image data is collected by the first light to be processed file, and the color value of the pixel in the first image data of the file to be processed and the first coordinate of the pixel of the first image in the first image data are obtained.
  • Information collecting image data by using the second light to be processed file, obtaining first coordinate information of pixel points in the second image data of the file to be processed; and comparing the color value of the pixel point in the first image data to the second image data.
  • FIG. 1 is a flow chart of a method of processing a file in accordance with an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of an apparatus for processing a file according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a hardware location structure according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural view of a camera according to an embodiment of the present invention.
  • FIG. 5 is a circuit diagram of a filter switching module according to an embodiment of the invention.
  • FIG. 6 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
  • FIG. 7 is a normal distribution diagram of invisible light data formation in accordance with an embodiment of the present invention.
  • FIG. 1 is a flowchart of a method for processing a file according to an embodiment of the present invention. As shown in FIG. 1, the process includes the following steps:
  • Step S102 Perform image data collection by using the first light to be processed file, and obtain color values of pixel points in the first image data of the file to be processed and first coordinate information of the pixel points of the first image data in the first image data;
  • Step S104 Perform image data collection by using the second light to be processed file, and obtain first coordinate information of pixel points in the second image data of the file to be processed;
  • Step S106 Adjust, according to the color value of the pixel point in the first image data, the pixel point corresponding to the coordinate information of the pixel point in the first image data in the second image data.
  • steps S102 to S106 of the embodiment respectively processing the file to be processed according to the first light and the second light to obtain the first image data and the second image data respectively, and further according to the color value of the pixel in the first image data.
  • Adjusting the pixel points corresponding to the coordinate information of the pixel points in the first image data in the second image data, and adopting the method of the embodiment the image data of the collected file to be processed can be adjusted, thereby solving the correlation
  • the problem that the pixel loss of the image obtained by scanning or photographing the file is serious is serious, and the user experience is improved.
  • the execution body of the method of this embodiment is preferably a smart terminal.
  • the color values involved in this embodiment may be gray values, RGB (three primary color light modes), or color values of other formats.
  • step S106 according to the color value of the pixel point in the first image data, the pixel corresponding to the coordinate information of the pixel point in the first image data in the second image data is adjusted, in an optional implementation manner of this embodiment.
  • Can further include:
  • Step S106-1 grouping the pixels in the first image data according to the preset plurality of color value intervals to obtain a plurality of layers after the grouping, wherein the color values of the pixels in the same layer are in the same Within the color value interval;
  • Step S106-2 adjusting, according to the color value of the pixel point in the one or more layers, the color value of the pixel point corresponding to the coordinate information of the pixel point in the one or more layers in the second image data, and/ Or adjusting the position of the pixel point corresponding to the coordinate information of the pixel point in the one or more layers in the second image data.
  • the value of the threshold value M can take the average value of the Y values of all the pixel points.
  • local binarization can be used here, that is, according to a certain rule, the whole image is divided into N windows, and each of the N windows is divided into pixels according to a uniform threshold M. Two parts are binarized, and a higher precision adaptive threshold method can be used for local binarization.
  • the M value can also be confirmed by the bimodal method, and P is a parameter method, an iterative method, an OTSU method, or the like.
  • the color of the paper that is, the background area
  • the coordinate value of the point of the recording background area is D.
  • the coordinates of the remaining points are the text areas.
  • the coordinate values of the ground color region and the text region are one-to-one correspondence between the visible light image and the invisible light image, and are consistent.
  • Array X takes an array of Y values of all coordinate points.
  • the Y values of the underlying regions in the array are all set to 0 to form a corrected array Ye, and the normal distribution processing is performed using the value of Ye, wherein the abscissa is the value of Ye and the ordinate is the number of coordinate points.
  • each peak in the image array can be obtained, each peak corresponds to one layer, and the peak value Y0 of the largest area is selected, which satisfies Y0-M0 ⁇ Ye ⁇ Y0+M0 (here The point at which M0 is the threshold value of the peak distribution, and the variance of the secondary distribution can be taken as the point corresponding to the layer of the peak, and the coordinates of these points are stored as layer 0, and the coordinate data is stored in the array W.
  • the distribution acquires layer 1 and layer 2, and when the number of points of a certain layer is less than the threshold value Mt, the layer assignment is stopped.
  • the system can use the data for further processing.
  • the correspondence is as follows:
  • the color corresponding to visible light is the color of the paper, taking the average of all the elements in the array D to get the average color of the paper.
  • Layer 0 - array W layer 0 is the layer corresponding to the color with the largest peak area in the distribution of the infrared image array D.
  • the background layer is removed, the most distributed should be In the printed text part
  • layer 0 corresponds to the data of the printed part
  • array D is the coordinate position where the printed body is located.
  • Layer 1 and Layer 2 correspond to the annotations in the document.
  • the difference in the Y value corresponding to the peak of the normal distribution of each layer is caused by the difference in brightness of different colors under infrared light imaging.
  • the layer corresponds to a color, and the coordinate position distribution is Z1, Z2.
  • the manner of step S106-2 includes the following optional implementation manners:
  • Manner 1 Adjust the color value of the pixel corresponding to the coordinate value other than the coordinate value corresponding to the first layer of the plurality of layers in the second image data to the first of the plurality of layers
  • the layer has the same color value; the first layer is the underlying layer of the file to be processed.
  • the method may be document restoration: taking an array X, calculating a D color average value D0 of the underlying layer, and modifying the color values corresponding to all the annotation layer coordinate values of the array X, Z1, Z2, and the like.
  • D0 the data of the annotation part of layer 1, layer 2, etc. is filled into the color average of the bottom layer, and the array A0 is obtained, then A0 is the restored document.
  • Manner 2 adjusting the color value of the pixel corresponding to the coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to the second of the plurality of layers
  • the color values of the layers are the same; wherein the second layer is other layers than the underlying layer in the plurality of layers, and the second layer includes one or more sub-layers.
  • the method may be an annotation color distinction: coordinate positions Z1 and Z2 corresponding to annotation layers such as layer 1 and layer 2 are coordinate positions corresponding to different color annotations, and in X, Z1 coordinates are taken. The average value of the color values of all the pixels of the point is recorded as color 1, and then color 1 is the color of layer 1. The same method gets the color 2 of layer 2.
  • Manner 3 in the case where the second layer includes a plurality of sub-layers, the pixels corresponding to the coordinate values other than the coordinate values corresponding to the second layer of the plurality of layers in the second image data a color value adjusted to be consistent with a color value of a second layer in the plurality of layers, and a portion of the plurality of sub-layers in the second image data that are consistent with the color values of the second layer
  • the color value is adjusted to be consistent with the color value of the first layer; wherein the first layer is a ground color layer of the file to be processed; and/or,
  • the method may be hiding and displaying of annotations: on the basis of the above manners 1 and 2, the value of the array A0 may be processed to realize hiding and displaying of different color annotations, A0 is The original document, that is, the document with hidden annotations; in the A0 array, the point color value corresponding to the coordinate position of Z1 is filled with the color 1, and the filled array is the image of the annotation displaying the color 1.
  • A0 is The original document, that is, the document with hidden annotations; in the A0 array, the point color value corresponding to the coordinate position of Z1 is filled with the color 1, and the filled array is the image of the annotation displaying the color 1.
  • Manner 4 acquiring coordinate information of the second layer in the first coordinate information in the first coordinate data; moving the position of the pixel corresponding to the coordinate information of the second layer in the second image data; wherein, the second A layer is a layer other than the underlying layer in multiple layers, and the second layer includes one or more sublayers.
  • this can be a movement of annotations: when some annotations are within the printed text area, the annotations can be moved to a blank portion.
  • the abscissa shift amount Ts, the ordinate shift amount Tt is calculated and obtained by all the coordinate point sets belonging to the same annotation layer adjacent to the coordinate.
  • the color value of the coordinate point of the annotation layer corresponding to the adjusted sz(e)tz(e) is modified to the corresponding color
  • the color value of the original annotation layer coordinate point is modified to the ground color layer.
  • the color value D0 which implements the movement of the annotation.
  • the first light is invisible light and the second light is visible light.
  • Invisible light such as infrared light
  • infrared light when exposed to infrared light, different colors and different materials have different absorption rates for invisible light, and the reflected light is different.
  • infrared light illuminates different colors of a certain material, different color parts are in infrared.
  • the color values of the images under the light are different. By distinguishing the color values, the different colors can be classified, that is, the layers mentioned above, and each layer corresponds to one color.
  • invisible light can also be used in addition to infrared rays, as long as light of different colors and different materials can be used.
  • the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation.
  • the technical solution of the present invention which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, or a network device, etc.) to perform the methods of various embodiments of the present invention.
  • a device for processing a file is provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and has not been described again.
  • the term "module” may implement a combination of software and/or hardware of a predetermined function.
  • the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
  • FIG. 2 is a schematic structural diagram of an apparatus for processing a file according to an embodiment of the present invention. As shown in FIG. 2, the apparatus includes:
  • the first collection module 22 is configured to perform image data collection by using the first light to be processed file, and obtain a color value of a pixel in the first image data of the file to be processed and a pixel point of the first image in the first image data. a coordinate information;
  • the second collection module 24 is coupled to the first collection module 22 and configured to perform image data collection by using the second light to be processed file to obtain first coordinate information of the pixel in the second image data of the file to be processed.
  • the adjustment module 26 is coupled to the second acquisition module 24 and configured to adjust, according to the color value of the pixel in the first image data, the pixel corresponding to the coordinate information of the pixel in the first image data in the second image data. .
  • the first acquisition module 22 and the second acquisition module 24 can be inherited on the camera module.
  • the camera module can form the first acquiring module 22 and the second collecting module 24 by two parts;
  • the two parts may be: a filter switching module and a photosensitive element.
  • the photosensitive element is a common CCD (collectively referred to as a charge-coupled device) CMOS (collectively referred to as Complementary Metal Oxide Semiconductor, ie, a complementary metal oxide semiconductor) and other components that can be used as a sightseeing function, and filter switching
  • CMOS Complementary Metal Oxide Semiconductor
  • the module has two layers of filters, visible light filter and infrared filter, wherein the visible light filter can filter out all non-visible spectra, allowing the photosensitive element to receive only the image of the visible spectrum to obtain visible light image.
  • the infrared filter can filter out all non-infrared spectra, allowing the photosensitive element to receive only the image of the infrared spectrum to obtain an infrared image.
  • the filter switching module is mechanical, and one of the visible filter and the infrared filter is controlled by an electric signal to be in front of the photosensitive element for filtering. In the normal mode, the infrared filter is in a stowed state, and the photosensitive element is collected.
  • the visible light image when the document is taken, the user presses the shutter, and the filter switching module first keeps the visible light filter working, collects the light image, then folds up the light filter, drops the infrared filter, and collects the infrared light. image.
  • the adjusting module includes: a grouping unit, configured to group the pixels in the first image data according to the preset plurality of color value intervals, to obtain the plurality of layers after the grouping, wherein, in the same layer The color value of the pixel is in the same color value interval; the adjusting unit is coupled with the grouping unit, and is set to correspond to one or more layers in the second image data according to the color value of the pixel in the one or more layers The color values of the pixel points corresponding to the coordinate information of the middle pixel are adjusted, and/or the positions of the pixel points corresponding to the coordinate information of the pixel points in the one or more layers in the second image data are adjusted.
  • the adjustment unit is further configured to adjust the color value of the pixel point corresponding to the coordinate value other than the coordinate value corresponding to the first layer of the plurality of layers in the second image data to be more
  • the color values of the first layer in the layer are the same; the first layer is the background layer of the file to be processed.
  • This mode corresponds to the first mode of the step S106-2 in the first embodiment, that is, the mode is a file restoration mode in a specific application scenario.
  • the adjusting unit is further configured to adjust the color value of the pixel corresponding to the coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to be more
  • the second layer in each layer has the same color value; wherein the second layer is other layers than the underlying layer in the plurality of layers, and the second layer includes one or more sublayers .
  • This mode corresponds to the second mode of step S106-2 in the first embodiment, that is, the mode is distinguished by the annotation color in a specific application scenario.
  • the adjusting unit is further configured to adjust the color value of the pixel corresponding to the coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to be more
  • the second layer in each layer has the same color value; wherein the second layer is other layers than the underlying layer in the plurality of layers, and the second layer includes one or more sublayers .
  • This mode corresponds to the third mode of the step S106-2 in the first embodiment, that is, the mode is hidden and displayed in the specific application scenario.
  • the adjusting unit is further configured to acquire coordinate information of the second layer in the first coordinate data in the first coordinate information; and move the pixel corresponding to the coordinate information of the second layer in the second image data a location; wherein the second layer is a layer other than the ground layer in the plurality of layers, and the second layer includes one or more sub-layers.
  • This mode corresponds to the fourth mode of step S106-2 in the first embodiment, that is, the mode is the movement of the annotation in a specific application scenario.
  • the first light involved in this embodiment may be invisible light, and the second light may be visible light.
  • the second embodiment is an apparatus embodiment corresponding to the first embodiment. Therefore, the manners implemented by the modules and units in this embodiment are consistent with the above method steps.
  • each of the above modules may be implemented by software or hardware.
  • the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the above modules are in any combination.
  • the forms are located in different processors.
  • the terminal includes:
  • a fill light assembly 62 configured to emit first light and second light
  • the camera assembly 64 is coupled to the fill light assembly 62, configured to perform image data collection by the first light to be processed file, and image data collection by the second light to be processed file;
  • the processor 66 is coupled to the camera component 64 and configured to obtain, according to the image data acquired by the first light, a color value of a pixel in the first image data of the file to be processed and a pixel of the first image in the first image data.
  • the first coordinate information; and the first coordinate information of the pixel in the second image data of the file to be processed according to the image data acquired by the second light; and the second image data according to the color value of the pixel in the first image data The pixel points corresponding to the coordinate information of the pixel points in the first image data are adjusted.
  • the processor is further configured to group the pixels in the first image data according to the preset plurality of color value intervals to obtain the plurality of layers after the grouping.
  • the color values of the pixels in the same layer are within the same color value interval; and the pixel values in the second image data and the one or more layers according to the color values of the pixels in the one or more layers
  • the coordinate information corresponds to the color value of the pixel point, and/or the position of the pixel point in the second image data corresponding to the coordinate information of the pixel point in the one or more layers is adjusted.
  • the processor may also be configured as follows To achieve the above method:
  • Manner 1 The processor is configured to adjust the color value of the pixel corresponding to the coordinate value other than the coordinate value corresponding to the first layer of the plurality of layers in the second image data to the plurality of layers The color values of the first layer in the same are consistent; wherein the first layer is the background layer of the file to be processed.
  • the processor is configured to adjust the color value of the pixel corresponding to the coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to the plurality of layers
  • the second layer has the same color value; wherein the second layer is other layers than the underlying layer in the plurality of layers, and the second layer includes one or more sub-layers.
  • Manner 3 In a case where the second layer includes a plurality of sub-layers, the processor is configured to divide the second image data by other coordinates than the coordinate values corresponding to the second layer of the plurality of layers After the color value of the pixel corresponding to the value is adjusted to be consistent with the color value of the second layer in the plurality of layers, the second image data is in the plurality of sub-layers that are consistent with the color value of the second layer The color values of the partial sub-layers are adjusted to be consistent with the color values of the first layer; wherein the first layer is the underlying layer of the file to be processed; and/or,
  • the processor is configured to acquire coordinate information of the second layer in the first coordinate data in the first coordinate information; and move a position of the pixel corresponding to the coordinate information of the second layer in the second image data;
  • the second layer is a layer other than the ground layer in the plurality of layers, and the second layer includes one or more sub-layers.
  • the camera assembly comprises: a filter switching component and a photosensitive component;
  • the photosensitive component performs image data acquisition by the first light to be processed file; and in the case that the filter component filters out the first light, the photosensitive component is processed by the second light
  • the file is used for image data acquisition.
  • first light in this embodiment may be invisible light, and the second light may be visible light.
  • the present optional embodiment provides an apparatus for processing a document image by using invisible light
  • the hardware part comprises: a central processing unit module (corresponding to the processor in the embodiment 3), a camera module (corresponding to the embodiment 3) a camera component), a non-visible light fill module (corresponding to the fill light component in Embodiment 3); wherein the central processing unit is configured to perform image data processing; and the camera module is configured to capture an invisible light spectrum
  • the invisible light filling module is set to be a fill light emitting invisible light, connected to the central processing module through a bus, and controlled by the central processor.
  • the flow of processing the document image by using the invisible light is described in the optional embodiment: first, the document shooting function is started, the device enters the document shooting mode to start the shooting module and the image processing module; secondly, the triggering shooting module controls the invisible light The fill light is turned on, and then the shooting module controls the camera to collect image data, and separately collects the invisible light portion and the visible light portion thereof, and respectively stores them in two image formats.
  • the image processing module analyzes and processes the invisible light portion, and according to the difference in reflectance of the invisible light irradiation on different colors, the brightness value of each pixel in the image is different, and the pixel points with similar color values are classified.
  • This part of the pixel is the pixel of the same layer, and the pixel position is recorded, and the pixel positions of different layers are stored in different arrays.
  • the array of pixel positions of different layers is corresponding to the pixels in the visible light image, and the images of different layers are separately extracted and stored separately; finally, different layer images are further processed according to user requirements.
  • FIG. 3 is a schematic diagram of a hardware location structure according to an embodiment of the present invention.
  • the camera module and the invisible fill light module are in the same plane, so that the camera module can collect the invisible light emitted by the invisible fill light;
  • the invisible fill light in the alternative embodiment has two light sources, one light source emits visible light and is used for flashing when photographing; the other light source can emit infrared light for infrared fill light.
  • the infrared ray is invisible to the human eye, but for the camera in this embodiment, the infrared spectrum portion and the visible light spectrum portion can be acquired. And the image of the infrared spectrum portion and the image of the visible light spectrum portion can be separately filtered by a filter or software.
  • FIG. 4 is a schematic structural diagram of a camera according to an embodiment of the present invention.
  • the camera has two parts, which are respectively a filter switching module (corresponding to the total filter switching component of Embodiment 3) and a photosensitive element. (corresponding to the photosensitive member in Embodiment 3) and other necessary components, the photosensitive element is a common CCD CMOS and other components that can be used as a sightseeing function, and the filter switching module has two layers of filters, respectively, visible light filtering.
  • a sheet and an infrared filter wherein the visible light filter filters out all non-visible spectra, allowing the photosensitive element to receive only images of the visible portion of the spectrum to obtain visible light images, and the infrared filter can filter out all non-infrared spectra.
  • the photosensitive element receives only the image of the infrared spectrum portion to obtain an infrared image.
  • the filter switching module is mechanical, and one of the visible filter and the infrared filter is controlled by an electric signal to be in front of the photosensitive element for filtering. In the normal mode, the infrared filter is in a stowed state, and the photosensitive element is collected.
  • the filter switching module first keeps the visible light filter working, collects the light image, then folds up the light filter, drops the infrared filter, and collects the infrared light. image.
  • the camera module can also adopt software processing mode, without adding a filter switching module, collecting all spectral signals through the photosensitive element, and filtering by software, wherein the wavelength is greater than 760 nm for the infrared spectrum, and the wavelength for the wavelength less than 760 nm is visible. spectrum.
  • FIG. 5 is a schematic circuit diagram of a filter switching module according to an embodiment of the present invention.
  • a visible light filter and an infrared filter are connected to a switching module through a bracket, and a top end of the bracket has a permanent magnet, two The magnetic pole of the permanent magnet at the top of the filter holder is opposite.
  • the switching module in the normal photographing mode, the switching module is applied with a positive voltage +V, and the magnetic pole of the bottom end of the switching module is N, the visible light filter holder is repelled by the same pole. It extends downwards and blocks in front of the photosensitive element.
  • the infrared filter top bracket attracts the opposite poles and is lifted up. At this time, the camera is in visible light shooting mode.
  • the switching module adds a negative voltage -V, and connects the magnetic pole S at the bottom end of the switching module, the infrared filter holder is repelled with the same pole, extending downward, and blocking in front of the photosensitive element.
  • the visible light filter top bracket is attracted to the opposite pole and is lifted up. At this time, the camera is in infrared shooting mode.
  • the filter switching module can adopt other mechanical devices to control the rise and fall of the filter through different electrical signals.
  • the steps of processing the document image by using the invisible light in the embodiment in combination with the above-mentioned FIG. 3 to FIG. 5 include:
  • Step S201 The document shooting mode is started, and the fill light enters the infrared emission mode, and the infrared light source of the fill light is in a working state.
  • the camera enters the document shooting mode and adds a forward voltage +V to the filter switching module.
  • Step S202 The user takes a picture, and the camera module controls the fill light to emit infrared light to fill the light, and the system sends a command to control the camera module to take a photo.
  • Step S203 After receiving the system shooting instruction, the camera module maintains the forward switching voltage +V acquisition image of the filter switching module, collects the visible light image, and then adds the negative voltage -V to the filtering switching module to collect the infrared image.
  • the image format captured by the camera module is RAW format, converted into YUV format for further processing, and stored in two array buffers respectively, the visible image data array is A, and the infrared image data array is B.
  • Step S204 Layer separation.
  • the visible light data array A is binarized, and the Y value in the visible light image data array is taken, and the Y value for a certain pixel point is obtained;
  • the value of the threshold value M can take the average value of the Y values of all the pixel points.
  • local binarization can be used here, that is, according to a certain rule, the whole image is divided into N windows, and each of the N windows is divided into pixels according to a uniform threshold M. Two parts are binarized, and a higher precision adaptive threshold method can be used for local binarization.
  • the M value can also be confirmed by the bimodal method, the P parameter method, the iterative method, the OTSU method, and the like.
  • the color of the paper that is, the background area
  • the coordinate value of the point of the recording background area is D.
  • the coordinates of the remaining points are the text areas.
  • the coordinate values of the ground color region and the text region are one-to-one correspondence between the visible light image and the invisible light image, and are consistent.
  • each peak in the image array can be obtained, each peak corresponds to one layer, and the peak value Y0 of the largest area is selected, which satisfies Y0-M0 ⁇ Ye ⁇ Y0+M0 (here The point at which M0 is the threshold value of the peak distribution, and the variance of the secondary distribution can be taken as the point corresponding to the layer of the peak, and the coordinates of these points are stored as layer 0, and the coordinate data is stored in the array W.
  • the distribution acquires layer 1 layer 2, and when the number of points of a certain layer is less than the threshold value Mt, the layer assignment is stopped.
  • the layer separation may also adopt other mathematical algorithms, such as stripping data layer by layer with the desired variance value, determining the value of a similar element by using the same identical data, and then searching for other similar elements according to the value.
  • Step S205 After acquiring the ground color layer, the layer 0, the layer 1, and the layer 2, the layer is combined with the visible light image data, and the points of each layer correspond to the corresponding color values. Image data obtained by separating different color values is obtained.
  • the system can use the data for further processing.
  • Correspondence is as follows
  • the color corresponding to visible light is the color of the paper, taking the average of all the elements in the array D to get the average color of the paper.
  • Layer 0 - array W layer 0 is the layer corresponding to the color with the largest peak area in the distribution of the infrared image array D.
  • the background layer is removed, the most distributed should be In the printed text part
  • layer 0 corresponds to the data of the printed part
  • array D is the coordinate position where the printed body is located.
  • Layer 1 Layer 2..., these layers correspond to the annotation part of the document.
  • the difference of the Y value corresponding to the peak of the normal distribution of each layer is caused by the difference in brightness of different colors under infrared light imaging.
  • a layer corresponds to a color, and the coordinate position distribution is Z1, Z2....
  • Document restoration take the data array A of the visible light image, calculate the D color average value D0 of the ground color layer, and modify the color value corresponding to all the annotation layer coordinate values of the array A, Z1, Z2, etc. to D0, The data of the comment part of layer 1, layer 2, etc. is filled with the color average of the bottom layer, and the array A0 is obtained, then A0 is the restored document. Further, it is possible to perform operations such as character recognition.
  • the abscissa shift amount Ts, the ordinate shift amount Tt is calculated by all the coordinate point sets belonging to the same annotation layer adjacent to the coordinate.
  • the color value of the coordinate point of the annotation layer corresponding to the adjusted sz(e)tz(e) is modified to the corresponding color
  • the color value of the original annotation layer coordinate point is modified to the ground color layer.
  • the color value D0 which implements the movement of the annotation.
  • the document scanning is enhanced by using infrared rays, and various innovative functions such as annotation recognition and color recognition are realized; in addition, the scanning marginal blur encountered by the current user can be well solved, and the binarization processing is performed. The effect is not good, the problem that handwriting and print are indistinguishable.
  • Embodiments of the present invention also provide a storage medium.
  • the foregoing storage medium may be configured to store program code for performing the following steps:
  • S1 performing image data collection by using the first light to be processed file, obtaining color values of pixel points in the first image data of the to-be-processed file and first coordinate information of the pixel points of the first image in the first image data;
  • Embodiments of the present invention also provide a storage medium having stored therein a computer program, wherein the computer program is configured to perform the steps of any of the above method embodiments when executed.
  • the foregoing storage medium may include, but is not limited to, a USB flash drive, a Read-Only Memory (ROM), and a Random Access Memory (RAM).
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • Embodiments of the present invention also provide an electronic device comprising a memory and a processor having a computer program stored therein, the processor being arranged to execute a computer program to perform the steps of any of the method embodiments described above.
  • modules or steps of the present invention described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof are fabricated as a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.
  • the method and the terminal for processing a file provided by the embodiments of the present invention have the following beneficial effects: solving the problem that the pixel loss of the image obtained by scanning or photographing the file in the related art is serious, and improving the user. The effect of the experience.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

A file processing method and terminal. The method comprises: performing, by means of a first light, image data acquisition of a file to be processed, to obtain the color values of pixel points in first image data of the file to be processed and first coordinate information concerning the pixel points of the first image data in the first image data (S102); performing, by means of a second light, image data acquisition of the file to be processed, to obtain first coordinate information concerning pixel points in second image data of the file to be processed (S104); and adjusting, according to the color values of the pixel points in the first image data, pixel points in the second image data corresponding to the coordinate information of the pixel points in the first image data (S106). Said method and terminal solve the problem in the related art of relatively serious loss of image pixels obtained by way of scanning or photographing a file, thereby improving user experience.

Description

处理文件的方法、终端Method and terminal for processing files 技术领域Technical field
本发明涉及文件处理领域,具体而言,涉及一种处理文件的方法、终端。The present invention relates to the field of file processing, and in particular to a method and terminal for processing a file.
背景技术Background technique
随着终端功能越来越多,人们在日常生活的很多方面都会使用终端,从而让生活变得快捷方便,其中,利用evernote(印象笔记)、名片扫描等软件进行文档的扫描,拍照,识别等就是其中很重要的一项。在使用上述软件的过程中常常会对书籍或者名片表等其他进行文档扫描、拍照。With more and more terminal functions, people use terminals in many aspects of daily life, which makes life faster and more convenient. Among them, using evernote (impression notes), business card scanning and other software for document scanning, photographing, recognition, etc. It is one of the most important ones. In the process of using the above software, documents such as books or business card tables are often scanned and photographed.
相关技术中,扫描或拍照过程中得到的是彩色照片,进而直接保存或者进行灰度处理,将彩色照片处理为黑白的灰度照片。对于相关技术中的上述方式,如果被扫描或拍摄的纸质文档中有注释,涂写的痕迹;这样在黑白二值化的过程中,像素的损失比较严重,最终得到的照片文字边缘损失会比较大,会出现文字较细,对于手写文字经常出现丢失笔画。此外,对于印刷体和手写部分不能做很好的区分,对于一些需要文字识别的场景,手写文字的混入会对文字的识别产生很大的影响。In the related art, a color photograph is obtained during scanning or photographing, and then directly stored or grayscale processed, and the color photograph is processed into a black and white grayscale photograph. For the above-mentioned manner in the related art, if there is a comment in the paper document scanned or photographed, the trace of the writing; thus, in the process of black and white binarization, the loss of the pixel is serious, and the edge loss of the resulting photo text is compared. Large, there will be fine text, and there are often lost strokes for handwritten text. In addition, the printing body and the handwriting part cannot be distinguished very well. For some scenes that require text recognition, the mixing of handwritten characters will have a great influence on the recognition of the characters.
针对相关技术中采用对文件进行扫描或拍照的方式得到的图像像素损失比较严重的上述问题,目前尚未存在有效的解决方案。In view of the above problems in which the image pixel loss obtained by scanning or photographing a file in the related art is relatively serious, an effective solution has not yet existed.
发明内容Summary of the invention
本发明实施例提供了一种处理文件的方法、终端,以至少解决相关技术中采用对文件进行扫描或拍照的方式得到的图像像素损失比较严重的问题。The embodiment of the invention provides a method and a terminal for processing a file, so as to solve at least the problem that the pixel loss of the image obtained by scanning or photographing the file in the related art is serious.
根据本发明的一个方面,提供了一种处理文件的方法,包括:通过第一光对待处理文件进行图像数据采集,得到所述待处理文件的第一图像数据中像素点的颜色值以及所述第一图像数据的像素点在所述第一图像数 据中的第一坐标信息;通过第二光对所述待处理文件进行图像数据采集,得到所述待处理文件的第二图像数据中像素点的第一坐标信息;根据所述第一图像数据中像素点的颜色值对所述第二图像数据中与所述第一图像数据中像素点的坐标信息相对应的像素点进行调整。According to an aspect of the present invention, a method for processing a file includes: performing image data collection by a first light to be processed file, obtaining a color value of a pixel in the first image data of the to-be-processed file, and the First coordinate information of the pixel of the first image data in the first image data; image data acquisition of the file to be processed by the second light, to obtain a pixel point in the second image data of the file to be processed First coordinate information; adjusting pixel points corresponding to coordinate information of pixel points in the first image data in the second image data according to color values of pixel points in the first image data.
可选地,所述根据所述第一图像数据中像素点的颜色值对所述第二图像数据中与所述第一图像数据中像素点的坐标信息相对应的像素点进行调整包括:根据预设的多个颜色值区间对所述第一图像数据中的像素点进行分组,得到分组后的多个图层,其中,同一个图层中像素点的颜色值在同一个颜色值区间内;根据一个或多个图层中像素点的颜色值对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的颜色值进行调整,和/或对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的位置进行调整。Optionally, the adjusting, according to the color value of the pixel point in the first image data, the pixel point corresponding to the coordinate information of the pixel point in the first image data in the second image data comprises: Presetting a plurality of color value intervals to group the pixel points in the first image data to obtain a plurality of grouped layers, wherein color values of the pixel points in the same layer are in the same color value interval Adjusting, according to a color value of a pixel point in one or more layers, a color value of a pixel point corresponding to coordinate information of a pixel point in the one or more layers in the second image data, and/ Or adjusting a position of a pixel point corresponding to coordinate information of a pixel point in the one or more layers in the second image data.
可选地,所述根据一个或多个图层中像素点的颜色值对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的颜色值进行调整包括:将所述第二图像数据中除与所述多个图层中的第一图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第一图层的颜色值一致;其中,所述第一图层为所述待处理文件的底色图层。Optionally, the color value of the pixel point corresponding to the coordinate information of the pixel point in the one or more layers in the second image data according to the color value of the pixel point in the one or more layers The adjusting includes: adjusting, to the plurality of color values of the pixel points corresponding to the coordinate values other than the coordinate values corresponding to the first layer of the plurality of layers in the second image data The color values of the first layer in the layers are the same; wherein the first layer is the background layer of the file to be processed.
可选地,所述根据一个或多个图层中像素点的颜色值对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的颜色值进行调整包括:将所述第二图像数据中除与所述多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第二图层的颜色值一致;其中,所述第二图层为所述多个图层中的除底色图层外的其他图层,且所述第二图层包括一个或多个子图层。Optionally, the color value of the pixel point corresponding to the coordinate information of the pixel point in the one or more layers in the second image data according to the color value of the pixel point in the one or more layers The adjusting includes: adjusting, to the plurality of color values of the pixel points corresponding to the coordinate values other than the coordinate values corresponding to the second layer of the plurality of layers in the second image data The color values of the second layer in the plurality of layers are the same; wherein the second layer is another layer other than the ground layer in the plurality of layers, and the second layer includes One or more sublayers.
可选地,在所述第二图层包括多个子图层的情况下,在将所述第二图像数据中除与所述多个图层中的第二图层对应的坐标值之外的其他坐标 值对应的像素点的颜色值,调整至与所述多个图层中的第二图层的颜色值一致之后,将所述第二图像数据中与第二图层的颜色值一致的多个子图层中的部分子图层的颜色值调整至与第一图层的颜色值一致;其中,所述第一图层为所述待处理文件的底色图层;和/或,在将所述第二图像数据中除与所述多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第二图层的颜色值一致之后,将所述第二图像数据中与第二图层的颜色值一致的多个子图层中的一部分子分图层的颜色值调整至与所述多个子图层中的其中之一子图层的颜色值一致。Optionally, in the case that the second layer includes multiple sub-layers, the second image data is divided by the coordinate values corresponding to the second layer of the plurality of layers. After the color values of the pixel points corresponding to the other coordinate values are adjusted to be consistent with the color values of the second layer in the plurality of layers, the color values of the second image data are consistent with the color values of the second layer. The color values of the partial sub-layers of the plurality of sub-layers are adjusted to be consistent with the color values of the first layer; wherein the first layer is a ground color layer of the to-be-processed file; and/or Adjusting a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to the plurality of layers After the color values of the second layer are consistent, the color values of a part of the sub-layers of the plurality of sub-layers in the second image data that match the color values of the second layer are adjusted to be opposite to the plurality of sub-layers One of the sublayers in the layer has the same color value.
可选地,所述根据一个或多个图层中像素点的颜色值对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的位置进行调整包括:获取所述第一图像数据中的第二图层在所述第一坐标信息中的坐标信息;移动在所述第二图像数据中与第二图层的坐标信息对应的像素点的位置;其中,所述第二图层为所述多个图层中的除底色图层外的其他图层,且所述第二图层包括一个或多个子图层。Optionally, the performing, according to the color value of the pixel point in the one or more layers, the position of the pixel point in the second image data corresponding to the coordinate information of the pixel point in the one or more layers The adjusting includes: acquiring coordinate information of the second layer in the first coordinate data in the first coordinate information; and moving a pixel corresponding to the coordinate information of the second layer in the second image data a location; wherein the second layer is another layer other than the ground color layer of the plurality of layers, and the second layer includes one or more sub-layers.
可选地,所述第一光为不可见光,所述第二光为可见光。Optionally, the first light is invisible light, and the second light is visible light.
根据本发明的另一个方面,提供了一种终端,包括:补光灯组件,设置为发出第一光和第二光;摄像组件,设置为通过所述第一光对待处理文件进行图像数据采集,以及通过所述第二光对所述待处理文件进行图像数据采集;处理器,设置为根据所述第一光采集的图像数据得到所述待处理文件的第一图像数据中像素点的颜色值以及所述第一图像数据的像素点在所述第一图像数据中的第一坐标信息;以及根据所述第二光采集的图像数据得到所述待处理文件的第二图像数据中像素点的第一坐标信息;并根据所述第一图像数据中像素点的颜色值对所述第二图像数据中与所述第一图像数据中像素点的坐标信息相对应的像素点进行调整。According to another aspect of the present invention, a terminal is provided, comprising: a fill light assembly configured to emit first light and second light; and an image capture component configured to perform image data collection by the first light to be processed file And performing image data collection on the to-be-processed file by using the second light; and the processor is configured to obtain, according to the image data acquired by the first light, a color of a pixel in the first image data of the to-be-processed file a value and first coordinate information of the pixel of the first image data in the first image data; and obtaining pixel points in the second image data of the file to be processed according to the image data acquired by the second light First coordinate information; and adjusting pixel points corresponding to coordinate information of pixel points in the first image data in the second image data according to color values of pixel points in the first image data.
可选地,所述处理器,还设置为根据预设的多个颜色值区间对所述第一图像数据中的像素点进行分组,得到分组后的多个图层,其中,同一个 图层中像素点的颜色值在同一个颜色值区间内;以及根据一个或多个图层中像素点的颜色值对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的颜色值进行调整,和/或对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的位置进行调整。Optionally, the processor is further configured to group the pixels in the first image data according to a preset plurality of color value intervals to obtain a plurality of layers after the grouping, wherein the same layer The color values of the pixels in the same color value interval; and the coordinates of the pixel points in the second image data and the one or more layers according to the color values of the pixels in the one or more layers The color values of the pixel points corresponding to the information are adjusted, and/or the positions of the pixel points corresponding to the coordinate information of the pixel points in the one or more layers in the second image data are adjusted.
可选地,所述处理器,还设置为将所述第二图像数据中除与所述多个图层中的第一图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第一图层的颜色值一致;其中,所述第一图层为所述待处理文件的底色图层。Optionally, the processor is further configured to set, in the second image data, a color of a pixel corresponding to a coordinate value other than a coordinate value corresponding to the first layer of the plurality of layers a value adjusted to coincide with a color value of the first layer of the plurality of layers; wherein the first layer is a ground color layer of the file to be processed.
可选地,所述处理器,还设置为将所述第二图像数据中除与所述多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第二图层的颜色值一致;其中,所述第二图层为所述多个图层中的除底色图层外的其他图层,且所述第二图层包括一个或多个子图层。Optionally, the processor is further configured to set, in the second image data, a color of a pixel point corresponding to a coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers a value adjusted to be consistent with a color value of a second layer of the plurality of layers; wherein the second layer is a layer other than the underlying layer of the plurality of layers, And the second layer includes one or more sub-layers.
可选地,在所述第二图层包括多个子图层的情况下,所述处理器,还设置为在将所述第二图像数据中除与所述多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第二图层的颜色值一致之后,将所述第二图像数据中与第二图层的颜色值一致的多个子图层中的部分子图层的颜色值调整至与第一图层的颜色值一致;其中,所述第一图层为所述待处理文件的底色图层;和/或,在将所述第二图像数据中除与所述多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第二图层的颜色值一致之后,将所述第二图像数据中与第二图层的颜色值一致的多个子图层中的一部分子分图层的颜色值调整至与所述多个子图层中的其中之一子图层的颜色值一致。Optionally, in a case that the second layer includes multiple sub-layers, the processor is further configured to divide the second image data with a second one of the plurality of layers The color value of the pixel corresponding to the coordinate value other than the coordinate value of the layer is adjusted to be consistent with the color value of the second layer in the plurality of layers, and the second image data is The color values of the partial sub-layers of the plurality of sub-layers whose color values of the two layers are consistent are adjusted to be consistent with the color values of the first layer; wherein the first layer is the background color of the to-be-processed file a layer; and/or, adjusting a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to After matching the color values of the second layer of the plurality of layers, color of a portion of the plurality of sub-layers in the second image data that are consistent with the color values of the second layer The value is adjusted to coincide with a color value of one of the plurality of sub-layers.
可选地,所述处理器,还设置为获取所述第一图像数据中的第二图层在所述第一坐标信息中的坐标信息;移动在所述第二图像数据中与第二图 层的坐标信息对应的像素点的位置;其中,所述第二图层为所述多个图层中的除底色图层外的其他图层,且所述第二图层包括一个或多个子图层。Optionally, the processor is further configured to acquire coordinate information of the second layer in the first image data in the first coordinate information; and move in the second image data and the second image a position of the pixel corresponding to the coordinate information of the layer; wherein the second layer is another layer other than the ground layer in the plurality of layers, and the second layer includes one or more Sublayers.
可选地,所述摄像组件包括:滤光切换组件和感光组件;其中,在所述滤光组件滤掉所述第二光的情况下,所述感光组件通过所述第一光对待处理文件进行图像数据采集;在所述滤光组件滤掉所述第一光的情况下,所述感光组件通过所述第二光对待处理文件进行图像数据采集。Optionally, the camera assembly includes: a filter switching component and a photosensitive component; wherein, in a case where the filter component filters out the second light, the photosensitive component processes a file by using the first light Performing image data acquisition; in the case that the filter component filters out the first light, the photosensitive component performs image data acquisition by the second light to be processed file.
可选地,所述第一光为不可见光,所述第二光为可见光。Optionally, the first light is invisible light, and the second light is visible light.
根据本发明的又一个实施例,还提供了一种存储介质,所述存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。According to still another embodiment of the present invention, there is also provided a storage medium having stored therein a computer program, wherein the computer program is configured to execute the steps of any one of the method embodiments described above.
根据本发明的又一个实施例,还提供了一种电子装置,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行上述任一项方法实施例中的步骤。According to still another embodiment of the present invention, there is also provided an electronic device comprising a memory and a processor, wherein the memory stores a computer program, the processor being arranged to run the computer program to perform any of the above The steps in the method embodiments.
通过本发明实施例,通过第一光对待处理文件进行图像数据采集,得到待处理文件的第一图像数据中像素点的颜色值以及第一图像的像素点在第一图像数据中的第一坐标信息;通过第二光对待处理文件进行图像数据采集,得到待处理文件的第二图像数据中像素点的第一坐标信息;根据第一图像数据中像素点的颜色值对第二图像数据中与第一图像数据中像素点的坐标信息相对应的像素点进行调整,从而解决了相关技术中采用对文件进行扫描或拍照的方式得到的图像像素损失比较严重的问题,提高了用户的体验效果。According to the embodiment of the present invention, the image data is collected by the first light to be processed file, and the color value of the pixel in the first image data of the file to be processed and the first coordinate of the pixel of the first image in the first image data are obtained. Information; collecting image data by using the second light to be processed file, obtaining first coordinate information of pixel points in the second image data of the file to be processed; and comparing the color value of the pixel point in the first image data to the second image data The pixel points corresponding to the coordinate information of the pixel points in the first image data are adjusted, thereby solving the problem that the pixel loss of the image obtained by scanning or photographing the file in the related art is relatively serious, and the user experience is improved.
附图说明DRAWINGS
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The drawings described herein are intended to provide a further understanding of the invention, and are intended to be a part of the invention. In the drawing:
图1是根据本发明实施例的处理文件的方法的流程图;1 is a flow chart of a method of processing a file in accordance with an embodiment of the present invention;
图2是根据本发明实施例的处理文件的装置的结构示意图;2 is a schematic structural diagram of an apparatus for processing a file according to an embodiment of the present invention;
图3是根据本发明实施例的硬件位置结构示意图;3 is a schematic diagram of a hardware location structure according to an embodiment of the present invention;
图4是根据本发明实施例的摄像头的结构示意图;4 is a schematic structural view of a camera according to an embodiment of the present invention;
图5是根据本发明实施例的滤光切换模块的电路示意图;FIG. 5 is a circuit diagram of a filter switching module according to an embodiment of the invention; FIG.
图6是根据本发明实施例的终端结构示意图;6 is a schematic structural diagram of a terminal according to an embodiment of the present invention;
图7是根据本发明实施例的不可见光数据形成的正态分布图。7 is a normal distribution diagram of invisible light data formation in accordance with an embodiment of the present invention.
具体实施方式detailed description
下文中将参考附图并结合实施例来详细说明本发明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。The invention will be described in detail below with reference to the drawings in conjunction with the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。It is to be understood that the terms "first", "second" and the like in the specification and claims of the present invention are used to distinguish similar objects, and are not necessarily used to describe a particular order or order.
实施例1Example 1
在本实施例中提供了一种处理文件的方法,图1是根据本发明实施例的处理文件的方法的流程图,如图1所示,该流程包括如下步骤:In this embodiment, a method for processing a file is provided. FIG. 1 is a flowchart of a method for processing a file according to an embodiment of the present invention. As shown in FIG. 1, the process includes the following steps:
步骤S102:通过第一光对待处理文件进行图像数据采集,得到待处理文件的第一图像数据中像素点的颜色值以及第一图像数据的像素点在第一图像数据中的第一坐标信息;Step S102: Perform image data collection by using the first light to be processed file, and obtain color values of pixel points in the first image data of the file to be processed and first coordinate information of the pixel points of the first image data in the first image data;
步骤S104:通过第二光对待处理文件进行图像数据采集,得到待处理文件的第二图像数据中像素点的第一坐标信息;Step S104: Perform image data collection by using the second light to be processed file, and obtain first coordinate information of pixel points in the second image data of the file to be processed;
步骤S106:根据第一图像数据中像素点的颜色值对第二图像数据中与第一图像数据中像素点的坐标信息相对应的像素点进行调整。Step S106: Adjust, according to the color value of the pixel point in the first image data, the pixel point corresponding to the coordinate information of the pixel point in the first image data in the second image data.
通过本实施例的上述步骤S102至步骤S106,根据第一光和第二光分别对待处理文件进行处理分别得到第一图像数据和第二图像数据,进而根据第一图像数据中像素点的颜色值对第二图像数据中与第一图像数据中 像素点的坐标信息相对应的像素点进行调整,采用本实施例的方式,能够对采集到的待处理文件的图像数据进行调整,从而解决了相关技术中采用对文件进行扫描或拍照的方式得到的图像像素损失比较严重的问题,提高了用户的体验效果。Through the above steps S102 to S106 of the embodiment, respectively processing the file to be processed according to the first light and the second light to obtain the first image data and the second image data respectively, and further according to the color value of the pixel in the first image data. Adjusting the pixel points corresponding to the coordinate information of the pixel points in the first image data in the second image data, and adopting the method of the embodiment, the image data of the collected file to be processed can be adjusted, thereby solving the correlation In the technology, the problem that the pixel loss of the image obtained by scanning or photographing the file is serious is serious, and the user experience is improved.
需要说明的是,本实施例的方法的执行主体优选为智能终端。另外,本实施例中涉及到的颜色值,可以是灰度值、RGB(三原色光模式)或者其他格式的颜色值。It should be noted that the execution body of the method of this embodiment is preferably a smart terminal. In addition, the color values involved in this embodiment may be gray values, RGB (three primary color light modes), or color values of other formats.
步骤S106中根据第一图像数据中像素点的颜色值对第二图像数据中与第一图像数据中像素点的坐标信息相对应的像素点进行调整的方式,在本实施例的可选实施方式中可以进一步包括:In step S106, according to the color value of the pixel point in the first image data, the pixel corresponding to the coordinate information of the pixel point in the first image data in the second image data is adjusted, in an optional implementation manner of this embodiment. Can further include:
步骤S106-1:根据预设的多个颜色值区间对第一图像数据中的像素点进行分组,得到分组后的多个图层,其中,同一个图层中像素点的颜色值在同一个颜色值区间内;Step S106-1: grouping the pixels in the first image data according to the preset plurality of color value intervals to obtain a plurality of layers after the grouping, wherein the color values of the pixels in the same layer are in the same Within the color value interval;
步骤S106-2:根据一个或多个图层中像素点的颜色值对第二图像数据中与一个或多个图层中像素点的坐标信息相对应的像素点的颜色值进行调整,和/或对第二图像数据中与一个或多个图层中像素点的坐标信息相对应的像素点的位置进行调整。Step S106-2: adjusting, according to the color value of the pixel point in the one or more layers, the color value of the pixel point corresponding to the coordinate information of the pixel point in the one or more layers in the second image data, and/ Or adjusting the position of the pixel point corresponding to the coordinate information of the pixel point in the one or more layers in the second image data.
下面通过具体实施方式对上述步骤S106-1和S106-2进行详细说明;The above steps S106-1 and S106-2 will be described in detail through specific embodiments;
(1)通过第一光得到待处理文件的数据数组X,对数组X进行二值化处理,取数组X中的Y值,对于某一像素点的Y值;需要说明的是,在数字图像处理中,有一个数据格式是YUV格式,这个数据也是摄像头采集到的数据格式,数组X的每一个元素都是颜色值,包含三个数据,YUV,后面处理的Y,就是YUV中的Y。(1) obtaining the data array X of the file to be processed by the first light, binarizing the array X, taking the Y value in the array X, and the Y value for a certain pixel point; it should be noted that in the digital image In processing, there is a data format of YUV format. This data is also the data format captured by the camera. Each element of array X is a color value, containing three data, YUV, and Y processed later, which is Y in YUV.
当Y>M(门限值)时,Y=255;When Y>M (threshold value), Y=255;
当Y<M(门限值)时,Y=0;When Y < M (threshold value), Y=0;
采用上述全局二值化处理时,门限值M的取值可以取所有像素点的Y值的平均值。另外此处可以采用局部二值化,就是按照一定的规则将整幅 图像划分为N个窗口,对这N个窗口中的每一个窗口再按照一个统一的阈值M将该窗口内的像素划分为两部分,进行二值化处理,局部二值化时可以采用精度更高的自适应门限值方式。该方法的阈值是通过对该窗口像素的平均值E,像素之间的差平方P,像素之间的均方根值Q等各种局部特征,设定一个参数方程进行阈值的计算,例如:M=a*E+b*P+c*Q,其中a,b,c是自由参数。另外M值的确认也可以采用双峰法,P为参数法,迭代法,OTSU法等。When the above global binarization processing is used, the value of the threshold value M can take the average value of the Y values of all the pixel points. In addition, local binarization can be used here, that is, according to a certain rule, the whole image is divided into N windows, and each of the N windows is divided into pixels according to a uniform threshold M. Two parts are binarized, and a higher precision adaptive threshold method can be used for local binarization. The threshold of the method is to calculate a threshold by setting a parameter equation by using the average value E of the window pixels, the squared difference P between the pixels, and the root mean square value Q between the pixels, for example: M = a * E + b * P + c * Q, where a, b, c are free parameters. In addition, the M value can also be confirmed by the bimodal method, and P is a parameter method, an iterative method, an OTSU method, or the like.
记录所有Y=255的点的坐标值,Y=255的区域为底色区域。对应纸质文档来说就是纸张的颜色,即底色区域,记录底色区域点的坐标值为D。其余点的坐标为文字区域。底色区域和文字区域的坐标值在可见光图像和不可见光图像中是一一对应,保持一致的。The coordinate values of all the points of Y=255 are recorded, and the area of Y=255 is the background area. Corresponding to the paper document is the color of the paper, that is, the background area, and the coordinate value of the point of the recording background area is D. The coordinates of the remaining points are the text areas. The coordinate values of the ground color region and the text region are one-to-one correspondence between the visible light image and the invisible light image, and are consistent.
(2)数组X取所有坐标点的Y值的数组。将该数组中底色区域的Y值全部置0,形成一个矫正的数组Ye,利用Ye的值进行正态分布处理,其中,横坐标为Ye的值,纵坐标为坐标点的数量。(2) Array X takes an array of Y values of all coordinate points. The Y values of the underlying regions in the array are all set to 0 to form a corrected array Ye, and the normal distribution processing is performed using the value of Ye, wherein the abscissa is the value of Ye and the ordinate is the number of coordinate points.
(3)根据Ye的分布曲线,可以获取图像数组中的几个波峰,每个波峰对应一个图层,选取面积最大的波峰点值Y0,满足Y0-M0<Ye<Y0+M0(此处的M0为此波峰分布的门限值,可以取次分布的方差)的点即为该波峰对应图层的点,将这些点的坐标进行存储记为图层0,坐标数据存于数组W中。(3) According to the distribution curve of Ye, several peaks in the image array can be obtained, each peak corresponds to one layer, and the peak value Y0 of the largest area is selected, which satisfies Y0-M0<Ye<Y0+M0 (here The point at which M0 is the threshold value of the peak distribution, and the variance of the secondary distribution can be taken as the point corresponding to the layer of the peak, and the coordinates of these points are stored as layer 0, and the coordinate data is stored in the array W.
(4)以此类推,分布获取图层1和图层2,当某个图层的点的个数小于门限值Mt时,停止图层分配。(4) By analogy, the distribution acquires layer 1 and layer 2, and when the number of points of a certain layer is less than the threshold value Mt, the layer assignment is stopped.
(5)图层1、图层2…图层N之外的所有点坐标进行存储,分别记为数组Z1,数据Z2…数组ZN记为注释图层。(5) Layer 1, Layer 2... All point coordinates other than layer N are stored, and are recorded as array Z1, and data Z2... array ZN is recorded as an annotation layer.
获取底色图层、图层0、图层1、图层2…之后,每一个图层的点对应相应的颜色值。得到了将不同颜色值进行分离的图像数据。After getting the background layer, layer 0, layer 1, layer 2, ..., the points of each layer correspond to the corresponding color values. Image data obtained by separating different color values is obtained.
得到最终的可见光图像数据与图层数据之后,***可以利用这些数据进行进一步的处理。对应关系如下:After the final visible image data and layer data are obtained, the system can use the data for further processing. The correspondence is as follows:
第一光图像——数组XFirst light image - array X
底色图层——数组DBackground layer - array D
图层0——数组WLayer 0 - Array W
图层1——数组Z1Layer 1 - array Z1
图层2——数组Z2Layer 2 - array Z2
对于最常见的单色印刷书籍用户用笔做注释的情况如下所示:For the most common monochrome printed book users, the pen is annotated as follows:
底色图层--数组D,对应在可见光中的颜色即为纸张的颜色,取所有数组D内元素的平均值,得到纸张的平均颜色。Background layer - array D, the color corresponding to visible light is the color of the paper, taking the average of all the elements in the array D to get the average color of the paper.
图层0--数组W,图层0是取红外图像数组D的分布中波峰面积最大的一种颜色对应的图层,对于印刷体文档来说,除去底色图层,分布最多的应该是印刷文字部分,那么图层0就对应着印刷体部分的数据,数组D即为印刷体所在的坐标位置。Layer 0 - array W, layer 0 is the layer corresponding to the color with the largest peak area in the distribution of the infrared image array D. For the printed document, the background layer is removed, the most distributed should be In the printed text part, layer 0 corresponds to the data of the printed part, and array D is the coordinate position where the printed body is located.
图层1、图层2这些图层对应即为文档中注释部分,每一个图层正态分布峰值对应的Y值的不同,是不同颜色在红外光成像下的亮度不同导致的,那么一个图层对应着一种颜色,坐标位置分布为Z1,Z2。Layer 1 and Layer 2 correspond to the annotations in the document. The difference in the Y value corresponding to the peak of the normal distribution of each layer is caused by the difference in brightness of different colors under infrared light imaging. The layer corresponds to a color, and the coordinate position distribution is Z1, Z2.
基于上述(1)~(5),在本实施例的可选实施方式中,步骤S106-2的方式包括以下可选实施方式:Based on the above (1) to (5), in an optional implementation manner of this embodiment, the manner of step S106-2 includes the following optional implementation manners:
方式一:将第二图像数据中除与多个图层中的第一图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与多个图层中的第一图层的颜色值一致;其中,第一图层为待处理文件的底色图层。Manner 1: Adjust the color value of the pixel corresponding to the coordinate value other than the coordinate value corresponding to the first layer of the plurality of layers in the second image data to the first of the plurality of layers The layer has the same color value; the first layer is the underlying layer of the file to be processed.
在具体的应用场景中,该方式可以是文档还原:取数组X,计算底色图层的D颜色平均值D0,将数组X中Z1、Z2等所有的注释图层坐标值对应的颜色值修改为D0,即将图层1、图层2等注释部分的数据填充为底层图层的颜色平均值,得到数组A0,那么A0即为还原后的文档。此外,还可以进行文字识别等操作。In a specific application scenario, the method may be document restoration: taking an array X, calculating a D color average value D0 of the underlying layer, and modifying the color values corresponding to all the annotation layer coordinate values of the array X, Z1, Z2, and the like. For D0, the data of the annotation part of layer 1, layer 2, etc. is filled into the color average of the bottom layer, and the array A0 is obtained, then A0 is the restored document. In addition, you can perform operations such as text recognition.
方式二:将第二图像数据中除与多个图层中的第二图层对应的坐标值 之外的其他坐标值对应的像素点的颜色值,调整至与多个图层中的第二图层的颜色值一致;其中,第二图层为多个图层中的除底色图层外的其他图层,且第二图层包括一个或多个子图层。Manner 2: adjusting the color value of the pixel corresponding to the coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to the second of the plurality of layers The color values of the layers are the same; wherein the second layer is other layers than the underlying layer in the plurality of layers, and the second layer includes one or more sub-layers.
在具体的应用场景中,该方式可以是注释颜色区分:图层1、图层2等注释图层对应的坐标位置Z1、Z2即为不同颜色注释对应的坐标位置,在X中,取Z1坐标点的所有像素点的颜色值的平均值,记为颜色1,那么颜色1即为图层1的颜色。相同的方法获取图层2的颜色2。In a specific application scenario, the method may be an annotation color distinction: coordinate positions Z1 and Z2 corresponding to annotation layers such as layer 1 and layer 2 are coordinate positions corresponding to different color annotations, and in X, Z1 coordinates are taken. The average value of the color values of all the pixels of the point is recorded as color 1, and then color 1 is the color of layer 1. The same method gets the color 2 of layer 2.
Z1——图层1——颜色1Z1 - Layer 1 - Color 1
Z2——图层2——颜色2Z2 - Layer 2 - Color 2
方式三:在第二图层包括多个子图层的情况下,在将第二图像数据中除与多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与多个图层中的第二图层的颜色值一致之后,将第二图像数据中与第二图层的颜色值一致的多个子图层中的部分子图层的颜色值调整至与第一图层的颜色值一致;其中,第一图层为待处理文件的底色图层;和/或,Manner 3: in the case where the second layer includes a plurality of sub-layers, the pixels corresponding to the coordinate values other than the coordinate values corresponding to the second layer of the plurality of layers in the second image data a color value adjusted to be consistent with a color value of a second layer in the plurality of layers, and a portion of the plurality of sub-layers in the second image data that are consistent with the color values of the second layer The color value is adjusted to be consistent with the color value of the first layer; wherein the first layer is a ground color layer of the file to be processed; and/or,
在将第二图像数据中除与多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与多个图层中的第二图层的颜色值一致之后,将第二图像数据中与第二图层的颜色值一致的多个子图层中的一部分子分图层的颜色值调整至与多个子图层中的其中之一子图层的颜色值一致。Adjusting a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to the second layer in the plurality of layers After the color values are consistent, the color values of a part of the sub-layers of the plurality of sub-layers in the second image data that are consistent with the color values of the second layer are adjusted to one of the plurality of sub-layers The color values of the layers are the same.
在具体的应用场景中,该方式可以是注释的隐藏与显示:在上述方式一和方式二的基础上,可以通过对数组A0的值进行处理,可以实现不同颜色注释的隐藏与显示,A0为原始文档,即为隐藏注释的文档;在A0数组中,把Z1对应坐标位置的点颜色值充为颜色1,填充后的数组即为显示颜色1的注释的图像。以此类推,可以得到显示颜色2的注释的图像,以及各种颜色组合注释的图像。In a specific application scenario, the method may be hiding and displaying of annotations: on the basis of the above manners 1 and 2, the value of the array A0 may be processed to realize hiding and displaying of different color annotations, A0 is The original document, that is, the document with hidden annotations; in the A0 array, the point color value corresponding to the coordinate position of Z1 is filled with the color 1, and the filled array is the image of the annotation displaying the color 1. By analogy, an image showing the annotation of color 2, and an image of the annotation of various color combinations can be obtained.
方式四:获取第一图像数据中的第二图层在第一坐标信息中的坐标信 息;移动在第二图像数据中与第二图层的坐标信息对应的像素点的位置;其中,第二图层为多个图层中的除底色图层外的其他图层,且第二图层包括一个或多个子图层。Manner 4: acquiring coordinate information of the second layer in the first coordinate information in the first coordinate data; moving the position of the pixel corresponding to the coordinate information of the second layer in the second image data; wherein, the second A layer is a layer other than the underlying layer in multiple layers, and the second layer includes one or more sublayers.
在具体的应用场景中,该方式可以是注释的移动:当某些注释位于印刷文字区域内时,可以将注释移动到空白部分。In a specific application scenario, this can be a movement of annotations: when some annotations are within the printed text area, the annotations can be moved to a blank portion.
例如:取图层0的数组W,对坐标值的数组W的值进行处理,取所有横坐标s的最小值s0与最大值s1,所有点纵坐标t的最小值t0和最大值t1,那么坐标点(s0,t0)(s0,t1)(s1,t0)(s1,t1)组成的矩形即为印刷体的区域,取图层1,图层2等注释图层中的Z1,Z2的横纵坐标sz和tz,当满足For example: taking the array W of the layer 0, processing the value of the array W of coordinate values, taking the minimum value s0 and the maximum value s1 of all the abscissas s, the minimum value t0 and the maximum value t1 of all the ordinates t, then The rectangle consisting of coordinate points (s0, t0) (s0, t1) (s1, t0) (s1, t1) is the area of the printed matter, taking Z1, Z2 in the annotation layer such as layer 1, layer 2, etc. Horizontal and vertical coordinates sz and tz, when satisfied
s0<sz<s1且t0<tz<t1S0<sz<s1 and t0<tz<t1
则该坐标位于印刷体区域内,对该坐标进行平移处理。Then the coordinates are located in the printed area, and the coordinates are translated.
sz(e)=sz+TsSz(e)=sz+Ts
tz(e)=tz+TtTz(e)=tz+Tt
横坐标平移量Ts,纵坐标平移量Tt由该坐标邻近的所有属于同一注释图层的坐标点集合计算获取。The abscissa shift amount Ts, the ordinate shift amount Tt is calculated and obtained by all the coordinate point sets belonging to the same annotation layer adjacent to the coordinate.
在数组A中,将调整后的sz(e)tz(e)对应的注释图层的坐标点的颜色值修改为对应的颜色,将原注释图层坐标点的颜色值修改为底色图层颜色值D0,即实现了注释的移动。In the array A, the color value of the coordinate point of the annotation layer corresponding to the adjusted sz(e)tz(e) is modified to the corresponding color, and the color value of the original annotation layer coordinate point is modified to the ground color layer. The color value D0, which implements the movement of the annotation.
需要说明的是,在本实施例中第一光为不可见光,第二光为可见光。不可见光,如红外光,在通过红外光直射时,不同颜色以及不同材质对不可见光的吸收率不同,反射的光线就不同,当红外光照射某一材质的不同颜色时,不同颜色部分在红外光下成像的颜色值就有所不同,通过颜色值的区分,就可以将不同颜色进行分类,也就是上面提到图层,每一个图层对应一个颜色。It should be noted that in the embodiment, the first light is invisible light and the second light is visible light. Invisible light, such as infrared light, when exposed to infrared light, different colors and different materials have different absorption rates for invisible light, and the reflected light is different. When infrared light illuminates different colors of a certain material, different color parts are in infrared. The color values of the images under the light are different. By distinguishing the color values, the different colors can be classified, that is, the layers mentioned above, and each layer corresponds to one color.
当然,不可见光也可以采用除红外线之外的其他光线,只要能实现对 不同颜色以及不同材质吸收率不同的光均是可以的。Of course, invisible light can also be used in addition to infrared rays, as long as light of different colors and different materials can be used.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, The optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, or a network device, etc.) to perform the methods of various embodiments of the present invention.
实施例2Example 2
在本实施例中还提供了一种处理文件的装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。In the embodiment, a device for processing a file is provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and has not been described again. As used below, the term "module" may implement a combination of software and/or hardware of a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
图2是根据本发明实施例的处理文件的装置的结构示意图,如图2所示,该装置包括:FIG. 2 is a schematic structural diagram of an apparatus for processing a file according to an embodiment of the present invention. As shown in FIG. 2, the apparatus includes:
第一采集模块22,设置为通过第一光对待处理文件进行图像数据采集,得到待处理文件的第一图像数据中像素点的颜色值以及第一图像的像素点在第一图像数据中的第一坐标信息;The first collection module 22 is configured to perform image data collection by using the first light to be processed file, and obtain a color value of a pixel in the first image data of the file to be processed and a pixel point of the first image in the first image data. a coordinate information;
第二采集模块24,与第一采集模块22耦合链接,设置为通过第二光对待处理文件进行图像数据采集,得到待处理文件的第二图像数据中像素点的第一坐标信息;The second collection module 24 is coupled to the first collection module 22 and configured to perform image data collection by using the second light to be processed file to obtain first coordinate information of the pixel in the second image data of the file to be processed.
调整模块26,与第二采集模块24耦合链接,设置为根据第一图像数据中像素点的颜色值对第二图像数据中与第一图像数据中像素点的坐标信息相对应的像素点进行调整。The adjustment module 26 is coupled to the second acquisition module 24 and configured to adjust, according to the color value of the pixel in the first image data, the pixel corresponding to the coordinate information of the pixel in the first image data in the second image data. .
需要说明的是,如果该装置应用到带有摄像模块的终端上,则该第一 采集模块22与第二采集模块24可以继承在该摄像模块上。It should be noted that if the device is applied to a terminal with a camera module, the first acquisition module 22 and the second acquisition module 24 can be inherited on the camera module.
在具体的应用场景中,该摄像模块可以通过两个部分组成上述第一采集模块22与第二采集模块24;In a specific application scenario, the camera module can form the first acquiring module 22 and the second collecting module 24 by two parts;
其中,该两个部分可以是:滤光切换模块和感光元件。该感光元件为常见CCD(全称为Charge-couple Device,即,电荷耦合原件)CMOS(全称为Complementary Metal Oxide Semiconductor,即,互补金属氧化物半导体)以及其他可以用作观光功能的元件,滤光切换模块有两层滤光片,分别为可见光滤光片和红外滤光片,其中,可见光滤光片可以过滤掉所有的非可见光谱,让感光元件只接收到可见光谱部分的图像,得到可见光图像,红外滤光片可以过滤掉所有的非红外光谱,让感光元件只接收到红外光谱部分的图像,得到红外图像。滤光切换模块为机械式,通过电信号控制可见滤光片和红外滤光片其中一个位于感光元件的前方,进行滤光作用,正常模式下,红外滤光片处于收起状态,感光元件采集可见光图像,在进行文档拍摄时,用户按下快门,滤光切换模块首先保持可见光滤光片工作,采集可将光图像,然后收起可将光滤光片,放下红外滤光片,采集红外图像。Wherein, the two parts may be: a filter switching module and a photosensitive element. The photosensitive element is a common CCD (collectively referred to as a charge-coupled device) CMOS (collectively referred to as Complementary Metal Oxide Semiconductor, ie, a complementary metal oxide semiconductor) and other components that can be used as a sightseeing function, and filter switching The module has two layers of filters, visible light filter and infrared filter, wherein the visible light filter can filter out all non-visible spectra, allowing the photosensitive element to receive only the image of the visible spectrum to obtain visible light image. The infrared filter can filter out all non-infrared spectra, allowing the photosensitive element to receive only the image of the infrared spectrum to obtain an infrared image. The filter switching module is mechanical, and one of the visible filter and the infrared filter is controlled by an electric signal to be in front of the photosensitive element for filtering. In the normal mode, the infrared filter is in a stowed state, and the photosensitive element is collected. In the visible light image, when the document is taken, the user presses the shutter, and the filter switching module first keeps the visible light filter working, collects the light image, then folds up the light filter, drops the infrared filter, and collects the infrared light. image.
可选地,调整模块包括:分组单元,设置为根据预设的多个颜色值区间对第一图像数据中的像素点进行分组,得到分组后的多个图层,其中,同一个图层中像素点的颜色值在同一个颜色值区间内;调整单元,与分组单元耦合链接,设置为根据一个或多个图层中像素点的颜色值对第二图像数据中与一个或多个图层中像素点的坐标信息相对应的像素点的颜色值进行调整,和/或对第二图像数据中与一个或多个图层中像素点的坐标信息相对应的像素点的位置进行调整。Optionally, the adjusting module includes: a grouping unit, configured to group the pixels in the first image data according to the preset plurality of color value intervals, to obtain the plurality of layers after the grouping, wherein, in the same layer The color value of the pixel is in the same color value interval; the adjusting unit is coupled with the grouping unit, and is set to correspond to one or more layers in the second image data according to the color value of the pixel in the one or more layers The color values of the pixel points corresponding to the coordinate information of the middle pixel are adjusted, and/or the positions of the pixel points corresponding to the coordinate information of the pixel points in the one or more layers in the second image data are adjusted.
对于上述调整单元涉及到的调整像素点的颜色值和/或像素点的位置进行调整的方式,在本实施例的实施方式中可以通过如下几种方式来实现。The manner of adjusting the color value of the pixel and/or the position of the pixel to be adjusted by the above-mentioned adjustment unit can be implemented in the following embodiments in the embodiment.
方式一:该调整单元,还设置为将第二图像数据中除与多个图层中的 第一图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与多个图层中的第一图层的颜色值一致;其中,第一图层为待处理文件的底色图层。Manner 1: The adjustment unit is further configured to adjust the color value of the pixel point corresponding to the coordinate value other than the coordinate value corresponding to the first layer of the plurality of layers in the second image data to be more The color values of the first layer in the layer are the same; the first layer is the background layer of the file to be processed.
该方式对应于实施例一中步骤S106-2的方式一,即该方式在具体的应用场景中为文档还原方式。This mode corresponds to the first mode of the step S106-2 in the first embodiment, that is, the mode is a file restoration mode in a specific application scenario.
方式二,该调整单元,还设置为将第二图像数据中除与多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与多个图层中的第二图层的颜色值一致;其中,第二图层为多个图层中的除底色图层外的其他图层,且第二图层包括一个或多个子图层。In the second mode, the adjusting unit is further configured to adjust the color value of the pixel corresponding to the coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to be more The second layer in each layer has the same color value; wherein the second layer is other layers than the underlying layer in the plurality of layers, and the second layer includes one or more sublayers .
该方式对应于实施例一中步骤S106-2的方式二,即该方式在具体的应用场景中为注释颜色区分。This mode corresponds to the second mode of step S106-2 in the first embodiment, that is, the mode is distinguished by the annotation color in a specific application scenario.
方式三,该调整单元,还设置为将第二图像数据中除与多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与多个图层中的第二图层的颜色值一致;其中,第二图层为多个图层中的除底色图层外的其他图层,且第二图层包括一个或多个子图层。In a third manner, the adjusting unit is further configured to adjust the color value of the pixel corresponding to the coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to be more The second layer in each layer has the same color value; wherein the second layer is other layers than the underlying layer in the plurality of layers, and the second layer includes one or more sublayers .
该方式对应于实施例一中步骤S106-2的方式三,即该方式在具体的应用场景中为注释的隐藏与显示。This mode corresponds to the third mode of the step S106-2 in the first embodiment, that is, the mode is hidden and displayed in the specific application scenario.
方式四,该调整单元,还设置为获取第一图像数据中的第二图层在第一坐标信息中的坐标信息;移动在第二图像数据中与第二图层的坐标信息对应的像素点的位置;其中,第二图层为多个图层中的除底色图层外的其他图层,且第二图层包括一个或多个子图层。And the adjusting unit is further configured to acquire coordinate information of the second layer in the first coordinate data in the first coordinate information; and move the pixel corresponding to the coordinate information of the second layer in the second image data a location; wherein the second layer is a layer other than the ground layer in the plurality of layers, and the second layer includes one or more sub-layers.
该方式对应于实施例一中步骤S106-2的方式四,即该方式在具体的应用场景中为注释的移动。This mode corresponds to the fourth mode of step S106-2 in the first embodiment, that is, the mode is the movement of the annotation in a specific application scenario.
在本实施例的可选实施方式中,本实施例中涉及到的第一光可以为不可见光,第二光可以为可见光。In an optional implementation manner of this embodiment, the first light involved in this embodiment may be invisible light, and the second light may be visible light.
需要说明的是,本实施例2是对应于实施例1的装置实施例,因此,本实施例中的模块和单元所实现的方式与上述方法步骤是一致的。It should be noted that the second embodiment is an apparatus embodiment corresponding to the first embodiment. Therefore, the manners implemented by the modules and units in this embodiment are consistent with the above method steps.
需要说明的是,上述各个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述各个模块以任意组合的形式分别位于不同的处理器中。It should be noted that each of the above modules may be implemented by software or hardware. For the latter, the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the above modules are in any combination. The forms are located in different processors.
实施例3Example 3
本实施例提供了一种终端,如图6所示,该终端包括:This embodiment provides a terminal. As shown in FIG. 6, the terminal includes:
补光灯组件62,设置为发出第一光和第二光;a fill light assembly 62 configured to emit first light and second light;
摄像组件64,与该补光灯组件62耦合链接,设置为通过第一光对待处理文件进行图像数据采集,以及通过第二光对待处理文件进行图像数据采集;The camera assembly 64 is coupled to the fill light assembly 62, configured to perform image data collection by the first light to be processed file, and image data collection by the second light to be processed file;
处理器66,与该摄像组件64耦合链接,设置为根据第一光采集的图像数据得到待处理文件的第一图像数据中像素点的颜色值以及第一图像的像素点在第一图像数据中的第一坐标信息;以及根据第二光采集的图像数据得到待处理文件的第二图像数据中像素点的第一坐标信息;并根据第一图像数据中像素点的颜色值对第二图像数据中与第一图像数据中像素点的坐标信息相对应的像素点进行调整。The processor 66 is coupled to the camera component 64 and configured to obtain, according to the image data acquired by the first light, a color value of a pixel in the first image data of the file to be processed and a pixel of the first image in the first image data. The first coordinate information; and the first coordinate information of the pixel in the second image data of the file to be processed according to the image data acquired by the second light; and the second image data according to the color value of the pixel in the first image data The pixel points corresponding to the coordinate information of the pixel points in the first image data are adjusted.
其中,在本实施例的可选实施方式中,该处理器,还设置为根据预设的多个颜色值区间对第一图像数据中的像素点进行分组,得到分组后的多个图层,其中,同一个图层中像素点的颜色值在同一个颜色值区间内;以及根据一个或多个图层中像素点的颜色值对第二图像数据中与一个或多个图层中像素点的坐标信息相对应的像素点的颜色值进行调整,和/或对第二图像数据中与一个或多个图层中像素点的坐标信息相对应的像素点的位置进行调整。In an optional implementation manner of the embodiment, the processor is further configured to group the pixels in the first image data according to the preset plurality of color value intervals to obtain the plurality of layers after the grouping. Wherein the color values of the pixels in the same layer are within the same color value interval; and the pixel values in the second image data and the one or more layers according to the color values of the pixels in the one or more layers The coordinate information corresponds to the color value of the pixel point, and/or the position of the pixel point in the second image data corresponding to the coordinate information of the pixel point in the one or more layers is adjusted.
基于上述处理器根据一个或多个图层中像素点的颜色值对第二图像数据中与一个或多个图层中像素点的坐标信息相对应的像素点的颜色值进行调整,和/或对第二图像数据中与一个或多个图层中像素点的坐标信息相对应的像素点的位置进行调整的方式,在本实施例的可选实施方式中,该处理器还可以通过如下方式来具体实现上述方式:And adjusting, according to the color value of the pixel point in the one or more layers, the color value of the pixel point corresponding to the coordinate information of the pixel point in the one or more layers in the second image data, and/or For adjusting the position of the pixel point corresponding to the coordinate information of the pixel point in the one or more layers in the second image data, in an optional implementation manner of the embodiment, the processor may also be configured as follows To achieve the above method:
方式一:处理器设置为将第二图像数据中除与多个图层中的第一图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与多个图层中的第一图层的颜色值一致;其中,第一图层为待处理文件的底色图层。Manner 1: The processor is configured to adjust the color value of the pixel corresponding to the coordinate value other than the coordinate value corresponding to the first layer of the plurality of layers in the second image data to the plurality of layers The color values of the first layer in the same are consistent; wherein the first layer is the background layer of the file to be processed.
方式二:处理器设置为将第二图像数据中除与多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与多个图层中的第二图层的颜色值一致;其中,第二图层为多个图层中的除底色图层外的其他图层,且第二图层包括一个或多个子图层。Manner 2: The processor is configured to adjust the color value of the pixel corresponding to the coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to the plurality of layers The second layer has the same color value; wherein the second layer is other layers than the underlying layer in the plurality of layers, and the second layer includes one or more sub-layers.
方式三:在第二图层包括多个子图层的情况下,处理器,设置为在将第二图像数据中除与多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与多个图层中的第二图层的颜色值一致之后,将第二图像数据中与第二图层的颜色值一致的多个子图层中的部分子图层的颜色值调整至与第一图层的颜色值一致;其中,第一图层为待处理文件的底色图层;和/或,Manner 3: In a case where the second layer includes a plurality of sub-layers, the processor is configured to divide the second image data by other coordinates than the coordinate values corresponding to the second layer of the plurality of layers After the color value of the pixel corresponding to the value is adjusted to be consistent with the color value of the second layer in the plurality of layers, the second image data is in the plurality of sub-layers that are consistent with the color value of the second layer The color values of the partial sub-layers are adjusted to be consistent with the color values of the first layer; wherein the first layer is the underlying layer of the file to be processed; and/or,
在将第二图像数据中除与多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与多个图层中的第二图层的颜色值一致之后,将第二图像数据中与第二图层的颜色值一致的多个子图层中的一部分子分图层的颜色值调整至与多个子图层中的其中之一子图层的颜色值一致。Adjusting a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to the second layer in the plurality of layers After the color values are consistent, the color values of a part of the sub-layers of the plurality of sub-layers in the second image data that are consistent with the color values of the second layer are adjusted to one of the plurality of sub-layers The color values of the layers are the same.
方式四:处理器设置为获取第一图像数据中的第二图层在第一坐标信息中的坐标信息;移动在第二图像数据中与第二图层的坐标信息对应的像素点的位置;其中,第二图层为多个图层中的除底色图层外的其他图层,且第二图层包括一个或多个子图层。Manner 4: The processor is configured to acquire coordinate information of the second layer in the first coordinate data in the first coordinate information; and move a position of the pixel corresponding to the coordinate information of the second layer in the second image data; The second layer is a layer other than the ground layer in the plurality of layers, and the second layer includes one or more sub-layers.
可选地,摄像组件包括:滤光切换组件和感光组件;Optionally, the camera assembly comprises: a filter switching component and a photosensitive component;
其中,在滤光组件滤掉第二光的情况下,感光组件通过第一光对待处理文件进行图像数据采集;在滤光组件滤掉第一光的情况下,感光组件通过第二光对待处理文件进行图像数据采集。Wherein, in the case that the filter component filters out the second light, the photosensitive component performs image data acquisition by the first light to be processed file; and in the case that the filter component filters out the first light, the photosensitive component is processed by the second light The file is used for image data acquisition.
需要说明的是,本实施例中的第一光可以为不可见光,第二光可以为 可见光。It should be noted that the first light in this embodiment may be invisible light, and the second light may be visible light.
实施例4Example 4
下面结合本发明的可选实施例的对本发明实施例的进行举例说明;The embodiments of the present invention are exemplified below in conjunction with the optional embodiments of the present invention;
本可选实施例提供了利用不可见光处理文档图像的装置,其中,硬件部分该装置包括:中央处理器模块(对应于实施例3中的处理器)、摄像头模块(对应于实施例3中的摄像组件)、不可见光的补光模块(对应于实施例3中的补光灯组件);其中,中央处理器模块,设置为进行图像数据的处理工作;摄像头模块设置为拍摄包含不可见光光谱的图像数据源,并且能够通过硬件或者软件处理的方式对不可见光和可见光部分分别进行分离,并传输到中央处理器进行处理。不可见光补光模块,设置为发射不可见光的补光灯,通过总线与中央处理模块控制相连接,并受中央处理器控制其开关状态。The present optional embodiment provides an apparatus for processing a document image by using invisible light, wherein the hardware part comprises: a central processing unit module (corresponding to the processor in the embodiment 3), a camera module (corresponding to the embodiment 3) a camera component), a non-visible light fill module (corresponding to the fill light component in Embodiment 3); wherein the central processing unit is configured to perform image data processing; and the camera module is configured to capture an invisible light spectrum An image data source, and the invisible light and visible light portions can be separately separated by hardware or software processing and transmitted to a central processing unit for processing. The invisible light filling module is set to be a fill light emitting invisible light, connected to the central processing module through a bus, and controlled by the central processor.
基于上述硬件模块,对本可选实施例利用不可见光处理文档图像的流程进行说明:首先,启动文档拍摄功能,设备进入文档拍摄模式以启动拍摄模块以及图像处理模块;其次,触发拍摄模块控制不可见光补光灯打开,进而拍摄模块控制摄像头进行图像数据采集,分别采集其中的不可见光部分和可见光部分,分别存到两个图像格式中。Based on the foregoing hardware module, the flow of processing the document image by using the invisible light is described in the optional embodiment: first, the document shooting function is started, the device enters the document shooting mode to start the shooting module and the image processing module; secondly, the triggering shooting module controls the invisible light The fill light is turned on, and then the shooting module controls the camera to collect image data, and separately collects the invisible light portion and the visible light portion thereof, and respectively stores them in two image formats.
此外,图像处理模块对不可见光部分进行分析处理,根据不可见光照射在不同颜色上的反射率的不同,导致图像中各个像素点的亮度值会不同,对于颜色值相近的像素点进行归类处理,这部分像素点就为同一图层的像素点,并将像素点位置进行记录,分别将不同图层的像素点位置存储到不同数组中。将不同图层的像素点位置的数组与可见光图像中的像素点相对应,将不同图层的图像分别提取出来,并分别存储;最后,根据用户要求对不同图层图像进行进一步处理。In addition, the image processing module analyzes and processes the invisible light portion, and according to the difference in reflectance of the invisible light irradiation on different colors, the brightness value of each pixel in the image is different, and the pixel points with similar color values are classified. This part of the pixel is the pixel of the same layer, and the pixel position is recorded, and the pixel positions of different layers are stored in different arrays. The array of pixel positions of different layers is corresponding to the pixels in the visible light image, and the images of different layers are separately extracted and stored separately; finally, different layer images are further processed according to user requirements.
图3是根据本发明实施例的硬件位置结构示意图,如图3所示,摄像头模块与不可见光补光灯模块处于同一平面,保证摄像头模块可以采集到不可见光补光灯发出的不可见光;此外,本可选实施例中的不可见光补光 灯有两个光源,一个光源发出可见光,用于拍照时的闪光灯使用;另一个光源可以发出红外光,用于红外补光。红外线对于人眼是不可见的,但是对于本实施例中的摄像头,可以采集到红外光谱部分以及可见光光谱部分。并且可以通过滤镜或者软件,可以分别过滤出红外光谱部分的图像和可见光光谱部分的图像。3 is a schematic diagram of a hardware location structure according to an embodiment of the present invention. As shown in FIG. 3, the camera module and the invisible fill light module are in the same plane, so that the camera module can collect the invisible light emitted by the invisible fill light; The invisible fill light in the alternative embodiment has two light sources, one light source emits visible light and is used for flashing when photographing; the other light source can emit infrared light for infrared fill light. The infrared ray is invisible to the human eye, but for the camera in this embodiment, the infrared spectrum portion and the visible light spectrum portion can be acquired. And the image of the infrared spectrum portion and the image of the visible light spectrum portion can be separately filtered by a filter or software.
图4是根据本发明实施例的摄像头的结构示意图,如图4所示,该摄像头有两个部分组成,分别为滤光切换模块(对应于实施例3总的滤光切换组件)以及感光元件(对应于实施例3中的感光组件)以及其他必须的组成部分,感光元件为常见CCD CMOS以及其他可以用作观光功能的元件,滤光切换模块有两层滤光片,分别为可见光滤光片和红外滤光片,其中,可见光滤光片可以过滤掉所有的非可见光谱,让感光元件只接收到可见光谱部分的图像,得到可见光图像,红外滤光片可以过滤掉所有的非红外光谱,让感光元件只接收到红外光谱部分的图像,得到红外图像。滤光切换模块为机械式,通过电信号控制可见滤光片和红外滤光片其中一个位于感光元件的前方,进行滤光作用,正常模式下,红外滤光片处于收起状态,感光元件采集可见光图像,在进行文档拍摄时,用户按下快门,滤光切换模块首先保持可见光滤光片工作,采集可将光图像,然后收起可将光滤光片,放下红外滤光片,采集红外图像。4 is a schematic structural diagram of a camera according to an embodiment of the present invention. As shown in FIG. 4, the camera has two parts, which are respectively a filter switching module (corresponding to the total filter switching component of Embodiment 3) and a photosensitive element. (corresponding to the photosensitive member in Embodiment 3) and other necessary components, the photosensitive element is a common CCD CMOS and other components that can be used as a sightseeing function, and the filter switching module has two layers of filters, respectively, visible light filtering. A sheet and an infrared filter, wherein the visible light filter filters out all non-visible spectra, allowing the photosensitive element to receive only images of the visible portion of the spectrum to obtain visible light images, and the infrared filter can filter out all non-infrared spectra. The photosensitive element receives only the image of the infrared spectrum portion to obtain an infrared image. The filter switching module is mechanical, and one of the visible filter and the infrared filter is controlled by an electric signal to be in front of the photosensitive element for filtering. In the normal mode, the infrared filter is in a stowed state, and the photosensitive element is collected. In the visible light image, when the document is taken, the user presses the shutter, and the filter switching module first keeps the visible light filter working, collects the light image, then folds up the light filter, drops the infrared filter, and collects the infrared light. image.
需要说明的是,摄像头模块也可以采用软件处理方式,不增加滤光切换模块,通过感光元件采集所有光谱的信号,通过软件进行过滤,其中波长大于760nm的为红外光谱,波长小于760nm的为可见光谱。It should be noted that the camera module can also adopt software processing mode, without adding a filter switching module, collecting all spectral signals through the photosensitive element, and filtering by software, wherein the wavelength is greater than 760 nm for the infrared spectrum, and the wavelength for the wavelength less than 760 nm is visible. spectrum.
图5是根据本发明实施例的滤光切换模块的电路示意图,如图5所示,可见光滤光片与红外滤光片与切换模块之间通过支架相连,支架的顶端有永磁铁,两个滤光片的支架顶端的永磁铁磁极相反,如图5所示,正常拍照模式下,切换模块加正电压+V,连接切换模块底端磁极为N,则可见光滤光片支架同极排斥,向下延伸,挡在感光元件前方,红外滤光片顶支架异极相吸,向上收起,此时摄像头出于可见光拍摄模式。当摄像头模块收到***指令,拍摄红外照片时,切换模块加负电压-V,连接切换模块底端 磁极为S,则红外滤光片支架同极排斥,向下延伸,挡在感光元件前方,可见光滤光片顶支架异极相吸,向上收起,此时摄像头处于红外拍摄模式。FIG. 5 is a schematic circuit diagram of a filter switching module according to an embodiment of the present invention. As shown in FIG. 5, a visible light filter and an infrared filter are connected to a switching module through a bracket, and a top end of the bracket has a permanent magnet, two The magnetic pole of the permanent magnet at the top of the filter holder is opposite. As shown in Fig. 5, in the normal photographing mode, the switching module is applied with a positive voltage +V, and the magnetic pole of the bottom end of the switching module is N, the visible light filter holder is repelled by the same pole. It extends downwards and blocks in front of the photosensitive element. The infrared filter top bracket attracts the opposite poles and is lifted up. At this time, the camera is in visible light shooting mode. When the camera module receives the system command and takes an infrared photo, the switching module adds a negative voltage -V, and connects the magnetic pole S at the bottom end of the switching module, the infrared filter holder is repelled with the same pole, extending downward, and blocking in front of the photosensitive element. The visible light filter top bracket is attracted to the opposite pole and is lifted up. At this time, the camera is in infrared shooting mode.
需要说明的是,该滤光镜切换模块可以采用其他机械装置,通过不同的电信号控制滤光片的升起与落下。It should be noted that the filter switching module can adopt other mechanical devices to control the rise and fall of the filter through different electrical signals.
结合上述图3至图5对本实施例中的利用不可见光处理文档图像的步骤包括:The steps of processing the document image by using the invisible light in the embodiment in combination with the above-mentioned FIG. 3 to FIG. 5 include:
步骤S201:文档拍摄模式启动,补光灯进入红外线发射模式,此时补光灯的红外光源处于工作状态。摄像头进入文档拍摄模式,在滤光切换模块加正向电压+V。Step S201: The document shooting mode is started, and the fill light enters the infrared emission mode, and the infrared light source of the fill light is in a working state. The camera enters the document shooting mode and adds a forward voltage +V to the filter switching module.
步骤S202:用户拍照,摄像头模块控制补光灯发射红外线进行补光,同时***发送指令控制摄像头模块拍摄照片。Step S202: The user takes a picture, and the camera module controls the fill light to emit infrared light to fill the light, and the system sends a command to control the camera module to take a photo.
步骤S203:摄像头模块接收***拍摄指令后,维持滤光切换模块正向电压+V采集图像,采集到可见光图像,然后在滤光切换模块加负向电压-V,采集红外图像。Step S203: After receiving the system shooting instruction, the camera module maintains the forward switching voltage +V acquisition image of the filter switching module, collects the visible light image, and then adds the negative voltage -V to the filtering switching module to collect the infrared image.
其中,摄像头模块采集的图像格式为RAW格式,转换为YUV格式供下一步处理,分别存储在两个数组缓存中,可见光图像数据数组为A,红外图像数据数组为B。The image format captured by the camera module is RAW format, converted into YUV format for further processing, and stored in two array buffers respectively, the visible image data array is A, and the infrared image data array is B.
步骤S204:图层分离。Step S204: Layer separation.
(1)可见光数据数组A进行二值化处理,取可见光图像数据数组中的Y值,对于某一像素点的Y值;(1) The visible light data array A is binarized, and the Y value in the visible light image data array is taken, and the Y value for a certain pixel point is obtained;
当Y>M(门限值)时,Y=255;When Y>M (threshold value), Y=255;
当Y<M(门限值)时,Y=0;When Y < M (threshold value), Y=0;
采用上述全局二值化处理时,门限值M的取值可以取所有像素点的Y值的平均值。另外此处可以采用局部二值化,就是按照一定的规则将整幅图像划分为N个窗口,对这N个窗口中的每一个窗口再按照一个统一的阈值M将该窗口内的像素划分为两部分,进行二值化处理,局部二值化 时可以采用精度更高的自适应门限值方式。该方法的阈值是通过对该窗口像素的平均值E,像素之间的差平方P,像素之间的均方根值Q等各种局部特征,设定一个参数方程进行阈值的计算,例如:M=a*E+b*P+c*Q,其中a,b,c是自由参数。另外M值的确认也可以采用双峰法,P参数法,迭代法,OTSU法等。When the above global binarization processing is used, the value of the threshold value M can take the average value of the Y values of all the pixel points. In addition, local binarization can be used here, that is, according to a certain rule, the whole image is divided into N windows, and each of the N windows is divided into pixels according to a uniform threshold M. Two parts are binarized, and a higher precision adaptive threshold method can be used for local binarization. The threshold of the method is to calculate a threshold by setting a parameter equation by using the average value E of the window pixels, the squared difference P between the pixels, and the root mean square value Q between the pixels, for example: M = a * E + b * P + c * Q, where a, b, c are free parameters. In addition, the M value can also be confirmed by the bimodal method, the P parameter method, the iterative method, the OTSU method, and the like.
记录所有Y=255的点的坐标值,Y=255的区域为底色区域。对应纸质文档来说就是纸张的颜色,即底色区域,记录底色区域点的坐标值为D。其余点的坐标为文字区域。底色区域和文字区域的坐标值在可见光图像和不可见光图像中是一一对应,保持一致的。The coordinate values of all the points of Y=255 are recorded, and the area of Y=255 is the background area. Corresponding to the paper document is the color of the paper, that is, the background area, and the coordinate value of the point of the recording background area is D. The coordinates of the remaining points are the text areas. The coordinate values of the ground color region and the text region are one-to-one correspondence between the visible light image and the invisible light image, and are consistent.
(2)对于不可见光数据数组B,取所有坐标点的Y值的数组。将该数组中底色区域的Y值全部置0,形成一个矫正的数组Ye,利用Ye的值进行正态分布处理,如下图7所示,横坐标为Ye的值,纵坐标为坐标点的数量。(2) For the invisible light data array B, an array of Y values of all coordinate points is taken. Set the Y value of the background area in the array to 0 to form a corrected array Ye, and use the value of Ye to perform normal distribution processing. As shown in Figure 7, the abscissa is the value of Ye and the ordinate is the coordinate point. Quantity.
(3)根据Ye的分布曲线,可以获取图像数组中的几个波峰,每个波峰对应一个图层,选取面积最大的波峰点值Y0,满足Y0-M0<Ye<Y0+M0(此处的M0为此波峰分布的门限值,可以取次分布的方差)的点即为该波峰对应图层的点,将这些点的坐标进行存储记为图层0,坐标数据存于数组W中。(3) According to the distribution curve of Ye, several peaks in the image array can be obtained, each peak corresponds to one layer, and the peak value Y0 of the largest area is selected, which satisfies Y0-M0<Ye<Y0+M0 (here The point at which M0 is the threshold value of the peak distribution, and the variance of the secondary distribution can be taken as the point corresponding to the layer of the peak, and the coordinates of these points are stored as layer 0, and the coordinate data is stored in the array W.
(4)以此类推,分布获取图层1图层2,当某个图层的点的个数小于门限值Mt时,停止图层分配。(4) By analogy, the distribution acquires layer 1 layer 2, and when the number of points of a certain layer is less than the threshold value Mt, the layer assignment is stopped.
(5)图层1、图层2…图层N之外的所有点坐标进行存储,分别记为数组Z1,数据Z2…数组ZN记为注释图层。(5) Layer 1, Layer 2... All point coordinates other than layer N are stored, and are recorded as array Z1, and data Z2... array ZN is recorded as an annotation layer.
需要说明的是,该图层分离也可以采用其他数学算法,如利用期望方差值逐层剥离数据,利用连续的相同数据确定一个同类元素值,然后根据这个值寻找其他同类元素。It should be noted that the layer separation may also adopt other mathematical algorithms, such as stripping data layer by layer with the desired variance value, determining the value of a similar element by using the same identical data, and then searching for other similar elements according to the value.
步骤S205:获取底色图层、图层0、图层1、图层2…之后,将图层与可见光图像数据结合,每一个图层的点对应相应的颜色值。得到了将不 同颜色值进行分离的图像数据。Step S205: After acquiring the ground color layer, the layer 0, the layer 1, and the layer 2, the layer is combined with the visible light image data, and the points of each layer correspond to the corresponding color values. Image data obtained by separating different color values is obtained.
得到最终的可见光图像数据与图层数据之后,***可以利用这些数据进行进一步的处理。对应关系如下After the final visible image data and layer data are obtained, the system can use the data for further processing. Correspondence is as follows
可见光图像——数组AVisible light image - array A
红外图像——数组BInfrared image - array B
底色图层——数组DBackground layer - array D
图层0——数组WLayer 0 - Array W
图层1——数组Z1Layer 1 - array Z1
图层2——数组Z2Layer 2 - array Z2
利用红外光直射时,不同颜色,不同材质对不可见光的吸收率不同,反射的光线就不同,当红外光照射某一材质的不同颜色时,不同颜色部分在红外光下成像的颜色值就有所不同,通过颜色值的区分,就可以将不同颜色进行分类,也就是上面提到图层,每一个图层对应一个颜色。When using direct infrared light, different colors and different materials have different absorption rates for invisible light, and the reflected light is different. When infrared light illuminates different colors of a certain material, the color values of different color portions are reflected under infrared light. Differently, by distinguishing the color values, it is possible to classify the different colors, that is, the layers mentioned above, and each layer corresponds to one color.
对于最常见的单色印刷书籍用户用笔做注释的情况,For the most common monochrome printed book users use the pen to make notes,
底色图层--数组D,对应在可见光中的颜色即为纸张的颜色,取所有数组D内元素的平均值,得到纸张的平均颜色。Background layer - array D, the color corresponding to visible light is the color of the paper, taking the average of all the elements in the array D to get the average color of the paper.
图层0--数组W,图层0是取红外图像数组D的分布中波峰面积最大的一种颜色对应的图层,对于印刷体文档来说,除去底色图层,分布最多的应该是印刷文字部分,那么图层0就对应着印刷体部分的数据,数组D即为印刷体所在的坐标位置。Layer 0 - array W, layer 0 is the layer corresponding to the color with the largest peak area in the distribution of the infrared image array D. For the printed document, the background layer is removed, the most distributed should be In the printed text part, layer 0 corresponds to the data of the printed part, and array D is the coordinate position where the printed body is located.
图层1、图层2…,这些图层对应即为文档中注释部分,每一个图层正态分布峰值对应的Y值的不同,是不同颜色在红外光成像下的亮度不同导致的,那么一个图层对应着一种颜色,坐标位置分布为Z1,Z2…。Layer 1, Layer 2..., these layers correspond to the annotation part of the document. The difference of the Y value corresponding to the peak of the normal distribution of each layer is caused by the difference in brightness of different colors under infrared light imaging. A layer corresponds to a color, and the coordinate position distribution is Z1, Z2....
基于此本实施例的上述步骤S201-至S205,可以进行以下操作;Based on the above steps S201- to S205 of this embodiment, the following operations can be performed;
(1)文档还原:取可见光图像的数据数组A,计算底色图层的D颜色平均值D0,将数组A中Z1、Z2等所有的注释图层坐标值对应的颜色 值修改为D0,即将图层1、图层2等注释部分的数据填充为底层图层的颜色平均值,得到数组A0,那么A0即为还原后的文档。进一步的可以进行文字识别等操作。(1) Document restoration: take the data array A of the visible light image, calculate the D color average value D0 of the ground color layer, and modify the color value corresponding to all the annotation layer coordinate values of the array A, Z1, Z2, etc. to D0, The data of the comment part of layer 1, layer 2, etc. is filled with the color average of the bottom layer, and the array A0 is obtained, then A0 is the restored document. Further, it is possible to perform operations such as character recognition.
(2)注释颜色区分:图层1、图层2等注释图层对应的坐标位置Z1、Z2即为不同颜色注释对应的坐标位置,在A中,取Z1坐标点的所有像素点的颜色值的平均值,记为颜色1,那么颜色1即为图层1的颜色。相同的方法获取图层2的颜色2。(2) Annotation color distinction: The coordinate positions Z1 and Z2 corresponding to the annotation layer such as layer 1 and layer 2 are the coordinate positions corresponding to different color annotations. In A, the color values of all the pixels of the Z1 coordinate point are taken. The average value is recorded as color 1, then color 1 is the color of layer 1. The same method gets the color 2 of layer 2.
Z1——图层1——颜色1Z1 - Layer 1 - Color 1
Z2——图层2——颜色2Z2 - Layer 2 - Color 2
(3)注释的隐藏与显示:在1和2的基础上,可以通过对数组A0的值进行处理,可以实现不同颜色注释的隐藏与显示,A0为原始文档,即为隐藏注释的文档;在A0数组中,把Z1对应坐标位置的点颜色值充为颜色1,填充后的数组即为显示颜色1的注释的图像。以此类推,可以得到显示颜色2的注释的图像,以及各种颜色组合注释的图像。(3) Hiding and display of annotations: On the basis of 1 and 2, the value of array A0 can be processed to hide and display different color annotations. A0 is the original document, which is the document of hidden annotation; In the A0 array, the point color value corresponding to the coordinate position of Z1 is charged as the color 1, and the filled array is the image showing the annotation of the color 1. By analogy, an image showing the annotation of color 2, and an image of the annotation of various color combinations can be obtained.
(4)注释的移动:当某些注释位于印刷文字区域内时,可以将注释移动到空白部分。(4) Movement of annotations: When some annotations are in the printed text area, the annotations can be moved to a blank portion.
取图层0的数组W,对坐标值的数组W的值进行处理,取所有横坐标s的最小值s0与最大值s1,所有点纵坐标t的最小值t0和最大值t1,那么坐标点(s0,t0)(s0,t1)(s1,t0)(s1,t1)组成的矩形即为印刷体的区域,取图层1,图层2等注释图层中的Z1,Z2的横纵坐标sz和tz,当满足Take the array W of the layer 0, and process the value of the array W of the coordinate values, taking the minimum value s0 and the maximum value s1 of all the abscissas s, the minimum value t0 and the maximum value t1 of the ordinates t of all the points, then the coordinate points The rectangle consisting of (s0, t0)(s0, t1)(s1, t0)(s1, t1) is the area of the printed matter, and the horizontal and vertical of Z1 and Z2 in the annotation layer such as layer 1, layer 2, etc. Coordinates sz and tz when satisfied
s0<sz<s1且t0<tz<t1S0<sz<s1 and t0<tz<t1
则该坐标位于印刷体区域内,对该坐标进行平移处理。Then the coordinates are located in the printed area, and the coordinates are translated.
sz(e)=sz+TsSz(e)=sz+Ts
tz(e)=tz+TtTz(e)=tz+Tt
横坐标平移量Ts,纵坐标平移量Tt由该坐标邻近的所有属于同一注 释图层的坐标点集合计算获取。The abscissa shift amount Ts, the ordinate shift amount Tt is calculated by all the coordinate point sets belonging to the same annotation layer adjacent to the coordinate.
在数组A中,将调整后的sz(e)tz(e)对应的注释图层的坐标点的颜色值修改为对应的颜色,将原注释图层坐标点的颜色值修改为底色图层颜色值D0,即实现了注释的移动。In the array A, the color value of the coordinate point of the annotation layer corresponding to the adjusted sz(e)tz(e) is modified to the corresponding color, and the color value of the original annotation layer coordinate point is modified to the ground color layer. The color value D0, which implements the movement of the annotation.
通过本实施例的上述方式,利用红外线对文档扫描进行加强处理,实现了注释识别,颜色识别等多种创新功能;此外,还能很好解决当前用户遇到的扫描边际模糊,二值化处理效果不好,手写与印刷体无法区分的问题。Through the above-mentioned manner of the embodiment, the document scanning is enhanced by using infrared rays, and various innovative functions such as annotation recognition and color recognition are realized; in addition, the scanning marginal blur encountered by the current user can be well solved, and the binarization processing is performed. The effect is not good, the problem that handwriting and print are indistinguishable.
本发明的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的程序代码:Embodiments of the present invention also provide a storage medium. Optionally, in the embodiment, the foregoing storage medium may be configured to store program code for performing the following steps:
S1:通过第一光对待处理文件进行图像数据采集,得到待处理文件的第一图像数据中像素点的颜色值以及第一图像的像素点在第一图像数据中的第一坐标信息;S1: performing image data collection by using the first light to be processed file, obtaining color values of pixel points in the first image data of the to-be-processed file and first coordinate information of the pixel points of the first image in the first image data;
S2:通过第二光对待处理文件进行图像数据采集,得到待处理文件的第二图像数据中像素点的第一坐标信息;S2: performing image data collection on the second light to be processed file, and obtaining first coordinate information of the pixel points in the second image data of the to-be-processed file;
S2:根据第一图像数据中像素点的颜色值对第二图像数据中与第一图像数据中像素点的坐标信息相对应的像素点进行调整。S2: Adjust, according to the color value of the pixel point in the first image data, a pixel point corresponding to the coordinate information of the pixel point in the first image data in the second image data.
可选地,本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。For example, the specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the optional embodiments, and details are not described herein again.
本发明的实施例还提供了一种存储介质,该存储介质中存储有计算机程序,其中,该计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。Embodiments of the present invention also provide a storage medium having stored therein a computer program, wherein the computer program is configured to perform the steps of any of the above method embodiments when executed.
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(Read-Only Memory,简称为ROM)、随机存取存储器(Random Access Memory,简称为RAM)、移动硬盘、磁碟或者光盘等各种可以存储计算机程序的介质。Optionally, in the embodiment, the foregoing storage medium may include, but is not limited to, a USB flash drive, a Read-Only Memory (ROM), and a Random Access Memory (RAM). A variety of media that can store computer programs, such as hard drives, disks, or optical disks.
本发明的实施例还提供了一种电子装置,包括存储器和处理器,该存储器中存储有计算机程序,该处理器被设置为运行计算机程序以执行上述任一项方法实施例中的步骤。Embodiments of the present invention also provide an electronic device comprising a memory and a processor having a computer program stored therein, the processor being arranged to execute a computer program to perform the steps of any of the method embodiments described above.
显然,本领域的技术人员应该明白,上述的本发明的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。It will be apparent to those skilled in the art that the various modules or steps of the present invention described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein. The steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof are fabricated as a single integrated circuit module. Thus, the invention is not limited to any specific combination of hardware and software.
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above description is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.
工业实用性Industrial applicability
如上所述,本发明实施例提供的一种处理文件的方法、终端具有以下有益效果:解决了相关技术中采用对文件进行扫描或拍照的方式得到的图像像素损失比较严重的问题,提高了用户的体验效果。As described above, the method and the terminal for processing a file provided by the embodiments of the present invention have the following beneficial effects: solving the problem that the pixel loss of the image obtained by scanning or photographing the file in the related art is serious, and improving the user. The effect of the experience.

Claims (17)

  1. 一种处理文件的方法,包括:A method of processing a file, comprising:
    通过第一光对待处理文件进行图像数据采集,得到所述待处理文件的第一图像数据中像素点的颜色值以及所述第一图像数据的像素点在所述第一图像数据中的第一坐标信息;Performing image data collection by the first light to be processed file, obtaining a color value of a pixel in the first image data of the to-be-processed file and a first pixel of the first image data in the first image data Coordinate information
    通过第二光对所述待处理文件进行图像数据采集,得到所述待处理文件的第二图像数据中像素点的第一坐标信息;Performing image data collection on the to-be-processed file by using the second light to obtain first coordinate information of pixel points in the second image data of the to-be-processed file;
    根据所述第一图像数据中像素点的颜色值对所述第二图像数据中与所述第一图像数据中像素点的坐标信息相对应的像素点进行调整。And adjusting, according to a color value of the pixel point in the first image data, a pixel point corresponding to the coordinate information of the pixel point in the first image data in the second image data.
  2. 根据权利要求1所述的方法,其中,所述根据所述第一图像数据中像素点的颜色值对所述第二图像数据中与所述第一图像数据中像素点的坐标信息相对应的像素点进行调整包括:The method according to claim 1, wherein said corresponding to coordinate information of pixel points in said first image data in said second image data is based on a color value of a pixel point in said first image data Pixel points are adjusted to include:
    根据预设的多个颜色值区间对所述第一图像数据中的像素点进行分组,得到分组后的多个图层,其中,同一个图层中像素点的颜色值在同一个颜色值区间内;And grouping the pixel points in the first image data according to the preset plurality of color value intervals to obtain a plurality of layered groups, wherein the color values of the pixel points in the same layer are in the same color value interval. Inside;
    根据一个或多个图层中像素点的颜色值对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的颜色值进行调整,和/或对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的位置进行调整。Adjusting, according to a color value of a pixel point in one or more layers, a color value of a pixel point corresponding to coordinate information of a pixel point in the one or more layers in the second image data, and/or Adjusting a position of a pixel point corresponding to coordinate information of a pixel point in the one or more layers in the second image data.
  3. 根据权利要求2所述的方法,其中,所述根据一个或多个图层中像素点的颜色值对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的颜色值进行调整包括:The method of claim 2, wherein the pair of coordinate values of pixel points in the one or more layers in the second image data are based on color values of pixel points in one or more layers The adjustment of the color value of the corresponding pixel includes:
    将所述第二图像数据中除与所述多个图层中的第一图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第一图层的颜色值一致;Adjusting a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the first layer of the plurality of layers in the second image data to the plurality of layers The color values of the first layer are the same;
    其中,所述第一图层为所述待处理文件的底色图层。The first layer is a ground color layer of the file to be processed.
  4. 根据权利要求2所述的方法,其中,所述根据一个或多个图层中像素点的颜色值对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的颜色值进行调整包括:The method of claim 2, wherein the pair of coordinate values of pixel points in the one or more layers in the second image data are based on color values of pixel points in one or more layers The adjustment of the color value of the corresponding pixel includes:
    将所述第二图像数据中除与所述多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第二图层的颜色值一致;Adjusting a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to the plurality of layers The color values of the second layer are the same;
    其中,所述第二图层为所述多个图层中的除底色图层外的其他图层,且所述第二图层包括一个或多个子图层。The second layer is another layer other than the ground layer in the plurality of layers, and the second layer includes one or more sub-layers.
  5. 根据权利要求4所述的方法,其中,在所述第二图层包括多个子图层的情况下,The method of claim 4, wherein, in the case where the second layer includes a plurality of sub-layers,
    在将所述第二图像数据中除与所述多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第二图层的颜色值一致之后,将所述第二图像数据中与第二图层的颜色值一致的多个子图层中的部分子图层的颜色值调整至与第一图层的颜色值一致;其中,所述第一图层为所述待处理文件的底色图层;和/或,Adjusting a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to the plurality of layers After the color values of the second layer in the second layer are consistent, the color values of the partial sub-layers in the plurality of sub-layers in the second image data that are consistent with the color values of the second layer are adjusted to be the same as the first layer The color values are consistent; wherein the first layer is a ground color layer of the file to be processed; and/or,
    在将所述第二图像数据中除与所述多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第二图层的颜色值一致之后,将所述第二图像数据中与第二图层的颜色值一致的多个子图层中的一部分子分图层的颜色值调整至与所述多个子图层中的其中之一子图层的颜色值一致。Adjusting a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to the plurality of layers After the color values of the second layer in the second layer are consistent, the color values of a part of the sub-layers of the plurality of sub-layers in the second image data that are consistent with the color values of the second layer are adjusted to be One of the sublayers in the sublayer has the same color value.
  6. 根据权利要求2所述的方法,其中,所述根据一个或多个图层中像素点的颜色值对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的位置进行调整包括:The method of claim 2, wherein the pair of coordinate values of pixel points in the one or more layers in the second image data are based on color values of pixel points in one or more layers The adjustment of the position of the corresponding pixel includes:
    获取所述第一图像数据中的第二图层在所述第一坐标信息中的坐标信息;Obtaining coordinate information of the second layer in the first image data in the first coordinate information;
    移动在所述第二图像数据中与第二图层的坐标信息对应的像素 点的位置;Moving a position of a pixel point corresponding to coordinate information of the second layer in the second image data;
    其中,所述第二图层为所述多个图层中的除底色图层外的其他图层,且所述第二图层包括一个或多个子图层。The second layer is another layer other than the ground layer in the plurality of layers, and the second layer includes one or more sub-layers.
  7. 根据权利要求1至6任一项所述的方法,其中,所述第一光为不可见光,所述第二光为可见光。The method according to any one of claims 1 to 6, wherein the first light is invisible light and the second light is visible light.
  8. 一种终端,包括:A terminal comprising:
    补光灯组件,设置为发出第一光和第二光;a fill light assembly configured to emit first light and second light;
    摄像组件,设置为通过所述第一光对待处理文件进行图像数据采集,以及通过所述第二光对所述待处理文件进行图像数据采集;The image capturing component is configured to perform image data collection by using the first light to be processed file, and perform image data collection on the to-be-processed file by using the second light;
    处理器,设置为根据所述第一光采集的图像数据得到所述待处理文件的第一图像数据中像素点的颜色值以及所述第一图像数据的像素点在所述第一图像数据中的第一坐标信息;以及根据所述第二光采集的图像数据得到所述待处理文件的第二图像数据中像素点的第一坐标信息;并根据所述第一图像数据中像素点的颜色值对所述第二图像数据中与所述第一图像数据中像素点的坐标信息相对应的像素点进行调整。a processor, configured to obtain, according to the image data acquired by the first light, a color value of a pixel point in the first image data of the to-be-processed file and a pixel point of the first image data in the first image data First coordinate information; and obtaining first coordinate information of pixel points in the second image data of the file to be processed according to the image data acquired by the second light; and according to color of pixel points in the first image data The value is adjusted for a pixel point in the second image data corresponding to coordinate information of a pixel point in the first image data.
  9. 根据权利要求8所述的终端,其中,The terminal according to claim 8, wherein
    所述处理器,还设置为根据预设的多个颜色值区间对所述第一图像数据中的像素点进行分组,得到分组后的多个图层,其中,同一个图层中像素点的颜色值在同一个颜色值区间内;以及根据一个或多个图层中像素点的颜色值对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的颜色值进行调整,和/或对所述第二图像数据中与所述一个或多个图层中像素点的坐标信息相对应的像素点的位置进行调整。The processor is further configured to group the pixels in the first image data according to a preset plurality of color value intervals to obtain a plurality of layers after the grouping, wherein the pixels in the same layer The color values are within the same color value interval; and corresponding to the coordinate information of the pixel points in the one or more layers in the second image data according to the color values of the pixel points in the one or more layers The color values of the pixels are adjusted, and/or the positions of the pixel points in the second image data corresponding to the coordinate information of the pixel points in the one or more layers are adjusted.
  10. 根据权利要求9所述的终端,其中,The terminal according to claim 9, wherein
    所述处理器,还设置为将所述第二图像数据中除与所述多个图层 中的第一图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第一图层的颜色值一致;The processor is further configured to adjust a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the first layer of the plurality of layers in the second image data to Consistent with color values of the first of the plurality of layers;
    其中,所述第一图层为所述待处理文件的底色图层。The first layer is a ground color layer of the file to be processed.
  11. 根据权利要求9所述的终端,其中,The terminal according to claim 9, wherein
    所述处理器,还设置为将所述第二图像数据中除与所述多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第二图层的颜色值一致;The processor is further configured to adjust a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to Consistent with color values of the second layer of the plurality of layers;
    其中,所述第二图层为所述多个图层中的除底色图层外的其他图层,且所述第二图层包括一个或多个子图层。The second layer is another layer other than the ground layer in the plurality of layers, and the second layer includes one or more sub-layers.
  12. 根据权利要求11所述的终端,其中,在所述第二图层包括多个子图层的情况下,The terminal according to claim 11, wherein in the case where the second layer includes a plurality of sub-layers,
    所述处理器,还设置为在将所述第二图像数据中除与所述多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第二图层的颜色值一致之后,将所述第二图像数据中与第二图层的颜色值一致的多个子图层中的部分子图层的颜色值调整至与第一图层的颜色值一致;其中,所述第一图层为所述待处理文件的底色图层;和/或,The processor is further configured to adjust a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data After the color values of the second layer of the plurality of layers are consistent, color of a portion of the plurality of sub-layers in the second image data that are consistent with the color values of the second layer Adjusting the value to be consistent with a color value of the first layer; wherein the first layer is a ground color layer of the file to be processed; and/or,
    在将所述第二图像数据中除与所述多个图层中的第二图层对应的坐标值之外的其他坐标值对应的像素点的颜色值,调整至与所述多个图层中的第二图层的颜色值一致之后,将所述第二图像数据中与第二图层的颜色值一致的多个子图层中的一部分子分图层的颜色值调整至与所述多个子图层中的其中之一子图层的颜色值一致。Adjusting a color value of a pixel point corresponding to another coordinate value other than the coordinate value corresponding to the second layer of the plurality of layers in the second image data to the plurality of layers After the color values of the second layer in the second layer are consistent, the color values of a part of the sub-layers of the plurality of sub-layers in the second image data that are consistent with the color values of the second layer are adjusted to be One of the sublayers in the sublayer has the same color value.
  13. 根据权利要求9所述的终端,其中,The terminal according to claim 9, wherein
    所述处理器,还设置为获取所述第一图像数据中的第二图层在所述第一坐标信息中的坐标信息;移动在所述第二图像数据中与第二图层的坐标信息对应的像素点的位置;The processor is further configured to acquire coordinate information of the second layer in the first coordinate data in the first coordinate information; and move coordinate information in the second image data and the second layer The position of the corresponding pixel;
    其中,所述第二图层为所述多个图层中的除底色图层外的其他图层,且所述第二图层包括一个或多个子图层。The second layer is another layer other than the ground layer in the plurality of layers, and the second layer includes one or more sub-layers.
  14. 根据权利要求8所述的终端,其中,所述摄像组件包括:滤光切换组件和感光组件;The terminal according to claim 8, wherein the camera assembly comprises: a filter switching assembly and a photosensitive member;
    其中,在所述滤光组件滤掉所述第二光的情况下,所述感光组件通过所述第一光对待处理文件进行图像数据采集;Wherein, in a case that the filter component filters out the second light, the photosensitive component performs image data collection by using the first light to be processed file;
    在所述滤光组件滤掉所述第一光的情况下,所述感光组件通过所述第二光对待处理文件进行图像数据采集。In the case that the filter assembly filters out the first light, the photosensitive component performs image data acquisition by the second light to be processed file.
  15. 根据权利要求8至14任一项所述的终端,其中,所述第一光为不可见光,所述第二光为可见光。The terminal according to any one of claims 8 to 14, wherein the first light is invisible light and the second light is visible light.
  16. 一种存储介质,所述存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行所述权利要求1至7任一项中所述的方法。A storage medium having stored therein a computer program, wherein the computer program is arranged to execute the method of any one of claims 1 to 7 at runtime.
  17. 一种电子装置,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行所述权利要求1至7任一项中所述的方法。An electronic device comprising a memory and a processor, wherein the memory stores a computer program, the processor being arranged to execute the computer program to perform the method of any one of claims 1 to 7.
PCT/CN2018/078154 2017-06-01 2018-03-06 File processing method and terminal WO2018219005A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710404417.8A CN108986036B (en) 2017-06-01 2017-06-01 Method and terminal for processing files
CN201710404417.8 2017-06-01

Publications (1)

Publication Number Publication Date
WO2018219005A1 true WO2018219005A1 (en) 2018-12-06

Family

ID=64454371

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/078154 WO2018219005A1 (en) 2017-06-01 2018-03-06 File processing method and terminal

Country Status (2)

Country Link
CN (1) CN108986036B (en)
WO (1) WO2018219005A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111080732A (en) * 2019-11-12 2020-04-28 望海康信(北京)科技股份公司 Method and system for forming virtual map
US11595625B2 (en) * 2020-01-02 2023-02-28 Qualcomm Incorporated Mechanical infrared light filter

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114543995B (en) * 2022-04-26 2022-07-08 南通市海视光电有限公司 Color recognition instrument for chemical liquid phase color detection and detection method thereof

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030068081A1 (en) * 2001-10-05 2003-04-10 Charles Jia Digital image processing
US20030161547A1 (en) * 2002-02-22 2003-08-28 Huitao Luo Systems and methods for processing a digital image
CN102542548A (en) * 2011-12-30 2012-07-04 深圳市万兴软件有限公司 Method and device for correcting color between images
CN104050651A (en) * 2014-06-19 2014-09-17 青岛海信电器股份有限公司 Scene image processing method and device
CN105205798A (en) * 2015-10-19 2015-12-30 北京经纬恒润科技有限公司 Image processing method and system

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2134255C (en) * 1993-12-09 1999-07-13 Hans Peter Graf Dropped-form document image compression
US7231080B2 (en) * 2001-02-13 2007-06-12 Orbotech Ltd. Multiple optical input inspection system
US7260257B2 (en) * 2002-06-19 2007-08-21 Microsoft Corp. System and method for whiteboard and audio capture
EP2471258B1 (en) * 2009-08-25 2017-05-24 Dual Aperture International Co. Ltd. Reducing noise in a color image
US8824785B2 (en) * 2010-01-27 2014-09-02 Dst Technologies, Inc. Segregation of handwritten information from typographic information on a document
CN103544722B (en) * 2013-10-25 2016-08-17 深圳市掌网立体时代视讯技术有限公司 The person's handwriting method of modifying of a kind of numeral painting and calligraphy and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030068081A1 (en) * 2001-10-05 2003-04-10 Charles Jia Digital image processing
US20030161547A1 (en) * 2002-02-22 2003-08-28 Huitao Luo Systems and methods for processing a digital image
CN102542548A (en) * 2011-12-30 2012-07-04 深圳市万兴软件有限公司 Method and device for correcting color between images
CN104050651A (en) * 2014-06-19 2014-09-17 青岛海信电器股份有限公司 Scene image processing method and device
CN105205798A (en) * 2015-10-19 2015-12-30 北京经纬恒润科技有限公司 Image processing method and system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111080732A (en) * 2019-11-12 2020-04-28 望海康信(北京)科技股份公司 Method and system for forming virtual map
CN111080732B (en) * 2019-11-12 2023-09-22 望海康信(北京)科技股份公司 Method and system for forming virtual map
US11595625B2 (en) * 2020-01-02 2023-02-28 Qualcomm Incorporated Mechanical infrared light filter

Also Published As

Publication number Publication date
CN108986036B (en) 2022-01-28
CN108986036A (en) 2018-12-11

Similar Documents

Publication Publication Date Title
US9769354B2 (en) Systems and methods of processing scanned data
US7986831B2 (en) Image processing apparatus, image processing method and computer program
WO2019233341A1 (en) Image processing method and apparatus, computer readable storage medium, and computer device
JP4514421B2 (en) Method for enhancing electronic images of documents
US7724950B2 (en) Image processing apparatus, image processing method, computer program, and storage medium
JP6416208B2 (en) Near-infrared guide image noise removal
US8194992B2 (en) System and method for automatic enhancement of seascape images
CN101867724B (en) Imaging device and imaging method
US10455163B2 (en) Image processing apparatus that generates a combined image, control method, and storage medium
US20140003736A1 (en) Systems and methods for removing defects from images
WO2018219005A1 (en) File processing method and terminal
EP2803016A1 (en) Systems and methods for mobile image capture and processing
US20100073506A1 (en) Image processor and camera
JP2017028559A (en) Image processing device, image processing method, program and recording medium
CN103685877A (en) Print target data processing apparatus, and print target data processing method
US8687089B2 (en) Method and apparatus for managing an album
CN114283156B (en) Method and device for removing document image color and handwriting
US20230106177A1 (en) Image capture scene recognition control method and apparatus and image capture device
US8498453B1 (en) Evaluating digital images using head points
KR20180127913A (en) Image processing apparatus, image processing method, and storage medium
US20220385814A1 (en) Method for generating plurality of content items and electronic device therefor
KR20110083099A (en) Digital image processing apparatus and method for controlling thereof
CN103037154A (en) Image taking apparatus
US20160275345A1 (en) Camera systems with enhanced document capture
CN109688334A (en) Image pickup method, device, electronic equipment, computer readable storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18809086

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18809086

Country of ref document: EP

Kind code of ref document: A1