WO2022002002A1 - Image processing method, image processing apparatus, electronic device, and storage medium - Google Patents
Image processing method, image processing apparatus, electronic device, and storage medium Download PDFInfo
- Publication number
- WO2022002002A1 WO2022002002A1 PCT/CN2021/102912 CN2021102912W WO2022002002A1 WO 2022002002 A1 WO2022002002 A1 WO 2022002002A1 CN 2021102912 W CN2021102912 W CN 2021102912W WO 2022002002 A1 WO2022002002 A1 WO 2022002002A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- image
- binarized
- pixel
- pixels
- binarization
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/28—Quantising the image, e.g. histogram thresholding for discrimination between background and foreground patterns
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/20—Image enhancement or restoration using local operators
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/73—Deblurring; Sharpening
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20212—Image combination
- G06T2207/20221—Image fusion; Image merging
Definitions
- the present invention relates to the technical field of digital image processing, and in particular, to an image processing method, an image processing apparatus, an electronic device, and a non-transitory computer-readable storage medium.
- image binarization processing is to set the gray value of pixels on the image to 0 or 255, and image binarization processing can greatly reduce the amount of data in the image. , so that the outline of the target of interest can be highlighted, and in addition, it is convenient to process and analyze the image, for example, to extract the information in the image.
- At least one embodiment of the present disclosure provides an image processing method, including: acquiring an original image, wherein the original image includes at least one object; and processing the original image by using a first binarization model to obtain the original image
- the first binarized image of the image is processed to obtain a pixel circumscribed contour image, wherein the pixel circumscribed contour image includes a plurality of circumscribed contour pixels, and the plurality of circumscribed contour pixels
- the pixels in the enclosed area are pixels corresponding to at least part of the objects in the at least one object
- the original image is processed by a second binarization model to obtain a second binarized image; according to the plurality of objects
- the position of the circumscribed contour pixel in the pixel circumscribed contour image, and the second binarized image and the first binarized image are synthesized to obtain a synthesized image, wherein the synthesized image is a binary image image.
- the original image is processed by the first binarization model to obtain the first binarized image of the original image, including: The original image is compressed to obtain an input image, wherein the size of the input image is smaller than the size of the original image; and the input image is processed by the first binarization model to obtain the The first binarized image of the original image.
- processing the input image by using the first binarization model to obtain the first binarized image of the original image includes: The first binarization model processes the input image to obtain a binarized predicted image of the input image; and restores the size of the binarized predicted image to obtain the first binarized image
- the size of the first binarized image is the same as the size of the original image.
- processing the first binarized image to obtain a pixel circumscribed contour image includes: performing blurring processing on the first binarized image , obtain a blurred image; perform XOR processing on the blurred image and the first binarized image to obtain the pixel circumscribed contour image.
- the second binarized image and the first binary image are analyzed.
- Synthesizing the binarized images to obtain the synthesized image includes: acquiring the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image; extracting the plurality of circumscribed contour pixels in the second binarized image multiple target second binarized pixels at positions corresponding to the positions of the contour pixels; according to the pixel correspondence between the second binarized image and the first binarized image, the second binarized image is The plurality of target second binarized pixels in the image are respectively combined into the same position in the first binarized image to obtain the combined image.
- all the second binarized pixels in the second binarized image are arranged in n rows and m columns, and the pixels in the first binarized image are arranged in n rows and m columns.
- All the first binarized pixels are arranged in n rows and m columns, and all the synthesized pixels in the composite image are arranged in n rows and m columns, according to the pixels of the second binarized image and the first binarized image.
- synthesizing the multiple target second binarized pixels in the second binarized image to the same position in the first binarized image respectively includes: determining the multiple target second binarized pixels.
- the q th target second binarized pixel in the two binarized pixels wherein the q th target second binarized pixel is located in the ith row and the jth column of the second binarized image; determine The q-th target first binarized pixel located in the i-th row and j-th column in the first binarized image; replace the grayscale value of the q-th target first binarized pixel with the grayscale value of the second binarized pixel of the q th target, so as to obtain the q th target composite pixel located in the i th row and the j th column in the composite image, wherein the q th target composite pixel
- the grayscale value of the pixel is the grayscale value of the qth target second binarized pixel, n, m, q, i, and j are all positive integers, and i is less than or equal to n, j is less than or equal to m, and q is less than or equal to is
- processing the original image by using a second binarization model to obtain a second binarized image includes: performing grayscale on the original image process the grayscale image to obtain a grayscale image; process the grayscale image according to the first threshold to obtain an intermediate binarized image; use the intermediate binarized image as a guide map to perform guided filtering on the grayscale image process to obtain a filtered image; determine high-value pixels in the filtered image according to a second threshold, wherein the gray value of the high-value pixels is greater than the second threshold; The gray value of the high-value pixels is expanded to obtain an expanded image; the expanded image is sharpened to obtain a clear image; and the contrast of the clear image is adjusted to obtain the second binarization image.
- the first binarization model is a model based on a neural network.
- At least one embodiment of the present disclosure provides an image processing apparatus, including: an acquisition module for acquiring an original image, wherein the original image includes at least one object; and a first binarization module for obtaining an original image through a first binarization
- the model processes the original image to obtain a first binarized image of the original image;
- a processing module is used to process the first binarized image to obtain a pixel circumscribed contour image, wherein the The pixel circumscribed contour image includes a plurality of circumscribed contour pixels, and the pixels in the area surrounded by the plurality of circumscribed contour pixels are pixels corresponding to at least part of the objects in the at least one object;
- the second binarization module is configured to pass
- the second binarization model processes the original image to obtain a second binarized image;
- the synthesis module is configured to, according to the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image, analyze the The second binarized image and the first binarized image are combined to obtain the combined image, wherein
- the first binarization module performs processing on the original image through a first binarization model, so as to obtain the first two images of the original image.
- the operation of binarizing the image includes performing the following operations: compressing the original image to obtain an input image, wherein the size of the input image is smaller than the size of the original image;
- the model processes the input image to obtain a first binarized image of the original image.
- the first binarization module performs processing on the input image by using the first binarization model, so as to obtain a second image of the original image.
- the operation of a binarized image includes performing the following operations: processing the input image by using the first binarization model to obtain a binarized predicted image of the input image; The predicted image is resized to obtain the first binarized image, wherein the size of the first binarized image is the same as the size of the original image.
- the processing module when the processing module performs the operation of processing the first binarized image to obtain a pixel circumscribed contour image, the operation includes performing the following operations: performing a blurring process on the first binarized image to obtain a blurred image; and performing XOR processing on the blurred image and the first binarized image to obtain the pixel circumscribed contour image.
- the synthesizing module performs, according to the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image, the second binarized image and the
- the operation includes performing the following operations: obtaining the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image; multiple target second binarized pixels at positions corresponding to the positions of the plurality of circumscribed contour pixels in the second binarized image; according to the second binarized image and the first binarized
- the pixel correspondence of the image, the multiple target second binarized pixels in the second binarized image are respectively synthesized into the same position in the first binarized image to obtain the original image composite image.
- all the second binarized pixels in the second binarized image are arranged in n rows and m columns, and the pixels in the first binarized image are arranged in n rows and m columns.
- All the first binarized pixels are arranged in n rows and m columns, and all the synthesized pixels in the composite image are arranged in n rows and m columns, and the composite module executes the process according to the second binarized image and the first binarized image.
- the pixel correspondence relationship of the binarized image, and the operation of synthesizing the plurality of target second binarized pixels in the second binarized image to the same position in the first binarized image respectively includes: performing the following operations: determining the qth target second binarization pixel in the plurality of target second binarization pixels, wherein the qth target second binarization pixel is located in the second binarization pixel The i-th row and the j-th column of the binarized image are determined; the q-th target first binarized pixel located in the i-th row and the j-th column in the first binarized image is determined; the q-th target first binarized pixel is The gray-level value of a binarized pixel is replaced with the gray-level value of the q-th target second binarized pixel, so as to obtain the q-th target composite in the i-th row and j-th column in the composite image pixel, wherein the grayscale value of the qth target
- the second binarization module includes: a grayscale module, configured to perform grayscale processing on the original image to obtain a grayscale image; an intermediate The binarization module is used to process the grayscale image according to the first threshold to obtain an intermediate binarized image; the filtering module is used to take the intermediate binarized image as a guide map, and to process the grayscale image.
- a grayscale module configured to perform grayscale processing on the original image to obtain a grayscale image
- an intermediate The binarization module is used to process the grayscale image according to the first threshold to obtain an intermediate binarized image
- the filtering module is used to take the intermediate binarized image as a guide map, and to process the grayscale image.
- the image is subjected to guided filtering processing to obtain a filtered image; a determination module is configured to determine high-value pixels in the filtered image according to a second threshold, wherein the gray value of the high-value pixels is greater than the second threshold
- the expansion module is used to expand the gray value of the high-value pixel points according to the preset expansion coefficient to obtain an expanded image; the clearing module is used to clear the expanded image to obtain a clear image. , and adjust the contrast of the clear image to obtain the second binarized image.
- At least one embodiment of the present disclosure provides an electronic device, comprising: a memory for non-transitory storage of computer-readable instructions; a processor for executing the computer-readable instructions, the computer-readable instructions being executed by the The image processing method according to any embodiment of the present disclosure is implemented when the processor runs.
- At least one embodiment of the present disclosure provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer-readable instructions that, when executed by a processor, implement a The image processing method described in any embodiment of the present disclosure.
- FIG. 1 is a schematic flowchart of an image processing method provided by at least one embodiment of the present disclosure
- FIG. 2 is a schematic diagram of an original image provided by at least one embodiment of the present disclosure
- FIG. 3 shows an input image provided by an embodiment of the present disclosure
- FIG. 4 is a schematic diagram of a first binarized image provided by an embodiment of the present disclosure.
- FIG. 5 is a schematic diagram of a blurred image provided by an embodiment of the present disclosure.
- FIG. 6 is a pixel circumscribed contour image provided by an embodiment of the present disclosure.
- FIG. 7 is a schematic diagram of a second binarized image according to an embodiment of the present disclosure.
- FIG. 8 is a schematic diagram of a composite image provided by an embodiment of the present disclosure.
- FIG. 9 is a schematic block diagram of an image processing apparatus according to at least one embodiment of the present disclosure.
- FIG. 10 is a schematic block diagram of an electronic device according to at least one embodiment of the present disclosure.
- FIG. 11 is a schematic diagram of a non-transitory computer-readable storage medium provided by at least one embodiment of the present disclosure.
- FIG. 12 is a schematic diagram of a hardware environment provided by at least one embodiment of the present disclosure.
- At least one embodiment of the present disclosure provides an image processing method, an image processing apparatus, an electronic device, and a non-transitory computer-readable storage medium.
- the image processing method includes: acquiring an original image, wherein the original image includes at least one object; processing the original image through a first binarization model to obtain a first binarized image of the original image; Perform processing to obtain a pixel circumscribed contour image, wherein the pixel circumscribed contour image includes a plurality of circumscribed contour pixels, and the pixels in the area surrounded by the plurality of circumscribed contour pixels are pixels corresponding to at least part of the at least one object;
- the binarization model processes the original image to obtain a second binarized image; the second binarized image and the first binarized image are synthesized according to the positions of multiple circumscribed contour pixels in the pixel circumscribed contour image , to get a composite image of the original image.
- the composite image is a binarized image.
- the image processing method can convert an original image (for example, a color image or an unclear image) into a binarized image with obvious and clear black and white contrast, which can effectively improve the quality of the binarized image and improve the recognition degree of the image content.
- an original image for example, a color image or an unclear image
- the converted image has less noise and obvious black and white contrast, it can effectively improve the printing effect.
- the image processing method provided by the embodiment of the present disclosure can be applied to the image processing apparatus provided by the embodiment of the present disclosure, and the image processing apparatus can be configured on an electronic device.
- the electronic device may be a personal computer, a mobile terminal, etc.
- the mobile terminal may be a hardware device with various operating systems, such as a mobile phone, a tablet computer, and the like.
- FIG. 1 is a schematic flowchart of an image processing method provided by at least one embodiment of the present disclosure
- FIG. 2 is a schematic diagram of an original image provided by at least one embodiment of the present disclosure.
- the image processing method provided by the embodiment of the present disclosure includes steps S10 to S14.
- the image processing method includes step S10 : acquiring an original image.
- the original image includes at least one object
- the object may be a character
- the character may include Chinese (for example, Chinese characters or pinyin), English, Japanese, French, Korean, Latin, numbers, etc.
- the object may also include various symbols ( For example, greater than sign, less than sign, percent sign, etc.) and various graphics, etc.
- At least one of the objects may include printed or machine-typed characters, as well as handwritten characters.
- objects in the original image may include words and letters in print (eg, English, Japanese, French, Korean, German, Latin, etc. in different national languages and scripts) ), printed numbers (eg, dates, weights, dimensions, etc.), printed symbols and images, etc., handwritten words and letters, handwritten numbers, handwritten symbols and graphics, etc.
- the original image may be various types of images, for example, may be an image of a shopping list, an image of a dining receipt, an image of a test paper, an image of a contract, and the like. As shown in FIG. 2, the original image may be an image of a letter.
- the shape of the original image can be rectangle etc.
- the shape and size of the original image can be set by the user according to the actual situation.
- the original image may be an image captured by an image acquisition device (eg, a digital camera or a mobile phone, etc.), and the original image may be a grayscale image or a color image.
- the original image refers to a form in which the object to be processed (eg, test paper, cooperation, shopping receipt, etc.) is presented in a visual manner, such as a picture of the object to be processed.
- the original image can also be obtained by scanning or the like.
- the original image may be an image directly collected by an image collection device, or an image obtained after preprocessing the collected image.
- the image processing method provided by at least one embodiment of the present disclosure may further include an operation of preprocessing the original image.
- the preprocessing may include, for example, processing, such as cropping, gamma (Gamma) correction, or noise reduction filtering, on the image directly collected by the image collection device. Preprocessing can eliminate irrelevant information or noise information in the original image, so as to facilitate better image processing of the original image.
- step S11 the original image is processed through a first binarization model to obtain a first binarized image of the original image.
- the first binarization model is a neural network-based model.
- the first binarization model may be implemented using machine learning techniques and run, for example, on a general purpose computing device or a special purpose computing device.
- the first binarization model is a neural network model obtained by pre-training.
- the first binarization model can be implemented by using a U-net neural network, a neural network similar to the U-net neural network, a Mask-rcnn neural network, or other neural networks.
- the first binarization model is used to binarize the original image to obtain the first binarized image.
- the binarization process is to set the gray value of the pixel on the original image to the first gray value (for example, 0) or the second gray value (for example, 255), that is, to make the whole original image appear obvious Process of black and white effect.
- the first binarization model to be trained can be trained through a large number of original training images and the binarized images of the original training images, and then the first binarization model (for example, a neural network model such as a U-net neural network) is established. ).
- the first binarization model for example, a neural network model such as a U-net neural network
- an existing binarization processing method may also be used to perform binarization processing on the original image to obtain the first binarized image.
- the binarization processing method may include a threshold value method, and the threshold value method includes: setting a binarization threshold value, and comparing the gray level value of each pixel in the original image with the binarization threshold value. If the grayscale value is greater than or equal to the binarization threshold, the grayscale value of the pixel is set to 255 grayscale. If the grayscale value of a pixel in the original image is less than the binarization threshold, the grayscale value of the pixel is set to Set it to 0 grayscale, so that the original image can be binarized.
- the selection method of the binarization threshold includes the bimodal method, the P-parameter method, the big law (OTSU method), the maximum entropy method, and the iterative method.
- step S11 may include: compressing the original image to obtain an input image; and processing the input image through a first binarization model to obtain a first binarized image of the original image.
- FIG. 3 shows an input image provided by an embodiment of the present disclosure.
- the input image in FIG. 3 may be an image obtained by compressing the original image in FIG. 2 .
- the dimensions of the input image are smaller than the dimensions of the original image. It should be noted that when the first binarization model is used for the binarization prediction processing, if the original image is too large, the processing speed will be relatively slow. Therefore, in order to improve the processing speed, the original image can be compressed to obtain The compressed input image is then subjected to binarization prediction processing on the input image through the first binarization model.
- the size of the input image may be 1500*1500. It should be noted that the size of the input image is not limited to this, and can be set according to the actual situation.
- the user can preset the compression ratio, etc.
- the compression ratio is related to factors such as processing speed and image quality, and the user can comprehensively consider the processing speed and image quality. factor to set the compression ratio. If the processing speed needs to be made faster, the compression ratio can be larger, so that the size of the input image is smaller. However, at this time, the quality of the final first binarized image may be poor; if the final second binarized image needs to be obtained If the quality of the binarized image is better, the compression ratio can be smaller, so that the size of the input image is larger.
- the processing speed is slower, that is, the first binarization model performs binarization processing on the input image.
- process is longer.
- the aspect ratio of the input image and the aspect ratio of the original image may be the same. In other examples, the aspect ratio of the input image and the aspect ratio of the original image may be different. In this case, relative to the original image , the input image is deformed. After the input image is processed, a binarized predicted image is obtained. The size of the binarized predicted image needs to be restored to the same size as the original image.
- the resolution of the photo is 12 million pixels, that is, 4000*3000. At this time, the size of the original image can be 4000*3000, and the size of the input image obtained after compressing the original image can also be 1500*1500. This , the input image is deformed.
- FIG. 4 is a schematic diagram of a first binarized image provided by an embodiment of the present disclosure.
- processing the input image through the first binarization model to obtain the first binarization image of the original image includes: processing the input image through the first binarization model to obtain the first binarization model of the input image. Binarize the predicted image; restore the size of the binarized predicted image to obtain a first binarized image.
- the first binarized image in FIG. 4 is the binarized image of the original image shown in FIG. 2 .
- the size of the first binarized image is the same as the size of the original image.
- the black pixels represent the pixels corresponding to the object
- the white pixels represent the pixels corresponding to the background.
- the size of the binarized predicted image is the same as the size of the input image.
- the size of the binarized predicted image is restored, that is, the size of the binarized predicted image is enlarged according to the enlargement ratio, so that the size of the first binarized image is equal to the size of the first binarized image.
- the size of the original image is the same, so that it is convenient to perform pixel synthesis at the corresponding position later.
- the enlargement ratio may correspond to the compression ratio. For example, if the compression ratio is 1/K, the enlargement ratio may be K.
- an interpolation method may be used to restore the size of the binarized predicted image to obtain the first binarized image.
- FIG. 5 is a schematic diagram of a blurred image according to an embodiment of the disclosure
- FIG. 6 is a pixel circumscribed contour image according to an embodiment of the disclosure.
- step S12 the first binarized image is processed to obtain a pixel circumscribed contour image.
- the pixel circumscribed contour image shown in FIG. 6 is a pixel circumscribed contour image obtained by processing the first binarized image shown in FIG. 4 .
- the pixel circumscribed contour image includes a plurality of circumscribed contour pixels, and the white pixels in FIG. 6 represent circumscribed contour pixels.
- the pixels in the area surrounded by the plurality of circumscribed contour pixels are pixels corresponding to at least part of the at least one object, and the black pixels inside the white pixels in FIG. 6 represent the pixels of the object.
- step S12 includes: performing a blurring process on the first binarized image to obtain a blurred image; and performing XOR processing on the blurred image and the first binarized image to obtain a pixel circumscribed contour image.
- the blurred image shown in FIG. 5 may be a blurred image obtained by blurring the first binarized image shown in FIG. 4 .
- the mask area (Mask area) of the object in the first binarized image becomes larger.
- Gaussian filtering may be used to blur the first binarized image. It should be noted that, in the present disclosure, the method of fuzzification processing is not limited to Gaussian filtering, and may also be other suitable methods, such as median filtering, mean filtering, and the like.
- the white pixels in Fig. 6 represent different pixels between the blurred image and the first binarized image, that is, for any white pixel in Fig. 6, the pixel at the position corresponding to the white pixel in the blurred image
- the grayscale value is different from the grayscale value of the pixel at the position corresponding to the white pixel in the first binarized image.
- the black pixels in Fig. 6 represent the same pixels between the blurred image and the first binarized image, that is, for any black pixel in Fig. 6, the pixel at the position corresponding to the black pixel in the blurred image
- the grayscale value is the same as the grayscale value of the pixel at the position corresponding to the black pixel in the first binarized image.
- FIG. 7 is a schematic diagram of a second binarized image according to an embodiment of the present disclosure.
- step S13 the original image is processed through a second binarization model to obtain a second binarized image.
- the second binarized image shown in FIG. 7 is an image obtained by processing the original image shown in FIG. 2 through the second binarization model.
- step S13 the processing performed by the second binarization model (for example, lessink processing) is performed according to the original image.
- the processing performed by the second binarization model can be used to remove part of the grayscale in the original image. pixels, while enhancing the detail information of objects (eg, characters), that is, more detailed pixel features can be preserved.
- the processing performed by the second binarization model can also remove image noise interference in the original image, making the details of the object more prominent.
- the binarized prediction image obtained by performing the binarization prediction process on the input image shown in Figure 3 does not perform well in the detail part and has jaggedness. Therefore, it is necessary to supplement the detail pixels of the image, so that the final composite image has better effect.
- step S13 may include: performing grayscale processing on the original image to obtain a grayscale image; processing the grayscale image according to the first threshold to obtain an intermediate binarized image; As a guide map, conduct guide filtering processing on the grayscale image to obtain a filtered image; determine high-value pixels in the filtered image according to a second threshold, wherein the grayscale value of the high-value pixels is greater than the second threshold; according to a preset The expansion coefficient is used to expand the gray value of the high-value pixels to obtain an expanded image; to clear the expanded image to obtain a clear image; and to adjust the contrast of the clear image to obtain a second binarized image.
- grayscale processing methods include component method, maximum value method, average value method, weighted average method, and the like.
- a threshold method can be used to binarize a grayscale image to obtain an intermediate binarized image.
- the commonly used binarization threshold selection methods include the bimodal method, the P parameter method, the big law (OTSU method), the maximum entropy method, the iterative method, etc.
- the selection method of the first threshold can be any of the above methods. kind.
- the first threshold can be set according to the actual situation, which is not specifically limited here.
- step S13 in the guided filtering process, the intermediate binarized image is used as the guided image, the grayscale image is used as the input image in the guided filtering process, and the filtered image is the output image in the guided filtering process.
- the valued image performs guided filtering on the grayscale image, which can output a filtered image that is roughly similar to the grayscale image and similar to the intermediate binarized image at the edge texture. After the guided filtering process, the noise in the image is significantly reduced.
- the second threshold is the sum of the average gray value of the filtered image and the standard deviation of the gray value, that is, the second threshold is equal to the average value of the gray value of each pixel in the filtered image plus the gray value of each pixel in the filtered image.
- the standard deviation of the degree value is the standard deviation of the degree value.
- the preset expansion factor is 1.2-1.5, eg, 1.3.
- the gray value of each high-value pixel is multiplied by a preset expansion coefficient to perform expansion processing on the gray value of the high-value pixel, thereby obtaining an expanded image with more obvious black and white contrast.
- performing a sharpening process on the expanded image to obtain a clear image includes: using Gaussian filtering to perform blurring processing on the expanded image to obtain a blurred image corresponding to the expanded image; according to a preset mixing coefficient, The blurred image corresponding to the expanded image and the expanded image are mixed proportionally to obtain a clear image.
- f 1 (i, j) is the gray value of the pixel point at (i, j) of the extended image
- f 2 (i, j) is the pixel point of the blurred image corresponding to the extended image at (i, j)
- f 3 (i, j) is the gray value of the pixel point at (i, j) of the clear image
- k 1 is the preset mixing coefficient of the extended image
- k 2 is the blurred image corresponding to the extended image
- f 3 (i,j) k 1 f 1 (i,j)+k 2 f 2 (i,j).
- the preset mixing coefficient of the extended image may be 1.5, and the preset mixing coefficient of the blurred image corresponding to the extended image may be -0.5.
- adjusting the contrast of the clear image includes: adjusting the gray value of each pixel of the clear image according to the gray mean value of the clear image. Therefore, by adjusting the contrast of the clear image, a second binarized image with more obvious black and white contrast can be obtained.
- the gray value of each pixel of a clear image can be adjusted by the following formula:
- f'(i,j) is the gray value of the pixel point at (i,j) of the second binarized image, is the average value of the gray value of each pixel point in the clear image, f(i, j) is the gray value of the pixel point at (i, j) of the clear image, and t is the intensity value.
- the intensity value may be from 0.1 to 0.5, for example, the intensity value may be 0.2. In practical applications, the intensity value can be selected according to the final ink saving effect to be achieved.
- FIG. 8 is a schematic diagram of a composite image provided by an embodiment of the present disclosure.
- step S14 the second binarized image and the first binarized image are synthesized according to the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image to obtain a synthesized image.
- combining the second binarized image and the first binarized image to obtain a composite image means combining the pixels corresponding to the positions of the plurality of circumscribed contour pixels in the first binarized image.
- the gray-scale value is replaced with the gray-scale value of the pixels corresponding to the positions of the multiple circumscribed contour pixels in the second binarized image, that is, all the pixels corresponding to the positions of the multiple circumscribed contour pixels in the first binarized image Replace with better-performing pixels.
- FIG. 8 is an image obtained by synthesizing the first binarized image shown in FIG. 4 and the second binarized image shown in FIG. 7 .
- the composite image is a binarized image.
- step S14 includes: obtaining the positions of a plurality of circumscribed contour pixels in the pixel circumscribed contour image; Two binarized pixels; according to the pixel correspondence between the second binarized image and the first binarized image, multiple target second binarized pixels in the second binarized image are synthesized into the first binarized image respectively. The same location in the image to get a composite image of the original image.
- the size of the second binarized image, the size of the first binarized image, and the size of the composite image may all be the same.
- All the second binarized pixels in the second binarized image are arranged in n rows and m columns, all the first binarized pixels in the first binarized image are arranged in n rows and m columns, and all the composite images in the composite image are arranged in n rows and m columns.
- the pixels are arranged in n rows and m columns, and all the pixels in the pixel circumscribed contour image are arranged in n rows and m columns.
- the number of all the second binarized pixels in the second binarized image is n*m
- the number of all the first binarized pixels in the first binarized image is n*m
- the composite image The number of all synthesized pixels in is n*m
- the number of all pixels in the pixel circumscribed contour image is n*m.
- the multiple target second binarized pixels are in one-to-one correspondence with the multiple circumscribed contour pixels, and the positions of the target second binarized pixels are the same as the positions of the circumscribed contour pixels corresponding to the target second binarized pixels. For example, if in the pixel circumscribed contour image, the pixel located in the i-th row and the j-th column is the circumscribed contour pixel, correspondingly, in the second binarized image, the second binarized pixel located in the i-th row and the j-th column The second binarized pixel for the target.
- step S14 according to the pixel correspondence between the second binarized image and the first binarized image, multiple target second binarized pixels in the second binarized image are synthesized into the first binarized image respectively.
- the same position in the image includes: determining the qth target second binarization pixel in the plurality of target second binarization pixels, wherein the qth target second binarization pixel is located in the second binarized image The i-th row and the j-th column of ; determine the q-th target first binarized pixel located in the i-th row and the j-th column in the first binarized image; The value is replaced with the grayscale value of the qth target second binarized pixel to obtain the qth target composite pixel located at the ith row and the jth column in the composite image.
- n, m, q, i, and j are all positive integers, and i is less than or equal to n, j is less than or equal to m, and q is less than or equal to the number of multiple target second binarized pixels.
- the first binarized pixels that do not correspond to the plurality of target second binarized pixels are directly used as the synthesized pixels in the synthesized image.
- the first binarized pixel located in the p1th row and the p2th column does not correspond to any of the multiple target second binarization pixels, that is, the second binarized image in the second binarized image is located in
- the second binarized pixel at row p1 and column p2 is not the target second binarized pixel, then the first binarized pixel located at row p1 and column p2 in the first binarized image is used as the composite image.
- the grayscale value of the synthesized pixel located at row p1 and column p2, that is, the grayscale value of the first binarized pixel located at row p1 and column p2 is the same as the grayscale value of the synthesized pixel located at row p1 and column p2.
- the pixels in the second binarized image are referred to as second binarized pixels
- the pixels in the first binarized image are referred to as first binarized pixels
- the composite image The pixels in the image are called composite pixels.
- "Second binarized pixels”, “first binarized pixels”, “synthetic pixels”, etc. are only used to distinguish pixels located in different images, and do not mean that these pixels are in different images. structure, properties, etc.
- the target second binarized pixel represents a pixel corresponding to the circumscribed contour pixel in the second binarized image
- the target first binarized pixel represents a pixel corresponding to the target second binarized pixel in the first binarized image.
- the corresponding pixel, the target composite pixel represents a pixel in the composite image corresponding to the target second binarized pixel.
- FIG. 9 is a schematic block diagram of an image processing apparatus provided by at least one embodiment of the present disclosure.
- the image processing apparatus 900 includes: an acquisition module 901 , a first binarization module 902 , a processing module 903 , a second binarization module 904 and a synthesis module 905 .
- the acquisition module 901 is used to acquire the original image.
- the original image includes at least one object.
- the first binarization module 902 is configured to process the original image through the first binarization model to obtain a first binarized image of the original image.
- the processing module 903 is configured to process the first binarized image to obtain a pixel circumscribed contour image.
- the pixel circumscribed contour image includes a plurality of circumscribed contour pixels, and the pixels in the area surrounded by the plurality of circumscribed contour pixels are pixels corresponding to at least some objects in the at least one object.
- the second binarization module 904 is configured to process the original image through the second binarization model to obtain a second binarized image.
- the synthesizing module 905 is configured to synthesize the second binarized image and the first binarized image according to the positions of a plurality of circumscribed contour pixels in the pixel circumscribed contour image to obtain a synthesized image of the original image.
- the composite image is a binarized image.
- the first binarization module 902 when the first binarization module 902 performs the operation of processing the original image through the first binarization model to obtain the first binarized image of the original image, the first binarization module 902 performs The following operations: compress the original image to obtain the input image, wherein the size of the input image is smaller than the size of the original image; process the input image through the first binarization model to obtain the first binarization of the original image image.
- the first binarization module 902 when the first binarization module 902 performs the operation of processing the input image through the first binarization model to obtain the first binarized image of the original image, the first binarization module 902 performs The following operations are as follows: processing the input image through the first binarization model to obtain a binarized predicted image of the input image; and restoring the size of the binarized predicted image to obtain the first binarized image.
- the size of the first binarized image is the same as the size of the original image.
- the processing module 903 when the processing module 903 performs an operation of processing the first binarized image to obtain a pixel circumscribed contour image, the processing module 903 performs the following operations: performing blurring processing on the first binarized image to obtain Blurred image; XOR processing is performed on the blurred image and the first binarized image to obtain a pixel circumscribed contour image.
- the synthesis module 905 performs synthesis of the second binarized image and the first binarized image according to the positions of a plurality of circumscribed contour pixels in the pixel circumscribed contour image to obtain a composite image of the original image.
- the synthesizing module 905 performs the following operations: obtaining the positions of multiple circumscribed contour pixels in the pixel circumscribed contour image; Two binarized pixels; according to the pixel correspondence between the second binarized image and the first binarized image, multiple target second binarized pixels in the second binarized image are synthesized into the first binarized image respectively. The same location in the image to get a composite image of the original image.
- All the second binarized pixels in the second binarized image are arranged in n rows and m columns, all the first binarized pixels in the first binarized image are arranged in n rows and m columns, and all the composite images in the composite image are arranged in n rows and m columns.
- the pixels are arranged in n rows and m columns.
- the synthesizing module 905 performs, according to the pixel correspondence between the second binarized image and the first binarized image, respectively synthesizing a plurality of target second binarized pixels in the second binarized image into During the operation at the same position in the first binarized image, the synthesizing module 905 includes performing the following operations: determining the qth target second binarization pixel among the plurality of target second binarization pixels, wherein the qth target second binarization pixel is The target second binarization pixel is located in the ith row and the jth column of the second binarized image; determine the qth target first binarization pixel located in the ith row and the jth column in the first binarized image; Replace the grayscale value of the first binarized pixel of the qth target with the grayscale value of the second binarized pixel of the qth target to obtain the composite image of the qth target located at the ith row and the jth column of the composite
- the grayscale value of the qth target synthetic pixel is the grayscale value of the qth target second binarized pixel, n, m, q, i, and j are all positive integers, and i is less than or equal to n, and j is less than or equal to m , q is less than or equal to the number of multiple target second binarized pixels.
- the second binarization module 904 includes a grayscale module, an intermediate binarization module, a filter module, a determination module, an expansion module, and a sharpening module.
- the grayscale module is used to perform grayscale processing on the original image to obtain a grayscale image.
- the intermediate binarization module is used to process the grayscale image according to the first threshold to obtain an intermediate binarized image.
- the filtering module is used for taking the intermediate binarized image as a guide image, and performing guide filtering processing on the grayscale image to obtain a filtered image.
- the determining module is configured to determine high-value pixels in the filtered image according to the second threshold, wherein the gray value of the high-value pixels is greater than the second threshold.
- the expansion module is used for expanding the gray value of the high-value pixel points according to the preset expansion coefficient to obtain an expanded image.
- the sharpening module is used for sharpening the expanded image to obtain a clear image, and adjusting the contrast of the clear image to obtain a second binarized image.
- acquisition module 901, first binarization module 902, processing module 903, second binarization module 904, and/or synthesis module 905 include code and programs stored in memory; the code and programs can be executed by the processor to Some or all of the functions of the acquisition module 901 , the first binarization module 902 , the processing module 903 , the second binarization module 904 and/or the synthesis module 905 as described above are implemented.
- the acquisition module 901 , the first binarization module 902 , the processing module 903 , the second binarization module 904 and/or the synthesis module 905 may be dedicated hardware devices for implementing the acquisition module 901 , the first Some or all of the functions of the binarization module 902 , the processing module 903 , the second binarization module 904 and/or the synthesis module 905 .
- the acquisition module 901, the first binarization module 902, the processing module 903, the second binarization module 904 and/or the synthesis module 905 may be one circuit board or a combination of multiple circuit boards for implementing the above-mentioned function.
- the one circuit board or the combination of multiple circuit boards may include: (1) one or more processors; (2) one or more non-transitory memories connected to the processors; and (3) The firmware stored in the memory executable by the processor.
- the acquisition module 901 is used to implement step S10 shown in FIG. 1
- the first binarization module 902 is used to implement step S11 shown in FIG. 1
- the processing module 903 is used to implement step S12 shown in FIG. 1
- the second binarization module 904 is used to implement step S13 shown in FIG. 1
- the synthesis module 905 is used to implement step S14 shown in FIG. 1 . Therefore, for the specific description of the acquisition module 901, reference may be made to the relevant description of step S10 shown in FIG. 1 in the above-mentioned embodiment of the image processing method, and for the specific description of the first binarization module 902, reference may be made to the above-mentioned embodiment of the image processing method.
- step S11 shown in FIG. 1 for the specific description of the processing module 903 , please refer to the relevant description of step S12 shown in FIG. 1 in the embodiment of the above image processing method, and for the specific description of the second binarization module 904 Reference may be made to the relevant description of step S13 shown in FIG. 1 in the embodiment of the above image processing method, and the specific description of the synthesis module 905 may refer to the relevant description of step S14 shown in FIG. 1 in the embodiment of the above image processing method.
- the image processing apparatus can achieve technical effects similar to those of the aforementioned image processing method, which will not be repeated here.
- FIG. 10 is a schematic block diagram of an electronic device provided by at least one embodiment of the present disclosure.
- the electronic device includes a processor 1001 , a communication interface 1002 , a memory 1003 and a communication bus 1004 .
- the processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004, and the components such as the processor 1001, the communication interface 1002, and the memory 1003 can also communicate through a network connection.
- the present disclosure does not limit the type and function of the network.
- Memory 1003 is used for non-transitory storage of computer readable instructions.
- the processor 1001 When the processor 1001 is configured to execute computer-readable instructions, the computer-readable instructions are executed by the processor 1001 to implement the image processing method according to any of the above embodiments.
- the processor 1001 For the specific implementation of each step of the image processing method and related explanation contents, reference may be made to the above-mentioned embodiments of the image processing method, which will not be repeated here.
- the implementation manner of the processor 1001 executing the program stored in the memory 1003 to realize the image processing method is the same as the implementation manner mentioned in the embodiment part of the foregoing image processing method, and will not be repeated here.
- the communication bus 1004 may be a Peripheral Component Interconnect Standard (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, or the like.
- PCI Peripheral Component Interconnect Standard
- EISA Extended Industry Standard Architecture
- the communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
- the communication interface 1002 is used to implement communication between the electronic device and other devices.
- the processor 1001 and the memory 1003 may be provided on the server side (or cloud).
- the processor 1001 may control other components in the electronic device to perform desired functions.
- the processor 1001 can be a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable Logic devices, discrete gate or transistor logic devices, discrete hardware components.
- the central processing unit (CPU) can be an X86 or an ARM architecture or the like.
- Memory 1003 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory.
- Volatile memory may include, for example, random access memory (RAM) and/or cache memory, among others.
- Non-volatile memory may include, for example, read only memory (ROM), hard disk, erasable programmable read only memory (EPROM), portable compact disk read only memory (CD-ROM), USB memory, flash memory, and the like.
- ROM read only memory
- EPROM erasable programmable read only memory
- CD-ROM portable compact disk read only memory
- USB memory flash memory
- flash memory flash memory
- FIG. 11 is a schematic diagram of a non-transitory computer-readable storage medium provided by at least one embodiment of the present disclosure.
- one or more computer-readable instructions 1101 may be non-transitory stored on storage medium 1100 .
- the computer readable instructions 1101 may perform one or more steps of the image processing method according to the above when executed by a processor.
- the storage medium 1100 can be applied to the above-mentioned electronic device and/or the image processing apparatus 900 .
- the storage medium 1100 may include the memory 1003 in the electronic device.
- FIG. 12 shows a schematic diagram of a hardware environment provided by at least one embodiment of the present disclosure.
- the electronic device provided by the present disclosure can be applied to the Internet system.
- the functions of the image processing apparatus and/or electronic device involved in the present disclosure can be realized by using the computer system provided in FIG. 12 .
- Such computer systems may include personal computers, notebook computers, tablet computers, cell phones, personal digital assistants, smart glasses, smart watches, smart rings, smart helmets, and any smart portable or wearable device.
- the specific system in this embodiment illustrates a hardware platform including a user interface using functional block diagrams.
- Such computer equipment may be a general purpose computer equipment or a special purpose computer equipment. Both computer devices can be used to implement the image processing apparatus and/or electronic device in this embodiment.
- the computer system may include any component that implements the information required to implement the image processing currently described.
- a computer system can be implemented by a computer device through its hardware devices, software programs, firmware, and combinations thereof.
- FIG. 12 only one computer device is drawn in FIG. 12, but the related computer functions described in this embodiment to realize the information required for image processing can be implemented in a distributed manner by a group of similar platforms, Distribute the processing load of a computer
- the computer system may include a communication port 250, which is connected to a network for realizing data communication.
- the computer system may send and receive information and data through the communication port 250, that is, the communication port 250 may enable the computer system to communicate with Other electronic devices communicate wirelessly or by wire to exchange data.
- the computer system may also include a processor group 220 (ie, the processors described above) for executing program instructions.
- the processor group 220 may consist of at least one processor (eg, a CPU).
- the computer system may include an internal communication bus 210 .
- the computer system may include various forms of program storage units and data storage units (ie, the memories or storage media described above), such as hard disk 270, read only memory (ROM) 230, random access memory (RAM) 240, capable of storing Various data files used for computer processing and/or communication, and possibly program instructions executed by the processor group 220 .
- the computer system may also include an input/output component 260 for enabling input/output data flow between the computer system and other components (eg, user interface 280, etc.).
- input devices including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speakers, vibrators, etc. output device; including storage devices such as tapes, hard disks, etc.; and a communication interface.
- input devices including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.
- LCD liquid crystal display
- speakers vibrators
- storage devices such as tapes, hard disks, etc.
- communication interface such as tapes, hard disks, etc.
- Figure 12 shows a computer system with various devices, it should be understood that the computer system is not required to have all of the devices shown, and may instead have more or fewer devices.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
Abstract
An image processing method, an image processing apparatus, an electronic device, and a non-transitory computer readable storage medium. The image processing method comprises: obtaining an original image, wherein the original image comprises at least one object; processing the original image by a first binarization model to obtain a first binarized image of the original image; processing the first binarized image to obtain a pixel circumscribed contour image, wherein the pixel circumscribed contour image comprises a plurality of circumscribed contour pixels, and pixels within an area surrounded by the plurality of circumscribed contour pixels are pixels corresponding to at least part of the objects in the at least one object; processing the original image by a second binarization model to obtain a second binarized image; and according to the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image, synthesizing the second binarized image and the first binarized image to obtain a synthesized image, wherein the composite image is a binarized image.
Description
本发明涉及数字图像处理技术领域,特别涉及一种图像处理方法、图像处理装置、电子设备、非瞬时性计算机可读存储介质。The present invention relates to the technical field of digital image processing, and in particular, to an image processing method, an image processing apparatus, an electronic device, and a non-transitory computer-readable storage medium.
在数字图像处理中,图像二值化(Image Binarization)处理就是将图像上的像素点的灰度值设置为0或255,对图像进行图像二值化处理可以使图像中的数据量大为减少,从而能凸显出感兴趣的目标的轮廓,此外,也能方便对图像进行处理和分析,例如,便于提取图像中的信息。In digital image processing, image binarization processing is to set the gray value of pixels on the image to 0 or 255, and image binarization processing can greatly reduce the amount of data in the image. , so that the outline of the target of interest can be highlighted, and in addition, it is convenient to process and analyze the image, for example, to extract the information in the image.
发明内容SUMMARY OF THE INVENTION
本公开至少一实施例提供一种图像处理方法,包括:获取原始图像,其中,所述原始图像包括至少一个对象;通过第一二值化模型对所述原始图像进行处理,以得到所述原始图像的第一二值化图像;对所述第一二值化图像进行处理,以得到像素外接轮廓图像,其中,所述像素外接轮廓图像包括多个外接轮廓像素,所述多个外接轮廓像素包围的区域内的像素为所述至少一个对象中的至少部分对象对应的像素;通过第二二值化模型对所述原始图像进行处理,以得到第二二值化图像;根据所述多个外接轮廓像素在所述像素外接轮廓图像中的位置,对所述第二二值化图像和所述第一二值化图像进行合成,以得到合成图像,其中,所述合成图像为二值化图像。At least one embodiment of the present disclosure provides an image processing method, including: acquiring an original image, wherein the original image includes at least one object; and processing the original image by using a first binarization model to obtain the original image The first binarized image of the image; the first binarized image is processed to obtain a pixel circumscribed contour image, wherein the pixel circumscribed contour image includes a plurality of circumscribed contour pixels, and the plurality of circumscribed contour pixels The pixels in the enclosed area are pixels corresponding to at least part of the objects in the at least one object; the original image is processed by a second binarization model to obtain a second binarized image; according to the plurality of objects The position of the circumscribed contour pixel in the pixel circumscribed contour image, and the second binarized image and the first binarized image are synthesized to obtain a synthesized image, wherein the synthesized image is a binary image image.
例如,在本公开至少一实施例提供的图像处理方法中,通过所述第一二值化模型对所述原始图像进行处理,以得到所述原始图像的第一二值化图像,包括:对所述原始图像进行压缩处理,以得到输入图像,其中,所述输入图像的尺寸小于所述原始图像的尺寸;通过所述第一二值化模型对所述输入图像进行处理,以得到所述原始图像的第一二值化图像。For example, in the image processing method provided by at least one embodiment of the present disclosure, the original image is processed by the first binarization model to obtain the first binarized image of the original image, including: The original image is compressed to obtain an input image, wherein the size of the input image is smaller than the size of the original image; and the input image is processed by the first binarization model to obtain the The first binarized image of the original image.
例如,在本公开至少一实施例提供的图像处理方法中,通过所述第一二值化模型对所述输入图像进行处理,以得到所述原始图像的第一二值化图像, 包括:通过所述第一二值化模型对所述输入图像进行处理,以得到所述输入图像的二值化预测图像;将所述二值化预测图像进行恢复尺寸处理,以得到所述第一二值化图像,其中,所述第一二值化图像的尺寸和所述原始图像的尺寸相同。For example, in the image processing method provided by at least one embodiment of the present disclosure, processing the input image by using the first binarization model to obtain the first binarized image of the original image includes: The first binarization model processes the input image to obtain a binarized predicted image of the input image; and restores the size of the binarized predicted image to obtain the first binarized image The size of the first binarized image is the same as the size of the original image.
例如,在本公开至少一实施例提供的图像处理方法中,对所述第一二值化图像进行处理,以得到像素外接轮廓图像,包括:对所述第一二值化图像进行模糊化处理,得到模糊图像;对所述模糊图像和所述第一二值化图像进行异或处理,以得到所述像素外接轮廓图像。For example, in the image processing method provided in at least one embodiment of the present disclosure, processing the first binarized image to obtain a pixel circumscribed contour image includes: performing blurring processing on the first binarized image , obtain a blurred image; perform XOR processing on the blurred image and the first binarized image to obtain the pixel circumscribed contour image.
例如,在本公开至少一实施例提供的图像处理方法中,根据所述像素外接轮廓图像中的所述多个外接轮廓像素的位置,对所述第二二值化图像和所述第一二值化图像进行合成,以得到所述合成图像,包括:获取所述像素外接轮廓图像中的所述多个外接轮廓像素的位置;提取所述第二二值化图像中与所述多个外接轮廓像素的位置对应的位置处的多个目标第二二值化像素;根据所述第二二值化图像和所述第一二值化图像的像素对应关系,将所述第二二值化图像中的所述多个目标第二二值化像素分别合成到所述第一二值化图像中的相同位置,以得到所述合成图像。For example, in the image processing method provided by at least one embodiment of the present disclosure, according to the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image, the second binarized image and the first binary image are analyzed. Synthesizing the binarized images to obtain the synthesized image includes: acquiring the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image; extracting the plurality of circumscribed contour pixels in the second binarized image multiple target second binarized pixels at positions corresponding to the positions of the contour pixels; according to the pixel correspondence between the second binarized image and the first binarized image, the second binarized image is The plurality of target second binarized pixels in the image are respectively combined into the same position in the first binarized image to obtain the combined image.
例如,在本公开至少一实施例提供的图像处理方法中,所述第二二值化图像中的所有第二二值化像素排列为n行m列,所述第一二值化图像中的所有第一二值化像素排列为n行m列,所述合成图像中的所有合成像素排列为n行m列,根据所述第二二值化图像和所述第一二值化图像的像素对应关系,将所述第二二值化图像中的所述多个目标第二二值化像素分别合成到所述第一二值化图像中的相同位置,包括:确定所述多个目标第二二值化像素中的第q个目标第二二值化像素,其中,所述第q个目标第二二值化像素位于所述第二二值化图像的第i行第j列;确定所述第一二值化图像中的位于所述第i行第j列的第q个目标第一二值化像素;将所述第q个目标第一二值化像素的灰阶值替换为所述第q个目标第二二值化像素的灰阶值,以得到所述合成图像中位于所述第i行第j列的第q个目标合成像素,其中,所述第q个目标合成像素的灰阶值为所述第q个目标第二二值化像素的灰阶值,n、m、q、i、j均为正整数,且i小于等于n,j小于等于m,q小于等于所述多个目标第二 二值化像素的数量。For example, in the image processing method provided by at least one embodiment of the present disclosure, all the second binarized pixels in the second binarized image are arranged in n rows and m columns, and the pixels in the first binarized image are arranged in n rows and m columns. All the first binarized pixels are arranged in n rows and m columns, and all the synthesized pixels in the composite image are arranged in n rows and m columns, according to the pixels of the second binarized image and the first binarized image Corresponding relationship, synthesizing the multiple target second binarized pixels in the second binarized image to the same position in the first binarized image respectively includes: determining the multiple target second binarized pixels. The q th target second binarized pixel in the two binarized pixels, wherein the q th target second binarized pixel is located in the ith row and the jth column of the second binarized image; determine The q-th target first binarized pixel located in the i-th row and j-th column in the first binarized image; replace the grayscale value of the q-th target first binarized pixel with the grayscale value of the second binarized pixel of the q th target, so as to obtain the q th target composite pixel located in the i th row and the j th column in the composite image, wherein the q th target composite pixel The grayscale value of the pixel is the grayscale value of the qth target second binarized pixel, n, m, q, i, and j are all positive integers, and i is less than or equal to n, j is less than or equal to m, and q is less than or equal to is equal to the number of the plurality of target second binarized pixels.
例如,在本公开至少一实施例提供的图像处理方法中,通过第二二值化模型对所述原始图像进行处理,以得到第二二值化图像,包括:对所述原始图像进行灰度化处理,得到灰度图像;根据第一阈值,对所述灰度图像进行处理,得到中间二值化图像;以所述中间二值化图像为导向图,对所述灰度图像进行导向滤波处理,得到滤波图像;根据第二阈值,确定所述滤波图像中的高值像素点,其中,所述高值像素点的灰度值大于所述第二阈值;根据预设扩充系数,对所述高值像素点的灰度值进行扩充处理,得到扩充图像;对所述扩充图像进行清晰化处理,得到清晰图像;以及对所述清晰图像的对比度进行调整,得到所述第二二值化图像。For example, in the image processing method provided by at least one embodiment of the present disclosure, processing the original image by using a second binarization model to obtain a second binarized image includes: performing grayscale on the original image process the grayscale image to obtain a grayscale image; process the grayscale image according to the first threshold to obtain an intermediate binarized image; use the intermediate binarized image as a guide map to perform guided filtering on the grayscale image process to obtain a filtered image; determine high-value pixels in the filtered image according to a second threshold, wherein the gray value of the high-value pixels is greater than the second threshold; The gray value of the high-value pixels is expanded to obtain an expanded image; the expanded image is sharpened to obtain a clear image; and the contrast of the clear image is adjusted to obtain the second binarization image.
例如,在本公开至少一实施例提供的图像处理方法中,所述第一二值化模型为基于神经网络的模型。For example, in the image processing method provided by at least one embodiment of the present disclosure, the first binarization model is a model based on a neural network.
本公开至少一实施例提供一种图像处理装置,包括:获取模块,用于获取原始图像,其中,所述原始图像包括至少一个对象;第一二值化模块,用于通过第一二值化模型对所述原始图像进行处理,以得到所述原始图像的第一二值化图像;处理模块,用于对所述第一二值化图像进行处理,以得到像素外接轮廓图像,其中,所述像素外接轮廓图像包括多个外接轮廓像素,所述多个外接轮廓像素包围的区域内的像素为所述至少一个对象中的至少部分对象对应的像素;第二二值化模块,用于通过第二二值化模型对所述原始图像进行处理,以得到第二二值化图像;合成模块,用于根据所述多个外接轮廓像素在所述像素外接轮廓图像中的位置,对所述第二二值化图像和所述第一二值化图像进行合成,以得到所述合成图像,其中,所述合成图像为二值化图像。At least one embodiment of the present disclosure provides an image processing apparatus, including: an acquisition module for acquiring an original image, wherein the original image includes at least one object; and a first binarization module for obtaining an original image through a first binarization The model processes the original image to obtain a first binarized image of the original image; a processing module is used to process the first binarized image to obtain a pixel circumscribed contour image, wherein the The pixel circumscribed contour image includes a plurality of circumscribed contour pixels, and the pixels in the area surrounded by the plurality of circumscribed contour pixels are pixels corresponding to at least part of the objects in the at least one object; the second binarization module is configured to pass The second binarization model processes the original image to obtain a second binarized image; the synthesis module is configured to, according to the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image, analyze the The second binarized image and the first binarized image are combined to obtain the combined image, wherein the combined image is a binarized image.
例如,在本公开至少一实施例提供的图像处理装置中,所述第一二值化模块执行通过第一二值化模型对所述原始图像进行处理,以得到所述原始图像的第一二值化图像的操作时,包括执行以下操作:对所述原始图像进行压缩处理,以得到输入图像,其中,所述输入图像的尺寸小于所述原始图像的尺寸;通过所述第一二值化模型对所述输入图像进行处理,以得到所述原始图像的第一二值化图像。For example, in the image processing apparatus provided in at least one embodiment of the present disclosure, the first binarization module performs processing on the original image through a first binarization model, so as to obtain the first two images of the original image. The operation of binarizing the image includes performing the following operations: compressing the original image to obtain an input image, wherein the size of the input image is smaller than the size of the original image; The model processes the input image to obtain a first binarized image of the original image.
例如,在本公开至少一实施例提供的图像处理装置中,所述第一二值化模块执行通过所述第一二值化模型对所述输入图像进行处理,以得到所述原始图像的第一二值化图像的操作时,包括执行以下操作:通过所述第一二值化模型对所述输入图像进行处理,以得到所述输入图像的二值化预测图像;将所述二值化预测图像进行恢复尺寸处理,以得到所述第一二值化图像,其中,所述第一二值化图像的尺寸和所述原始图像的尺寸相同。For example, in the image processing apparatus provided in at least one embodiment of the present disclosure, the first binarization module performs processing on the input image by using the first binarization model, so as to obtain a second image of the original image. The operation of a binarized image includes performing the following operations: processing the input image by using the first binarization model to obtain a binarized predicted image of the input image; The predicted image is resized to obtain the first binarized image, wherein the size of the first binarized image is the same as the size of the original image.
例如,在本公开至少一实施例提供的图像处理装置中,所述处理模块执行对所述第一二值化图像进行处理,以得到像素外接轮廓图像的操作时,包括执行以下操作:对所述第一二值化图像进行模糊化处理,得到模糊图像;对所述模糊图像和所述第一二值化图像进行异或处理,以得到所述像素外接轮廓图像。For example, in the image processing apparatus provided in at least one embodiment of the present disclosure, when the processing module performs the operation of processing the first binarized image to obtain a pixel circumscribed contour image, the operation includes performing the following operations: performing a blurring process on the first binarized image to obtain a blurred image; and performing XOR processing on the blurred image and the first binarized image to obtain the pixel circumscribed contour image.
例如,在本公开至少一实施例提供的图像处理装置中,所述合成模块执行根据所述像素外接轮廓图像中的所述多个外接轮廓像素的位置,对所述第二二值化图像和所述第一二值化图像进行合成,以得到所述原始图像的合成图像的操作时,包括执行以下操作:获取所述像素外接轮廓图像中的所述多个外接轮廓像素的位置;提取所述第二二值化图像中与所述多个外接轮廓像素的位置对应的位置处的多个目标第二二值化像素;根据所述第二二值化图像和所述第一二值化图像的像素对应关系,将所述第二二值化图像中的所述多个目标第二二值化像素分别合成到所述第一二值化图像中的相同位置,以得到所述原始图像的合成图像。For example, in the image processing apparatus provided by at least one embodiment of the present disclosure, the synthesizing module performs, according to the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image, the second binarized image and the When the first binarized image is synthesized to obtain a synthesized image of the original image, the operation includes performing the following operations: obtaining the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image; multiple target second binarized pixels at positions corresponding to the positions of the plurality of circumscribed contour pixels in the second binarized image; according to the second binarized image and the first binarized The pixel correspondence of the image, the multiple target second binarized pixels in the second binarized image are respectively synthesized into the same position in the first binarized image to obtain the original image composite image.
例如,在本公开至少一实施例提供的图像处理装置中,所述第二二值化图像中的所有第二二值化像素排列为n行m列,所述第一二值化图像中的所有第一二值化像素排列为n行m列,所述合成图像中的所有合成像素排列为n行m列,所述合成模块执行根据所述第二二值化图像和所述第一二值化图像的像素对应关系,将所述第二二值化图像中的所述多个目标第二二值化像素分别合成到所述第一二值化图像中的相同位置的操作时,包括执行以下操作:确定所述多个目标第二二值化像素中的第q个目标第二二值化像素,其中,所述第q个目标第二二值化像素位于所述第二二值化图像的第i行第j列;确定所述第一二值化图像中的位于所述第i行第j列的第q个目标第一二值化 像素;将所述第q个目标第一二值化像素的灰阶值替换为所述第q个目标第二二值化像素的灰阶值,以得到所述合成图像中位于所述第i行第j列的第q个目标合成像素,其中,所述第q个目标合成像素的灰阶值为所述第q个目标第二二值化像素的灰阶值,n、m、q、i、j均为正整数,且i小于等于n,j小于等于m,q小于等于所述多个目标第二二值化像素的数量。For example, in the image processing apparatus provided in at least one embodiment of the present disclosure, all the second binarized pixels in the second binarized image are arranged in n rows and m columns, and the pixels in the first binarized image are arranged in n rows and m columns. All the first binarized pixels are arranged in n rows and m columns, and all the synthesized pixels in the composite image are arranged in n rows and m columns, and the composite module executes the process according to the second binarized image and the first binarized image. The pixel correspondence relationship of the binarized image, and the operation of synthesizing the plurality of target second binarized pixels in the second binarized image to the same position in the first binarized image respectively includes: performing the following operations: determining the qth target second binarization pixel in the plurality of target second binarization pixels, wherein the qth target second binarization pixel is located in the second binarization pixel The i-th row and the j-th column of the binarized image are determined; the q-th target first binarized pixel located in the i-th row and the j-th column in the first binarized image is determined; the q-th target first binarized pixel is The gray-level value of a binarized pixel is replaced with the gray-level value of the q-th target second binarized pixel, so as to obtain the q-th target composite in the i-th row and j-th column in the composite image pixel, wherein the grayscale value of the qth target composite pixel is the grayscale value of the qth target second binarized pixel, n, m, q, i, and j are all positive integers, and i is less than or equal to n, j is less than or equal to m, and q is less than or equal to the number of the plurality of target second binarized pixels.
例如,在本公开至少一实施例提供的图像处理装置中,所述第二二值化模块包括:灰度化模块,用于对所述原始图像进行灰度化处理,得到灰度图像;中间二值化模块,用于根据第一阈值,对所述灰度图像进行处理,得到中间二值化图像;滤波模块,用于以所述中间二值化图像为导向图,对所述灰度图像进行导向滤波处理,得到滤波图像;确定模块,用于根据第二阈值,确定所述滤波图像中的高值像素点,其中,所述高值像素点的灰度值大于所述第二阈值;扩充模块,用于根据预设扩充系数,对所述高值像素点的灰度值进行扩充处理,得到扩充图像;清晰化模块,用于对所述扩充图像进行清晰化处理,得到清晰图像,对所述清晰图像的对比度进行调整,得到所述第二二值化图像。For example, in the image processing apparatus provided in at least one embodiment of the present disclosure, the second binarization module includes: a grayscale module, configured to perform grayscale processing on the original image to obtain a grayscale image; an intermediate The binarization module is used to process the grayscale image according to the first threshold to obtain an intermediate binarized image; the filtering module is used to take the intermediate binarized image as a guide map, and to process the grayscale image. The image is subjected to guided filtering processing to obtain a filtered image; a determination module is configured to determine high-value pixels in the filtered image according to a second threshold, wherein the gray value of the high-value pixels is greater than the second threshold The expansion module is used to expand the gray value of the high-value pixel points according to the preset expansion coefficient to obtain an expanded image; the clearing module is used to clear the expanded image to obtain a clear image. , and adjust the contrast of the clear image to obtain the second binarized image.
本公开至少一实施例提供一种电子设备,包括:存储器,用于非瞬时性地存储计算机可读指令;处理器,用于运行所述计算机可读指令,所述计算机可读指令被所述处理器运行时实现根据本公开任一实施例所述的图像处理方法。At least one embodiment of the present disclosure provides an electronic device, comprising: a memory for non-transitory storage of computer-readable instructions; a processor for executing the computer-readable instructions, the computer-readable instructions being executed by the The image processing method according to any embodiment of the present disclosure is implemented when the processor runs.
本公开至少一实施例提供一种非瞬时性计算机可读存储介质,其中,所述非瞬时性计算机可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现根据本公开任一实施例所述的图像处理方法。At least one embodiment of the present disclosure provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer-readable instructions that, when executed by a processor, implement a The image processing method described in any embodiment of the present disclosure.
为了更清楚地说明本公开实施例的技术方案,下面将对实施例的附图作简单地介绍,显而易见地,下面描述中的附图仅仅涉及本公开的一些实施例,而非对本公开的限制。In order to explain the technical solutions of the embodiments of the present disclosure more clearly, the accompanying drawings of the embodiments will be briefly introduced below. Obviously, the drawings in the following description only relate to some embodiments of the present disclosure, rather than limit the present disclosure. .
图1为本公开至少一实施例提供的一种图像处理方法的示意性流程图;FIG. 1 is a schematic flowchart of an image processing method provided by at least one embodiment of the present disclosure;
图2为本公开至少一实施例提供的一种原始图像的示意图;FIG. 2 is a schematic diagram of an original image provided by at least one embodiment of the present disclosure;
图3示出了本公开一实施例提供的一种输入图像;FIG. 3 shows an input image provided by an embodiment of the present disclosure;
图4为本公开一实施例提供的第一二值化图像的示意图;FIG. 4 is a schematic diagram of a first binarized image provided by an embodiment of the present disclosure;
图5为本公开一实施例提供的一种模糊图像的示意图;FIG. 5 is a schematic diagram of a blurred image provided by an embodiment of the present disclosure;
图6为本公开一实施例提供的一种像素外接轮廓图像;FIG. 6 is a pixel circumscribed contour image provided by an embodiment of the present disclosure;
图7为本公开一实施例提供的一种第二二值化图像的示意图;FIG. 7 is a schematic diagram of a second binarized image according to an embodiment of the present disclosure;
图8为本公开一实施例提供的一种合成图像的示意图;FIG. 8 is a schematic diagram of a composite image provided by an embodiment of the present disclosure;
图9为本公开至少一实施例提供的一种图像处理装置的示意性框图;FIG. 9 is a schematic block diagram of an image processing apparatus according to at least one embodiment of the present disclosure;
图10为本公开至少一实施例提供的一种电子设备的示意性框图;10 is a schematic block diagram of an electronic device according to at least one embodiment of the present disclosure;
图11为本公开至少一实施例提供的一种非瞬时性计算机可读存储介质的示意图;11 is a schematic diagram of a non-transitory computer-readable storage medium provided by at least one embodiment of the present disclosure;
图12为本公开至少一实施例提供的一种硬件环境的示意图。FIG. 12 is a schematic diagram of a hardware environment provided by at least one embodiment of the present disclosure.
为了使得本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例的附图,对本公开实施例的技术方案进行清楚、完整地描述。显然,所描述的实施例是本公开的一部分实施例,而不是全部的实施例。基于所描述的本公开的实施例,本领域普通技术人员在无需创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present disclosure. Obviously, the described embodiments are some, but not all, embodiments of the present disclosure. Based on the described embodiments of the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the protection scope of the present disclosure.
除非另外定义,本公开使用的技术术语或者科学术语应当为本公开所属领域内具有一般技能的人士所理解的通常意义。本公开中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。“包括”或者“包含”等类似的词语意指出现该词前面的元件或者物件涵盖出现在该词后面列举的元件或者物件及其等同,而不排除其他元件或者物件。“连接”或者“相连”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电性的连接,不管是直接的还是间接的。“上”、“下”、“左”、“右”等仅用于表示相对位置关系,当被描述对象的绝对位置改变后,则该相对位置关系也可能相应地改变。Unless otherwise defined, technical or scientific terms used in this disclosure shall have the ordinary meaning as understood by one of ordinary skill in the art to which this disclosure belongs. As used in this disclosure, "first," "second," and similar terms do not denote any order, quantity, or importance, but are merely used to distinguish the various components. "Comprises" or "comprising" and similar words mean that the elements or things appearing before the word encompass the elements or things recited after the word and their equivalents, but do not exclude other elements or things. Words like "connected" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "Down", "Left", "Right", etc. are only used to represent the relative positional relationship, and when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
为了保持本公开实施例的以下说明清楚且简明,本公开省略了部分已知功能和已知部件的详细说明。In order to keep the following description of the embodiments of the present disclosure clear and concise, the present disclosure omits a detailed description of some well-known functions and well-known components.
本公开至少一实施例提供一种图像处理方法、图像处理装置、电子设备、非瞬时性计算机可读存储介质。图像处理方法包括:获取原始图像,其中,原始图像包括至少一个对象;通过第一二值化模型对原始图像进行处理,以得到原始图像的第一二值化图像;对第一二值化图像进行处理,以得到像素外接轮廓图像,其中,像素外接轮廓图像包括多个外接轮廓像素,多个外接轮廓像素包围的区域内的像素为至少一个对象中的至少部分对象对应的像素;通过第二二值化模型对原始图像进行处理,以得到第二二值化图像;根据像素外接轮廓图像中的多个外接轮廓像素的位置,对第二二值化图像和第一二值化图像进行合成,以得到原始图像的合成图像。例如,合成图像为二值化图像。At least one embodiment of the present disclosure provides an image processing method, an image processing apparatus, an electronic device, and a non-transitory computer-readable storage medium. The image processing method includes: acquiring an original image, wherein the original image includes at least one object; processing the original image through a first binarization model to obtain a first binarized image of the original image; Perform processing to obtain a pixel circumscribed contour image, wherein the pixel circumscribed contour image includes a plurality of circumscribed contour pixels, and the pixels in the area surrounded by the plurality of circumscribed contour pixels are pixels corresponding to at least part of the at least one object; The binarization model processes the original image to obtain a second binarized image; the second binarized image and the first binarized image are synthesized according to the positions of multiple circumscribed contour pixels in the pixel circumscribed contour image , to get a composite image of the original image. For example, the composite image is a binarized image.
该图像处理方法能够可以将原始图像(例如,彩色图像或不清晰的图像)转换为黑白对比较为明显且清晰的二值化图像,有效提高二值化图像的质量,提高图像内容的辨识度,此外,由于转换后的图像噪声干扰较少且黑白对比明显,从而可以有效改善打印效果。The image processing method can convert an original image (for example, a color image or an unclear image) into a binarized image with obvious and clear black and white contrast, which can effectively improve the quality of the binarized image and improve the recognition degree of the image content. In addition, since the converted image has less noise and obvious black and white contrast, it can effectively improve the printing effect.
需要说明的是,本公开实施例提供的图像处理方法可应用于本公开实施例提供的图像处理装置,该图像处理装置可被配置于电子设备上。该电子设备可以是个人计算机、移动终端等,该移动终端可以是手机、平板电脑等具有各种操作系统的硬件设备。It should be noted that the image processing method provided by the embodiment of the present disclosure can be applied to the image processing apparatus provided by the embodiment of the present disclosure, and the image processing apparatus can be configured on an electronic device. The electronic device may be a personal computer, a mobile terminal, etc., and the mobile terminal may be a hardware device with various operating systems, such as a mobile phone, a tablet computer, and the like.
下面结合附图对本公开的实施例进行详细说明,但是本公开并不限于这些具体的实施例。The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings, but the present disclosure is not limited to these specific embodiments.
图1为本公开至少一实施例提供的一种图像处理方法的示意性流程图;图2为本公开至少一实施例提供的一种原始图像的示意图。FIG. 1 is a schematic flowchart of an image processing method provided by at least one embodiment of the present disclosure; FIG. 2 is a schematic diagram of an original image provided by at least one embodiment of the present disclosure.
如图1所示,本公开实施例提供的图像处理方法包括步骤S10至S14。As shown in FIG. 1 , the image processing method provided by the embodiment of the present disclosure includes steps S10 to S14.
如图1所示,首先,图像处理方法包括步骤S10:获取原始图像。As shown in FIG. 1 , first, the image processing method includes step S10 : acquiring an original image.
例如,原始图像包括至少一个对象,对象可以为字符,字符可以包括中文(例如,汉字或拼音)、英文、日文、法文、韩文、拉丁文、数字等,此外,对象还可以包括各种符号(例如,大于符号、小于符号、百分号等)和各种图形等。至少一个对象可以包括印刷或者机器输入的字符,也可以包括手写字符。例如,如图2所示,在一些实施例中,原始图像中的对象可以包括印 刷体的单词和字母(例如,英文、日文、法文、韩文、德文、拉丁文等不同国家的语言和文字)、印刷体的数字(例如,日期、重量、尺寸等)、印书体的符号和图像等、手写的单词和字母、手写的数字、手写的符号和图形等。For example, the original image includes at least one object, and the object may be a character, and the character may include Chinese (for example, Chinese characters or pinyin), English, Japanese, French, Korean, Latin, numbers, etc. In addition, the object may also include various symbols ( For example, greater than sign, less than sign, percent sign, etc.) and various graphics, etc. At least one of the objects may include printed or machine-typed characters, as well as handwritten characters. For example, as shown in FIG. 2, in some embodiments, objects in the original image may include words and letters in print (eg, English, Japanese, French, Korean, German, Latin, etc. in different national languages and scripts) ), printed numbers (eg, dates, weights, dimensions, etc.), printed symbols and images, etc., handwritten words and letters, handwritten numbers, handwritten symbols and graphics, etc.
原始图像可以为各种类型的图像,例如,可以为购物清单的图像、餐饮小票的图像、试卷的图像、合同的图像等。如图2所示,原始图像可以为信件的图像。The original image may be various types of images, for example, may be an image of a shopping list, an image of a dining receipt, an image of a test paper, an image of a contract, and the like. As shown in FIG. 2, the original image may be an image of a letter.
原始图像的形状可以为矩形等。原始图像的形状和尺寸等可以由用户根据实际情况自行设定。The shape of the original image can be rectangle etc. The shape and size of the original image can be set by the user according to the actual situation.
原始图像可以为通过图像采集装置(例如,数码相机或手机等)拍摄的图像,原始图像可以为灰度图像,也可以为彩色图像。需要说明的是,原始图像是指以可视化方式呈现待处理物体(例如,试卷、合作、购物小票等)的形式,例如待处理物体的图片等。又例如,原始图像也可以通过扫描等方式得到。例如,原始图像可以为图像采集装置直接采集到的图像,也可以是对采集得到的图像进行预处理之后获得的图像。例如,为了避免原始图像的数据质量、数据不均衡等对图像处理的影响,在处理原始图像前,本公开的至少一实施例提供的图像处理方法还可以包括对原始图像进行预处理的操作。预处理例如可以包括对图像采集装置直接采集到的图像进行剪裁、伽玛(Gamma)校正或降噪滤波等处理。预处理可以消除原始图像中的无关信息或噪声信息,以便于更好地对原始图像进行图像处理。The original image may be an image captured by an image acquisition device (eg, a digital camera or a mobile phone, etc.), and the original image may be a grayscale image or a color image. It should be noted that the original image refers to a form in which the object to be processed (eg, test paper, cooperation, shopping receipt, etc.) is presented in a visual manner, such as a picture of the object to be processed. For another example, the original image can also be obtained by scanning or the like. For example, the original image may be an image directly collected by an image collection device, or an image obtained after preprocessing the collected image. For example, in order to avoid the influence of data quality and data imbalance of the original image on image processing, before processing the original image, the image processing method provided by at least one embodiment of the present disclosure may further include an operation of preprocessing the original image. The preprocessing may include, for example, processing, such as cropping, gamma (Gamma) correction, or noise reduction filtering, on the image directly collected by the image collection device. Preprocessing can eliminate irrelevant information or noise information in the original image, so as to facilitate better image processing of the original image.
接下来,如图1所示,在步骤S11,通过第一二值化模型对原始图像进行处理,以得到原始图像的第一二值化图像。Next, as shown in FIG. 1 , in step S11 , the original image is processed through a first binarization model to obtain a first binarized image of the original image.
例如,第一二值化模型为基于神经网络的模型。例如,第一二值化模型可以采用机器学习技术实现并且例如运行在通用计算装置或专用计算装置上。该第一二值化模型为预先训练得到的神经网络模型。例如,第一二值化模型可以采用U-net神经网络、与U-net神经网络类似的神经网络、Mask-rcnn神经网络等神经网络实现。For example, the first binarization model is a neural network-based model. For example, the first binarization model may be implemented using machine learning techniques and run, for example, on a general purpose computing device or a special purpose computing device. The first binarization model is a neural network model obtained by pre-training. For example, the first binarization model can be implemented by using a U-net neural network, a neural network similar to the U-net neural network, a Mask-rcnn neural network, or other neural networks.
例如,第一二值化模型用于对原始图像进行二值化处理,以得到第一二值化图像。二值化处理是将原始图像上的像素点的灰度值设置为第一灰度值(例如,0)或第二灰度值(例如,255),也就是使得整个原始图像呈现出明 显的黑白效果的过程。For example, the first binarization model is used to binarize the original image to obtain the first binarized image. The binarization process is to set the gray value of the pixel on the original image to the first gray value (for example, 0) or the second gray value (for example, 255), that is, to make the whole original image appear obvious Process of black and white effect.
可以通过大量原始训练图像和该原始训练图像的二值化后的图像对待训练的第一二值化模型进行训练,然后建立第一二值化模型(例如,U-net神经网络等神经网络模型)。对该待训练的第一二值化模型进行训练以建立第一二值化模型的过程可以参考神经网络领域中的训练过程,具体过程不再赘述。The first binarization model to be trained can be trained through a large number of original training images and the binarized images of the original training images, and then the first binarization model (for example, a neural network model such as a U-net neural network) is established. ). For the process of training the to-be-trained first binarization model to establish the first binarization model, reference may be made to the training process in the field of neural networks, and the specific process will not be repeated.
需要说明的是,在一些实施例中,还可以采用现有的二值化处理方法对原始图像进行二值化处理以得到第一二值化图像。例如,二值化处理方法可以包括阈值法,阈值法包括:设置二值化阈值,将原始图像中的每个像素的灰阶值与二值化阈值进行比较,若原始图像中的某像素的灰阶值大于或等于二值化阈值,则将该像素的灰阶值设置为255灰阶,若原始图像中的某像素的灰阶值小于二值化阈值,则将该像素的灰阶值设置为0灰阶,由此即可实现对原始图像进行二值化处理。例如,二值化阈值的选取方法包括双峰法、P参数法、大律法(OTSU法)、最大熵值法、迭代法等。It should be noted that, in some embodiments, an existing binarization processing method may also be used to perform binarization processing on the original image to obtain the first binarized image. For example, the binarization processing method may include a threshold value method, and the threshold value method includes: setting a binarization threshold value, and comparing the gray level value of each pixel in the original image with the binarization threshold value. If the grayscale value is greater than or equal to the binarization threshold, the grayscale value of the pixel is set to 255 grayscale. If the grayscale value of a pixel in the original image is less than the binarization threshold, the grayscale value of the pixel is set to Set it to 0 grayscale, so that the original image can be binarized. For example, the selection method of the binarization threshold includes the bimodal method, the P-parameter method, the big law (OTSU method), the maximum entropy method, and the iterative method.
在一些实施例中,步骤S11可以包括:对原始图像进行压缩处理,以得到输入图像;通过第一二值化模型对输入图像进行处理,以得到原始图像的第一二值化图像。In some embodiments, step S11 may include: compressing the original image to obtain an input image; and processing the input image through a first binarization model to obtain a first binarized image of the original image.
图3示出了本公开一实施例提供的一种输入图像,例如,图3中的输入图像可以为对图2中的原始图像进行压缩处理后的图像。FIG. 3 shows an input image provided by an embodiment of the present disclosure. For example, the input image in FIG. 3 may be an image obtained by compressing the original image in FIG. 2 .
输入图像的尺寸小于原始图像的尺寸。需要说明的是,在通过第一二值化模型进行二值化预测处理时,如果原始图像太大,则处理速度会比较慢,从而为了提高处理速度,则可以对原始图像进行压缩处理以得到压缩后的输入图像,然后通过第一二值化模型对输入图像进行二值化预测处理。The dimensions of the input image are smaller than the dimensions of the original image. It should be noted that when the first binarization model is used for the binarization prediction processing, if the original image is too large, the processing speed will be relatively slow. Therefore, in order to improve the processing speed, the original image can be compressed to obtain The compressed input image is then subjected to binarization prediction processing on the input image through the first binarization model.
在一些实施例中,输入图像的尺寸可以为1500*1500。需要说明的是,输入图像的尺寸不限于此,可以根据实际情况设置,用户可以预先设定压缩比例等,压缩比例与处理速度和图像质量等因素相关,用户可以综合考虑处理速度和图像质量等因素来设置压缩比例。若需要使得处理速度较快,则压缩比例可以较大,从而使得输入图像的尺寸较小,然而,此时,最终得到的第一二值化图像的质量可能较差;若需要得到最终的第一二值化图像的质量较好,则压缩比例可以较小,从而使得输入图像的尺寸较大,此时,处理速度 则较慢,即第一二值化模型对输入图像进行二值化处理的过程较长。在一些示例中,输入图像的长宽比和原始图像的长宽比可以相同,在另一些示例中,输入图像的长宽比和原始图像的长宽可以不相同,此时,相对于原始图像,输入图像产生形变,当对输入图像进行处理后,得到二值化预测图像,该二值化预测图像的尺寸需要恢复到与原始图像的尺寸相同,例如,目前,主流的例如iphone手机拍摄得到的照片的分辨率是1200万像素,即4000*3000,此时,原始图像的尺寸可以为4000*3000,对该原始图像进行压缩处理后得到的输入图像的尺寸也可以为1500*1500,此时,输入图像产生形变。In some embodiments, the size of the input image may be 1500*1500. It should be noted that the size of the input image is not limited to this, and can be set according to the actual situation. The user can preset the compression ratio, etc. The compression ratio is related to factors such as processing speed and image quality, and the user can comprehensively consider the processing speed and image quality. factor to set the compression ratio. If the processing speed needs to be made faster, the compression ratio can be larger, so that the size of the input image is smaller. However, at this time, the quality of the final first binarized image may be poor; if the final second binarized image needs to be obtained If the quality of the binarized image is better, the compression ratio can be smaller, so that the size of the input image is larger. At this time, the processing speed is slower, that is, the first binarization model performs binarization processing on the input image. process is longer. In some examples, the aspect ratio of the input image and the aspect ratio of the original image may be the same. In other examples, the aspect ratio of the input image and the aspect ratio of the original image may be different. In this case, relative to the original image , the input image is deformed. After the input image is processed, a binarized predicted image is obtained. The size of the binarized predicted image needs to be restored to the same size as the original image. The resolution of the photo is 12 million pixels, that is, 4000*3000. At this time, the size of the original image can be 4000*3000, and the size of the input image obtained after compressing the original image can also be 1500*1500. This , the input image is deformed.
图4为本公开一实施例提供的第一二值化图像的示意图。FIG. 4 is a schematic diagram of a first binarized image provided by an embodiment of the present disclosure.
在步骤S11中,通过第一二值化模型对输入图像进行处理,以得到原始图像的第一二值化图像,包括:通过第一二值化模型对输入图像进行处理,以得到输入图像的二值化预测图像;将二值化预测图像进行恢复尺寸处理,以得到第一二值化图像。In step S11, processing the input image through the first binarization model to obtain the first binarization image of the original image includes: processing the input image through the first binarization model to obtain the first binarization model of the input image. Binarize the predicted image; restore the size of the binarized predicted image to obtain a first binarized image.
图4中的第一二值化图像为图2所示的原始图像的二值化图像。例如,第一二值化图像的尺寸和原始图像的尺寸相同。The first binarized image in FIG. 4 is the binarized image of the original image shown in FIG. 2 . For example, the size of the first binarized image is the same as the size of the original image.
如图4所示,在第一二值化图像中,黑色像素表示对象对应的像素,而白色像素则表示背景对应的像素。As shown in FIG. 4 , in the first binarized image, the black pixels represent the pixels corresponding to the object, and the white pixels represent the pixels corresponding to the background.
例如,二值化预测图像的尺寸和输入图像的尺寸相同。For example, the size of the binarized predicted image is the same as the size of the input image.
需要说明的是,在得到二值化预测图像之后,将二值化预测图像进行恢复尺寸处理,即按照扩大比例对二值化预测图进行尺寸扩大,以使得第一二值化图像的尺寸和原始图像的尺寸相同,从而可以方便后期在对应位置进行像素合成。在恢复尺寸处理中,扩大比例可以与压缩比例相对应,例如,若压缩比例为1/K,则扩大比例可以为K。It should be noted that, after the binarized predicted image is obtained, the size of the binarized predicted image is restored, that is, the size of the binarized predicted image is enlarged according to the enlargement ratio, so that the size of the first binarized image is equal to the size of the first binarized image. The size of the original image is the same, so that it is convenient to perform pixel synthesis at the corresponding position later. In the resizing process, the enlargement ratio may correspond to the compression ratio. For example, if the compression ratio is 1/K, the enlargement ratio may be K.
在一些实施例中,可以采用插值法对二值化预测图像进行恢复尺寸处理,以得到第一二值化图像。In some embodiments, an interpolation method may be used to restore the size of the binarized predicted image to obtain the first binarized image.
图5为本公开一实施例提供的一种模糊图像的示意图,图6为本公开一实施例提供的一种像素外接轮廓图像。FIG. 5 is a schematic diagram of a blurred image according to an embodiment of the disclosure, and FIG. 6 is a pixel circumscribed contour image according to an embodiment of the disclosure.
接下来,如图1所示,在步骤S12,对第一二值化图像进行处理,以得到像素外接轮廓图像。Next, as shown in FIG. 1 , in step S12 , the first binarized image is processed to obtain a pixel circumscribed contour image.
图6示出的像素外接轮廓图像为对图4所示的第一二值化图像进行处理后得到的像素外接轮廓图像。The pixel circumscribed contour image shown in FIG. 6 is a pixel circumscribed contour image obtained by processing the first binarized image shown in FIG. 4 .
如图6所示,像素外接轮廓图像包括多个外接轮廓像素,图6中白色像素表示外接轮廓像素。多个外接轮廓像素包围的区域内的像素为至少一个对象中的至少部分对象对应的像素,图6中白色像素内部的黑色像素则表示对象的像素。As shown in FIG. 6 , the pixel circumscribed contour image includes a plurality of circumscribed contour pixels, and the white pixels in FIG. 6 represent circumscribed contour pixels. The pixels in the area surrounded by the plurality of circumscribed contour pixels are pixels corresponding to at least part of the at least one object, and the black pixels inside the white pixels in FIG. 6 represent the pixels of the object.
在一些实施例中,步骤S12包括:对第一二值化图像进行模糊化处理,得到模糊图像;对模糊图像和第一二值化图像进行异或处理,以得到像素外接轮廓图像。In some embodiments, step S12 includes: performing a blurring process on the first binarized image to obtain a blurred image; and performing XOR processing on the blurred image and the first binarized image to obtain a pixel circumscribed contour image.
图5示出的模糊图像可以为对图4所示的第一二值化图像进行模糊化处理后得到的模糊图像。如图4和图5所示,对第一二值化图像进行模糊化处理之后,该第一二值化图像中的对象的掩模区域(Mask区域)变大。The blurred image shown in FIG. 5 may be a blurred image obtained by blurring the first binarized image shown in FIG. 4 . As shown in FIGS. 4 and 5 , after the blurring process is performed on the first binarized image, the mask area (Mask area) of the object in the first binarized image becomes larger.
在一些实施例中,可以采用高斯滤波对第一二值化图像进行模糊化处理。需要说明的是,在本公开中,模糊化处理的方法不限于高斯滤波,还可以为其它合适的方法,例如,中值滤波、均值滤波等。In some embodiments, Gaussian filtering may be used to blur the first binarized image. It should be noted that, in the present disclosure, the method of fuzzification processing is not limited to Gaussian filtering, and may also be other suitable methods, such as median filtering, mean filtering, and the like.
图6中的白色像素表示模糊图像和第一二值化图像之间的不同像素,也就是说,对于图6中的任一白色像素,在模糊图像中该白色像素对应的位置处的像素的灰阶值与在第一二值化图像中该白色像素对应的位置处的像素的灰阶值不相同。图6中的黑色像素表示模糊图像和第一二值化图像之间的相同像素,也就是说,对于图6中的任一黑色像素,在模糊图像中该黑色像素对应的位置处的像素的灰阶值与在第一二值化图像中该黑色像素对应的位置处的像素的灰阶值相同。The white pixels in Fig. 6 represent different pixels between the blurred image and the first binarized image, that is, for any white pixel in Fig. 6, the pixel at the position corresponding to the white pixel in the blurred image The grayscale value is different from the grayscale value of the pixel at the position corresponding to the white pixel in the first binarized image. The black pixels in Fig. 6 represent the same pixels between the blurred image and the first binarized image, that is, for any black pixel in Fig. 6, the pixel at the position corresponding to the black pixel in the blurred image The grayscale value is the same as the grayscale value of the pixel at the position corresponding to the black pixel in the first binarized image.
图7为本公开一实施例提供的一种第二二值化图像的示意图。FIG. 7 is a schematic diagram of a second binarized image according to an embodiment of the present disclosure.
接下来,如图1所示,在步骤S13,通过第二二值化模型对原始图像进行处理,以得到第二二值化图像。Next, as shown in FIG. 1 , in step S13 , the original image is processed through a second binarization model to obtain a second binarized image.
图7所示的第二二值化图像为通过第二二值化模型对图2所示的原始图像进行处理后得到的图像。The second binarized image shown in FIG. 7 is an image obtained by processing the original image shown in FIG. 2 through the second binarization model.
在步骤S13中,第二二值化模型进行的处理(例如,lessink处理)是根据原始图像进行处理的,例如,第二二值化模型进行的处理可以用来去除原 始图像中的部分灰度像素,同时增强对象(例如,字符)的细节信息,即可以保留更多细节像素特征。第二二值化模型进行的处理可还以去除原始图像中的图像噪声干扰,使得对象的细节更加突出。In step S13, the processing performed by the second binarization model (for example, lessink processing) is performed according to the original image. For example, the processing performed by the second binarization model can be used to remove part of the grayscale in the original image. pixels, while enhancing the detail information of objects (eg, characters), that is, more detailed pixel features can be preserved. The processing performed by the second binarization model can also remove image noise interference in the original image, making the details of the object more prominent.
对图3所示的输入图像进行二值化预测处理得到的二值化预测图像在细节部分表现不好,具有锯齿,因此,需要对图像的细节像素进行补充,从而使最终得到的合成图像具有较好的效果。The binarized prediction image obtained by performing the binarization prediction process on the input image shown in Figure 3 does not perform well in the detail part and has jaggedness. Therefore, it is necessary to supplement the detail pixels of the image, so that the final composite image has better effect.
在一些实施例中,步骤S13可以包括:对原始图像进行灰度化处理,得到灰度图像;根据第一阈值,对灰度图像进行处理,得到中间二值化图像;以中间二值化图像为导向图,对灰度图像进行导向滤波处理,得到滤波图像;根据第二阈值,确定滤波图像中的高值像素点,其中,高值像素点的灰度值大于第二阈值;根据预设扩充系数,对高值像素点的灰度值进行扩充处理,得到扩充图像;对扩充图像进行清晰化处理,得到清晰图像;以及对清晰图像的对比度进行调整,得到第二二值化图像。In some embodiments, step S13 may include: performing grayscale processing on the original image to obtain a grayscale image; processing the grayscale image according to the first threshold to obtain an intermediate binarized image; As a guide map, conduct guide filtering processing on the grayscale image to obtain a filtered image; determine high-value pixels in the filtered image according to a second threshold, wherein the grayscale value of the high-value pixels is greater than the second threshold; according to a preset The expansion coefficient is used to expand the gray value of the high-value pixels to obtain an expanded image; to clear the expanded image to obtain a clear image; and to adjust the contrast of the clear image to obtain a second binarized image.
例如,灰度化处理的方法包括分量法、最大值法、平均值法和加权平均法等。For example, grayscale processing methods include component method, maximum value method, average value method, weighted average method, and the like.
例如,可以采用阈值法对灰度图像进行二值化处理以得到中间二值化图像。例如,常用的二值化阈值选取方法有双峰法、P参数法、大律法(OTSU法)、最大熵值法、迭代法等,第一阈值的选取方法可采用上述方法中的任一种。第一阈值可以根据实际情况设置,在此不作具体限制。For example, a threshold method can be used to binarize a grayscale image to obtain an intermediate binarized image. For example, the commonly used binarization threshold selection methods include the bimodal method, the P parameter method, the big law (OTSU method), the maximum entropy method, the iterative method, etc. The selection method of the first threshold can be any of the above methods. kind. The first threshold can be set according to the actual situation, which is not specifically limited here.
在步骤S13中,在导向滤波处理中,以中间二值化图像为导向图,灰度图像为导向滤波处理中的输入图像,滤波图像为导向滤波处理中的输出图像,由此,通过中间二值化图像对灰度图像进行导向滤波处理,可以输出与灰度图像大体上相似且边缘纹理处与中间二值化图像相似的滤波图像,经过导向滤波处理后,图像中的噪声明显减少。In step S13, in the guided filtering process, the intermediate binarized image is used as the guided image, the grayscale image is used as the input image in the guided filtering process, and the filtered image is the output image in the guided filtering process. The valued image performs guided filtering on the grayscale image, which can output a filtered image that is roughly similar to the grayscale image and similar to the intermediate binarized image at the edge texture. After the guided filtering process, the noise in the image is significantly reduced.
第二阈值为滤波图像的灰度均值与灰度值的标准差之和,即第二阈值等于滤波图像中的各个像素点的灰度值的平均值加上滤波图像中的各个像素点的灰度值的标准差。The second threshold is the sum of the average gray value of the filtered image and the standard deviation of the gray value, that is, the second threshold is equal to the average value of the gray value of each pixel in the filtered image plus the gray value of each pixel in the filtered image. The standard deviation of the degree value.
在一些实施例中,预设扩充系数为1.2-1.5,例如,1.3。将每个高值像素点的灰度值都乘以预设扩充系数,以对高值像素点的灰度值进行扩充处理, 从而得到黑白对比更加明显的扩充图像。In some embodiments, the preset expansion factor is 1.2-1.5, eg, 1.3. The gray value of each high-value pixel is multiplied by a preset expansion coefficient to perform expansion processing on the gray value of the high-value pixel, thereby obtaining an expanded image with more obvious black and white contrast.
在步骤S13中,在一些实施例中,对扩充图像进行清晰化处理,得到清晰图像,包括:采用高斯滤波对扩充图像进行模糊化处理,得到扩充图像对应的模糊图像;根据预设混合系数,将扩充图像对应的模糊图像和扩充图像按比例进行混合,得到清晰图像。通过对扩充图像进行清晰化处理,可以得到相对于扩充图像更加清晰的清晰图像。In step S13, in some embodiments, performing a sharpening process on the expanded image to obtain a clear image includes: using Gaussian filtering to perform blurring processing on the expanded image to obtain a blurred image corresponding to the expanded image; according to a preset mixing coefficient, The blurred image corresponding to the expanded image and the expanded image are mixed proportionally to obtain a clear image. By sharpening the expanded image, a clearer image that is clearer than the expanded image can be obtained.
假设f
1(i,j)为扩充图像在(i,j)处的像素点的灰度值,f
2(i,j)为扩充图像对应的模糊图像在(i,j)处的像素点的灰度值,f
3(i,j)为清晰图像在(i,j)处的像素点的灰度值,k
1为扩充图像的预设混合系数,k
2为扩充图像对应的模糊图像的预设扩充系数,则f
1(i,j)、f
2(i,j)、f
3(i,j)满足如下关系:
Suppose f 1 (i, j) is the gray value of the pixel point at (i, j) of the extended image, and f 2 (i, j) is the pixel point of the blurred image corresponding to the extended image at (i, j) , f 3 (i, j) is the gray value of the pixel point at (i, j) of the clear image, k 1 is the preset mixing coefficient of the extended image, and k 2 is the blurred image corresponding to the extended image , then f 1 (i,j), f 2 (i, j), and f 3 (i, j) satisfy the following relations:
f
3(i,j)=k
1f
1(i,j)+k
2f
2(i,j)。
f 3 (i,j)=k 1 f 1 (i,j)+k 2 f 2 (i,j).
例如,扩充图像的预设混合系数可以为1.5,扩充图像对应的模糊图像的预设混合系数可以为-0.5。For example, the preset mixing coefficient of the extended image may be 1.5, and the preset mixing coefficient of the blurred image corresponding to the extended image may be -0.5.
在步骤S13中,对清晰图像的对比度进行调整包括:根据清晰图像的灰度均值,对清晰图像的每个像素点的灰度值进行调整。由此,通过对清晰图像的对比度进行调整,从而可以得到黑白对比更为明显的第二二值化图像。In step S13, adjusting the contrast of the clear image includes: adjusting the gray value of each pixel of the clear image according to the gray mean value of the clear image. Therefore, by adjusting the contrast of the clear image, a second binarized image with more obvious black and white contrast can be obtained.
例如,可以通过如下公式对清晰图像的每个像素点的灰度值进行调整:For example, the gray value of each pixel of a clear image can be adjusted by the following formula:
其中,f'(i,j)为第二二值化图像在(i,j)处的像素点的灰度值,
为清晰图像中的各个像素点的灰度值的平均值,f(i,j)为清晰图像在(i,j)处的像素点的灰度值,t为强度值。例如,强度值可为0.1~0.5,例如,强度值可为0.2。在实际应用中,强度值可根据最终所要达到的省墨效果进行选取。
Among them, f'(i,j) is the gray value of the pixel point at (i,j) of the second binarized image, is the average value of the gray value of each pixel point in the clear image, f(i, j) is the gray value of the pixel point at (i, j) of the clear image, and t is the intensity value. For example, the intensity value may be from 0.1 to 0.5, for example, the intensity value may be 0.2. In practical applications, the intensity value can be selected according to the final ink saving effect to be achieved.
图8为本公开一实施例提供的一种合成图像的示意图。FIG. 8 is a schematic diagram of a composite image provided by an embodiment of the present disclosure.
最后,如图1所示,在步骤S14,根据多个外接轮廓像素在像素外接轮廓图像中的位置,对第二二值化图像和第一二值化图像进行合成,以得到合成图像。Finally, as shown in FIG. 1 , in step S14 , the second binarized image and the first binarized image are synthesized according to the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image to obtain a synthesized image.
需要说明的是,“对第二二值化图像和第一二值化图像进行合成,以得到合成图像”表示将第一二值化图像中的与多个外接轮廓像素的位置对应的像素的灰阶值替换为第二二值化图像中的与多个外接轮廓像素的位置对应的像 素的灰阶值,即将第一二值化图像中的与多个外接轮廓像素的位置对应的像素全部替换成效果更好的像素。It should be noted that "combining the second binarized image and the first binarized image to obtain a composite image" means combining the pixels corresponding to the positions of the plurality of circumscribed contour pixels in the first binarized image. The gray-scale value is replaced with the gray-scale value of the pixels corresponding to the positions of the multiple circumscribed contour pixels in the second binarized image, that is, all the pixels corresponding to the positions of the multiple circumscribed contour pixels in the first binarized image Replace with better-performing pixels.
图8为对图4所示的第一二值化图像和图7所示的第二二值化图像进行合成得到的图像。例如,如图8所示,合成图像为二值化图像。FIG. 8 is an image obtained by synthesizing the first binarized image shown in FIG. 4 and the second binarized image shown in FIG. 7 . For example, as shown in FIG. 8 , the composite image is a binarized image.
在一些实施例中,步骤S14包括:获取像素外接轮廓图像中的多个外接轮廓像素的位置;提取第二二值化图像中与多个外接轮廓像素的位置对应的位置处的多个目标第二二值化像素;根据第二二值化图像和第一二值化图像的像素对应关系,将第二二值化图像中的多个目标第二二值化像素分别合成到第一二值化图像中的相同位置,以得到原始图像的合成图像。In some embodiments, step S14 includes: obtaining the positions of a plurality of circumscribed contour pixels in the pixel circumscribed contour image; Two binarized pixels; according to the pixel correspondence between the second binarized image and the first binarized image, multiple target second binarized pixels in the second binarized image are synthesized into the first binarized image respectively. The same location in the image to get a composite image of the original image.
在一些实施例中,第二二值化图像的尺寸、第一二值化图像的尺寸和合成图像的尺寸均可以相同。In some embodiments, the size of the second binarized image, the size of the first binarized image, and the size of the composite image may all be the same.
第二二值化图像中的所有第二二值化像素排列为n行m列,第一二值化图像中的所有第一二值化像素排列为n行m列,合成图像中的所有合成像素排列为n行m列,像素外接轮廓图像中的所有像素排列为n行m列。也就是说,第二二值化图像中的所有第二二值化像素的数量为n*m,第一二值化图像中的所有第一二值化像素的数量为n*m,合成图像中的所有合成像素的数量为n*m,像素外接轮廓图像中的所有像素的数量为n*m。All the second binarized pixels in the second binarized image are arranged in n rows and m columns, all the first binarized pixels in the first binarized image are arranged in n rows and m columns, and all the composite images in the composite image are arranged in n rows and m columns. The pixels are arranged in n rows and m columns, and all the pixels in the pixel circumscribed contour image are arranged in n rows and m columns. That is, the number of all the second binarized pixels in the second binarized image is n*m, the number of all the first binarized pixels in the first binarized image is n*m, and the composite image The number of all synthesized pixels in is n*m, and the number of all pixels in the pixel circumscribed contour image is n*m.
多个目标第二二值化像素和多个外接轮廓像素一一对应,且目标第二二值化像素的位置和该目标第二二值化像素对应的外接轮廓像素的位置相同。例如,若在像素外接轮廓图像中,位于第i行第j列的像素为外接轮廓像素,相应地,在第二二值化图像中,位于第i行第j列的第二二值化像素为目标第二二值化像素。The multiple target second binarized pixels are in one-to-one correspondence with the multiple circumscribed contour pixels, and the positions of the target second binarized pixels are the same as the positions of the circumscribed contour pixels corresponding to the target second binarized pixels. For example, if in the pixel circumscribed contour image, the pixel located in the i-th row and the j-th column is the circumscribed contour pixel, correspondingly, in the second binarized image, the second binarized pixel located in the i-th row and the j-th column The second binarized pixel for the target.
在步骤S14中,根据第二二值化图像和第一二值化图像的像素对应关系,将第二二值化图像中的多个目标第二二值化像素分别合成到第一二值化图像中的相同位置,包括:确定多个目标第二二值化像素中的第q个目标第二二值化像素,其中,第q个目标第二二值化像素位于第二二值化图像的第i行第j列;确定第一二值化图像中的位于第i行第j列的第q个目标第一二值化像素;将第q个目标第一二值化像素的灰阶值替换为第q个目标第二二值化像素的灰阶值,以得到合成图像中位于第i行第j列的第q个目标合成像素。In step S14, according to the pixel correspondence between the second binarized image and the first binarized image, multiple target second binarized pixels in the second binarized image are synthesized into the first binarized image respectively. The same position in the image includes: determining the qth target second binarization pixel in the plurality of target second binarization pixels, wherein the qth target second binarization pixel is located in the second binarized image The i-th row and the j-th column of ; determine the q-th target first binarized pixel located in the i-th row and the j-th column in the first binarized image; The value is replaced with the grayscale value of the qth target second binarized pixel to obtain the qth target composite pixel located at the ith row and the jth column in the composite image.
n、m、q、i、j均为正整数,且i小于等于n,j小于等于m,q小于等于多个目标第二二值化像素的数量。n, m, q, i, and j are all positive integers, and i is less than or equal to n, j is less than or equal to m, and q is less than or equal to the number of multiple target second binarized pixels.
“将第q个目标第一二值化像素的灰阶值替换为第q个目标第二二值化像素的灰阶值,以得到第q个目标合成像素”可以使得对象(例如,字符)周边光滑。也就是说,第q个目标合成像素的灰阶值和第q个目标第二二值化像素的灰阶值相同。"Replace the grayscale value of the qth target first binarized pixel with the grayscale value of the qth target second binarized pixel to obtain the qth target composite pixel" can make objects (eg, characters) The perimeter is smooth. That is to say, the grayscale value of the qth target synthesized pixel is the same as the grayscale value of the qth target second binarized pixel.
在第一二值化图像中,未与多个目标第二二值化像素对应的第一二值化像素则直接作为合成图像中的合成像素,也就是说,若第一二值化图像中的位于第p1行第p2列的第一二值化像素与多个目标第二二值化像素中的任一个目标第二二值化像素均不对应,即第二二值化图像中的位于第p1行第p2列的第二二值化像素不是目标第二二值化像素,则该第一二值化图像中的位于第p1行第p2列的第一二值化像素作为合成图像中的位于第p1行第p2列的合成像素,即位于第p1行第p2列的第一二值化像素的灰阶值和位于第p1行第p2列的合成像素的灰阶值相同。In the first binarized image, the first binarized pixels that do not correspond to the plurality of target second binarized pixels are directly used as the synthesized pixels in the synthesized image. The first binarized pixel located in the p1th row and the p2th column does not correspond to any of the multiple target second binarization pixels, that is, the second binarized image in the second binarized image is located in The second binarized pixel at row p1 and column p2 is not the target second binarized pixel, then the first binarized pixel located at row p1 and column p2 in the first binarized image is used as the composite image. The grayscale value of the synthesized pixel located at row p1 and column p2, that is, the grayscale value of the first binarized pixel located at row p1 and column p2 is the same as the grayscale value of the synthesized pixel located at row p1 and column p2.
需要说明的是,在本公开中,第二二值化图像中的像素被称为第二二值化像素,第一二值化图像中的像素被称为第一二值化像素,合成图像中的像素被称为合成像素了,“第二二值化像素”、“第一二值化像素”、“合成像素”等仅仅是用于区分像素位于不同的图像,并不表示这些像素的结构、性质等有任何不同。此外,目标第二二值化像素表示第二二值化图像中的与外接轮廓像素对应的像素,目标第一二值化像素表示第一二值化图像中的与目标第二二值化像素对应的像素,目标合成像素表示合成图像中的与目标第二二值化像素对应的像素。It should be noted that, in the present disclosure, the pixels in the second binarized image are referred to as second binarized pixels, the pixels in the first binarized image are referred to as first binarized pixels, and the composite image The pixels in the image are called composite pixels. "Second binarized pixels", "first binarized pixels", "synthetic pixels", etc. are only used to distinguish pixels located in different images, and do not mean that these pixels are in different images. structure, properties, etc. In addition, the target second binarized pixel represents a pixel corresponding to the circumscribed contour pixel in the second binarized image, and the target first binarized pixel represents a pixel corresponding to the target second binarized pixel in the first binarized image. The corresponding pixel, the target composite pixel represents a pixel in the composite image corresponding to the target second binarized pixel.
与上述的图像处理方法相对应,本公开至少一实施例还提供一种图像处理装置,图9为本公开至少一实施例提供的一种图像处理装置的示意性框图。Corresponding to the above image processing method, at least one embodiment of the present disclosure further provides an image processing apparatus, and FIG. 9 is a schematic block diagram of an image processing apparatus provided by at least one embodiment of the present disclosure.
如图9所示,图像处理装置900包括:获取模块901、第一二值化模块902、处理模块903、第二二值化模块904和合成模块905。As shown in FIG. 9 , the image processing apparatus 900 includes: an acquisition module 901 , a first binarization module 902 , a processing module 903 , a second binarization module 904 and a synthesis module 905 .
获取模块901用于获取原始图像。原始图像包括至少一个对象。The acquisition module 901 is used to acquire the original image. The original image includes at least one object.
第一二值化模块902用于通过第一二值化模型对原始图像进行处理,以得到原始图像的第一二值化图像。The first binarization module 902 is configured to process the original image through the first binarization model to obtain a first binarized image of the original image.
处理模块903用于对第一二值化图像进行处理,以得到像素外接轮廓图像。例如,像素外接轮廓图像包括多个外接轮廓像素,多个外接轮廓像素包围的区域内的像素为至少一个对象中的至少部分对象对应的像素。The processing module 903 is configured to process the first binarized image to obtain a pixel circumscribed contour image. For example, the pixel circumscribed contour image includes a plurality of circumscribed contour pixels, and the pixels in the area surrounded by the plurality of circumscribed contour pixels are pixels corresponding to at least some objects in the at least one object.
第二二值化模块904用于通过第二二值化模型对原始图像进行处理,以得到第二二值化图像。The second binarization module 904 is configured to process the original image through the second binarization model to obtain a second binarized image.
合成模块905用于根据像素外接轮廓图像中的多个外接轮廓像素的位置,对第二二值化图像和第一二值化图像进行合成,以得到原始图像的合成图像。例如,合成图像为二值化图像。The synthesizing module 905 is configured to synthesize the second binarized image and the first binarized image according to the positions of a plurality of circumscribed contour pixels in the pixel circumscribed contour image to obtain a synthesized image of the original image. For example, the composite image is a binarized image.
在一些实施例中,第一二值化模块902执行通过第一二值化模型对原始图像进行处理,以得到原始图像的第一二值化图像的操作时,第一二值化模块902执行以下操作:对原始图像进行压缩处理,以得到输入图像,其中,输入图像的尺寸小于原始图像的尺寸;通过第一二值化模型对输入图像进行处理,以得到原始图像的第一二值化图像。In some embodiments, when the first binarization module 902 performs the operation of processing the original image through the first binarization model to obtain the first binarized image of the original image, the first binarization module 902 performs The following operations: compress the original image to obtain the input image, wherein the size of the input image is smaller than the size of the original image; process the input image through the first binarization model to obtain the first binarization of the original image image.
在一些实施例中,第一二值化模块902执行通过第一二值化模型对输入图像进行处理,以得到原始图像的第一二值化图像的操作时,第一二值化模块902执行以下操作:通过第一二值化模型对输入图像进行处理,以得到输入图像的二值化预测图像;将二值化预测图像进行恢复尺寸处理,以得到第一二值化图像。例如,第一二值化图像的尺寸和原始图像的尺寸相同。In some embodiments, when the first binarization module 902 performs the operation of processing the input image through the first binarization model to obtain the first binarized image of the original image, the first binarization module 902 performs The following operations are as follows: processing the input image through the first binarization model to obtain a binarized predicted image of the input image; and restoring the size of the binarized predicted image to obtain the first binarized image. For example, the size of the first binarized image is the same as the size of the original image.
在一些实施例中,处理模块903执行对第一二值化图像进行处理,以得到像素外接轮廓图像的操作时,处理模块903执行以下操作:对第一二值化图像进行模糊化处理,得到模糊图像;对模糊图像和第一二值化图像进行异或处理,以得到像素外接轮廓图像。In some embodiments, when the processing module 903 performs an operation of processing the first binarized image to obtain a pixel circumscribed contour image, the processing module 903 performs the following operations: performing blurring processing on the first binarized image to obtain Blurred image; XOR processing is performed on the blurred image and the first binarized image to obtain a pixel circumscribed contour image.
在一些实施例中,合成模块905执行根据像素外接轮廓图像中的多个外接轮廓像素的位置,对第二二值化图像和第一二值化图像进行合成,以得到原始图像的合成图像的操作时,合成模块905执行以下操作:获取像素外接轮廓图像中的多个外接轮廓像素的位置;提取第二二值化图像中与多个外接轮廓像素的位置对应的位置处的多个目标第二二值化像素;根据第二二值化图像和第一二值化图像的像素对应关系,将第二二值化图像中的多个目标第二二值化像素分别合成到第一二值化图像中的相同位置,以得到原始图像的 合成图像。In some embodiments, the synthesis module 905 performs synthesis of the second binarized image and the first binarized image according to the positions of a plurality of circumscribed contour pixels in the pixel circumscribed contour image to obtain a composite image of the original image. During operation, the synthesizing module 905 performs the following operations: obtaining the positions of multiple circumscribed contour pixels in the pixel circumscribed contour image; Two binarized pixels; according to the pixel correspondence between the second binarized image and the first binarized image, multiple target second binarized pixels in the second binarized image are synthesized into the first binarized image respectively. The same location in the image to get a composite image of the original image.
第二二值化图像中的所有第二二值化像素排列为n行m列,第一二值化图像中的所有第一二值化像素排列为n行m列,合成图像中的所有合成像素排列为n行m列。在一些实施例中,合成模块905执行根据第二二值化图像和第一二值化图像的像素对应关系,将第二二值化图像中的多个目标第二二值化像素分别合成到第一二值化图像中的相同位置的操作时,合成模块905包括执行以下操作:确定多个目标第二二值化像素中的第q个目标第二二值化像素,其中,第q个目标第二二值化像素位于第二二值化图像的第i行第j列;确定第一二值化图像中的位于第i行第j列的第q个目标第一二值化像素;将第q个目标第一二值化像素的灰阶值替换为第q个目标第二二值化像素的灰阶值,以得到合成图像中位于第i行第j列的第q个目标合成像素。All the second binarized pixels in the second binarized image are arranged in n rows and m columns, all the first binarized pixels in the first binarized image are arranged in n rows and m columns, and all the composite images in the composite image are arranged in n rows and m columns. The pixels are arranged in n rows and m columns. In some embodiments, the synthesizing module 905 performs, according to the pixel correspondence between the second binarized image and the first binarized image, respectively synthesizing a plurality of target second binarized pixels in the second binarized image into During the operation at the same position in the first binarized image, the synthesizing module 905 includes performing the following operations: determining the qth target second binarization pixel among the plurality of target second binarization pixels, wherein the qth target second binarization pixel is The target second binarization pixel is located in the ith row and the jth column of the second binarized image; determine the qth target first binarization pixel located in the ith row and the jth column in the first binarized image; Replace the grayscale value of the first binarized pixel of the qth target with the grayscale value of the second binarized pixel of the qth target to obtain the composite image of the qth target located at the ith row and the jth column of the composite image. pixel.
第q个目标合成像素的灰阶值为第q个目标第二二值化像素的灰阶值,n、m、q、i、j均为正整数,且i小于等于n,j小于等于m,q小于等于多个目标第二二值化像素的数量。The grayscale value of the qth target synthetic pixel is the grayscale value of the qth target second binarized pixel, n, m, q, i, and j are all positive integers, and i is less than or equal to n, and j is less than or equal to m , q is less than or equal to the number of multiple target second binarized pixels.
在一些实施例中,第二二值化模块904包括:灰度化模块、中间二值化模块、滤波模块、确定模块、扩充模块和清晰化模块。In some embodiments, the second binarization module 904 includes a grayscale module, an intermediate binarization module, a filter module, a determination module, an expansion module, and a sharpening module.
灰度化模块用于对原始图像进行灰度化处理,得到灰度图像。The grayscale module is used to perform grayscale processing on the original image to obtain a grayscale image.
中间二值化模块用于根据第一阈值,对灰度图像进行处理,得到中间二值化图像。The intermediate binarization module is used to process the grayscale image according to the first threshold to obtain an intermediate binarized image.
滤波模块用于以中间二值化图像为导向图,对灰度图像进行导向滤波处理,得到滤波图像。The filtering module is used for taking the intermediate binarized image as a guide image, and performing guide filtering processing on the grayscale image to obtain a filtered image.
确定模块用于根据第二阈值,确定滤波图像中的高值像素点,其中,高值像素点的灰度值大于第二阈值。The determining module is configured to determine high-value pixels in the filtered image according to the second threshold, wherein the gray value of the high-value pixels is greater than the second threshold.
扩充模块用于根据预设扩充系数,对高值像素点的灰度值进行扩充处理,得到扩充图像。The expansion module is used for expanding the gray value of the high-value pixel points according to the preset expansion coefficient to obtain an expanded image.
清晰化模块用于对扩充图像进行清晰化处理,得到清晰图像,对清晰图像的对比度进行调整,得到第二二值化图像。The sharpening module is used for sharpening the expanded image to obtain a clear image, and adjusting the contrast of the clear image to obtain a second binarized image.
例如,获取模块901、第一二值化模块902、处理模块903、第二二值化模块904和/或合成模块905包括存储在存储器中的代码和程序;处理器可以 执行该代码和程序以实现如上所述的获取模块901、第一二值化模块902、处理模块903、第二二值化模块904和/或合成模块905的一些功能或全部功能。例如,获取模块901、第一二值化模块902、处理模块903、第二二值化模块904和/或合成模块905可以是专用硬件器件,用来实现如上所述的获取模块901、第一二值化模块902、处理模块903、第二二值化模块904和/或合成模块905的一些或全部功能。例如,获取模块901、第一二值化模块902、处理模块903、第二二值化模块904和/或合成模块905可以是一个电路板或多个电路板的组合,用于实现如上所述的功能。在本申请实施例中,该一个电路板或多个电路板的组合可以包括:(1)一个或多个处理器;(2)与处理器相连接的一个或多个非暂时的存储器;以及(3)处理器可执行的存储在存储器中的固件。For example, acquisition module 901, first binarization module 902, processing module 903, second binarization module 904, and/or synthesis module 905 include code and programs stored in memory; the code and programs can be executed by the processor to Some or all of the functions of the acquisition module 901 , the first binarization module 902 , the processing module 903 , the second binarization module 904 and/or the synthesis module 905 as described above are implemented. For example, the acquisition module 901 , the first binarization module 902 , the processing module 903 , the second binarization module 904 and/or the synthesis module 905 may be dedicated hardware devices for implementing the acquisition module 901 , the first Some or all of the functions of the binarization module 902 , the processing module 903 , the second binarization module 904 and/or the synthesis module 905 . For example, the acquisition module 901, the first binarization module 902, the processing module 903, the second binarization module 904 and/or the synthesis module 905 may be one circuit board or a combination of multiple circuit boards for implementing the above-mentioned function. In this embodiment of the present application, the one circuit board or the combination of multiple circuit boards may include: (1) one or more processors; (2) one or more non-transitory memories connected to the processors; and (3) The firmware stored in the memory executable by the processor.
需要说明的是,获取模块901用于实现图1所示的步骤S10,第一二值化模块902用于实现图1所示的步骤S11,处理模块903用于实现图1所示的步骤S12,第二二值化模块904用于实现图1所示的步骤S13,合成模块905用于实现图1所示的步骤S14。从而关于获取模块901的具体说明可以参考上述图像处理方法的实施例中图1所示的步骤S10的相关描述,关于第一二值化模块902的具体说明可以参考上述图像处理方法的实施例中图1所示的步骤S11的相关描述,关于处理模块903的具体说明可以参考上述图像处理方法的实施例中图1所示的步骤S12的相关描述,关于第二二值化模块904的具体说明可以参考上述图像处理方法的实施例中图1所示的步骤S13的相关描述,关于合成模块905的具体说明可以参考上述图像处理方法的实施例中图1所示的步骤S14的相关描述。此外,图像处理装置可以实现与前述图像处理方法相似的技术效果,在此不再赘述。It should be noted that the acquisition module 901 is used to implement step S10 shown in FIG. 1 , the first binarization module 902 is used to implement step S11 shown in FIG. 1 , and the processing module 903 is used to implement step S12 shown in FIG. 1 . , the second binarization module 904 is used to implement step S13 shown in FIG. 1 , and the synthesis module 905 is used to implement step S14 shown in FIG. 1 . Therefore, for the specific description of the acquisition module 901, reference may be made to the relevant description of step S10 shown in FIG. 1 in the above-mentioned embodiment of the image processing method, and for the specific description of the first binarization module 902, reference may be made to the above-mentioned embodiment of the image processing method. For the relevant description of step S11 shown in FIG. 1 , for the specific description of the processing module 903 , please refer to the relevant description of step S12 shown in FIG. 1 in the embodiment of the above image processing method, and for the specific description of the second binarization module 904 Reference may be made to the relevant description of step S13 shown in FIG. 1 in the embodiment of the above image processing method, and the specific description of the synthesis module 905 may refer to the relevant description of step S14 shown in FIG. 1 in the embodiment of the above image processing method. In addition, the image processing apparatus can achieve technical effects similar to those of the aforementioned image processing method, which will not be repeated here.
本公开至少一实施例还提供一种电子设备,图10为本公开至少一实施例提供的一种电子设备的示意性框图。At least one embodiment of the present disclosure further provides an electronic device, and FIG. 10 is a schematic block diagram of an electronic device provided by at least one embodiment of the present disclosure.
如图10所示,电子设备包括处理器1001、通信接口1002、存储器1003和通信总线1004。处理器1001、通信接口1002、存储器1003通过通信总线1004实现相互通信,处理器1001、通信接口1002、存储器1003等组件之间也可以通过网络连接进行通信。本公开对网络的类型和功能在此不作限制。As shown in FIG. 10 , the electronic device includes a processor 1001 , a communication interface 1002 , a memory 1003 and a communication bus 1004 . The processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004, and the components such as the processor 1001, the communication interface 1002, and the memory 1003 can also communicate through a network connection. The present disclosure does not limit the type and function of the network.
存储器1003用于非瞬时性地存储计算机可读指令。处理器1001用于运行计算机可读指令时,计算机可读指令被处理器1001运行时实现根据上述任一实施例所述的图像处理方法。关于该图像处理方法的各个步骤的具体实现以及相关解释内容可以参见上述图像处理方法的实施例,在此不作赘述。 Memory 1003 is used for non-transitory storage of computer readable instructions. When the processor 1001 is configured to execute computer-readable instructions, the computer-readable instructions are executed by the processor 1001 to implement the image processing method according to any of the above embodiments. For the specific implementation of each step of the image processing method and related explanation contents, reference may be made to the above-mentioned embodiments of the image processing method, which will not be repeated here.
处理器1001执行存储器1003上所存储的程序而实现图像处理方法的实现方式,与前述图像处理方法的实施例部分所提及的实现方式相同,这里也不再赘述。The implementation manner of the processor 1001 executing the program stored in the memory 1003 to realize the image processing method is the same as the implementation manner mentioned in the embodiment part of the foregoing image processing method, and will not be repeated here.
通信总线1004可以是外设部件互连标准(PCI)总线或扩展工业标准结构(EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus 1004 may be a Peripheral Component Interconnect Standard (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
通信接口1002用于实现电子设备与其他设备之间的通信。The communication interface 1002 is used to implement communication between the electronic device and other devices.
处理器1001和存储器1003可以设置在服务器端(或云端)。The processor 1001 and the memory 1003 may be provided on the server side (or cloud).
处理器1001可以控制电子设备中的其它组件以执行期望的功能。处理器1001可以是中央处理器(CPU)、网络处理器(NP)等;还可以是数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。中央处理元(CPU)可以为X86或ARM架构等。The processor 1001 may control other components in the electronic device to perform desired functions. The processor 1001 can be a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable Logic devices, discrete gate or transistor logic devices, discrete hardware components. The central processing unit (CPU) can be an X86 or an ARM architecture or the like.
存储器1003可以包括一个或多个计算机程序产品的任意组合,计算机程序产品可以包括各种形式的计算机可读存储介质,例如易失性存储器和/或非易失性存储器。易失性存储器例如可以包括随机存取存储器(RAM)和/或高速缓冲存储器(cache)等。非易失性存储器例如可以包括只读存储器(ROM)、硬盘、可擦除可编程只读存储器(EPROM)、便携式紧致盘只读存储器(CD-ROM)、USB存储器、闪存等。在所述计算机可读存储介质上可以存储一个或多个计算机可读指令,处理器1001可以运行所述计算机可读指令,以实现电子设备的各种功能。在存储介质中还可以存储各种应用程序和各种数据等。 Memory 1003 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and/or cache memory, among others. Non-volatile memory may include, for example, read only memory (ROM), hard disk, erasable programmable read only memory (EPROM), portable compact disk read only memory (CD-ROM), USB memory, flash memory, and the like. One or more computer-readable instructions may be stored on the computer-readable storage medium, and the processor 1001 may execute the computer-readable instructions to implement various functions of the electronic device. Various application programs, various data and the like can also be stored in the storage medium.
例如,关于电子设备执行图像处理的过程的详细说明可以参考图像处理方法的实施例中的相关描述,重复之处不再赘述。For example, for a detailed description of the process of image processing performed by the electronic device, reference may be made to the relevant descriptions in the embodiments of the image processing method, and repeated descriptions will not be repeated.
图11为本公开至少一实施例提供的一种非瞬时性计算机可读存储介质的示意图。例如,如图11所示,在存储介质1100上可以非暂时性地存储一个或多个计算机可读指令1101。例如,当计算机可读指令1101由处理器执行时可以执行根据上文所述的图像处理方法中的一个或多个步骤。FIG. 11 is a schematic diagram of a non-transitory computer-readable storage medium provided by at least one embodiment of the present disclosure. For example, as shown in FIG. 11 , one or more computer-readable instructions 1101 may be non-transitory stored on storage medium 1100 . For example, the computer readable instructions 1101 may perform one or more steps of the image processing method according to the above when executed by a processor.
该存储介质1100可以应用于上述电子设备和/或图像处理装置900中。例如,存储介质1100可以包括电子设备中的存储器1003。The storage medium 1100 can be applied to the above-mentioned electronic device and/or the image processing apparatus 900 . For example, the storage medium 1100 may include the memory 1003 in the electronic device.
关于存储介质1100的说明可以参考电子设备的实施例中对于存储器的描述,重复之处不再赘述。For the description of the storage medium 1100, reference may be made to the description of the memory in the embodiment of the electronic device, and repeated descriptions will not be repeated.
图12示出了为本公开至少一实施例提供的一种硬件环境的示意图。本公开提供的电子设备可以应用在互联网系统。FIG. 12 shows a schematic diagram of a hardware environment provided by at least one embodiment of the present disclosure. The electronic device provided by the present disclosure can be applied to the Internet system.
利用图12中提供的计算机系统可以实现本公开中涉及的图像处理装置和/或电子设备的功能。这类计算机系统可以包括个人电脑、笔记本电脑、平板电脑、手机、个人数码助理、智能眼镜、智能手表、智能指环、智能头盔及任何智能便携设备或可穿戴设备。本实施例中的特定系统利用功能框图解释了一个包含用户界面的硬件平台。这种计算机设备可以是一个通用目的的计算机设备,或一个有特定目的的计算机设备。两种计算机设备都可以被用于实现本实施例中的图像处理装置和/或电子设备。计算机系统可以包括实施当前描述的实现图像处理所需要的信息的任何组件。例如,计算机系统能够被计算机设备通过其硬件设备、软件程序、固件以及它们的组合所实现。为了方便起见,图12中只绘制了一台计算机设备,但是本实施例所描述的实现图像处理所需要的信息的相关计算机功能是可以以分布的方式、由一组相似的平台所实施的,分散计算机系统的处理负荷。The functions of the image processing apparatus and/or electronic device involved in the present disclosure can be realized by using the computer system provided in FIG. 12 . Such computer systems may include personal computers, notebook computers, tablet computers, cell phones, personal digital assistants, smart glasses, smart watches, smart rings, smart helmets, and any smart portable or wearable device. The specific system in this embodiment illustrates a hardware platform including a user interface using functional block diagrams. Such computer equipment may be a general purpose computer equipment or a special purpose computer equipment. Both computer devices can be used to implement the image processing apparatus and/or electronic device in this embodiment. The computer system may include any component that implements the information required to implement the image processing currently described. For example, a computer system can be implemented by a computer device through its hardware devices, software programs, firmware, and combinations thereof. For the sake of convenience, only one computer device is drawn in FIG. 12, but the related computer functions described in this embodiment to realize the information required for image processing can be implemented in a distributed manner by a group of similar platforms, Distribute the processing load of a computer system.
如图12所示,计算机系统可以包括通信端口250,与之相连的是实现数据通信的网络,例如,计算机系统可以通过通信端口250发送和接收信息及数据,即通信端口250可以实现计算机系统与其他电子设备进行无线或有线通信以交换数据。计算机系统还可以包括一个处理器组220(即上面描述的处理器),用于执行程序指令。处理器组220可以由至少一个处理器(例如,CPU)组成。计算机系统可以包括一个内部通信总线210。计算机系统可以包括不同形式的程序储存单元以及数据储存单元(即上面描述的存储器或存储介质), 例如硬盘270、只读存储器(ROM)230、随机存取存储器(RAM)240,能够用于存储计算机处理和/或通信使用的各种数据文件,以及处理器组220所执行的可能的程序指令。计算机系统还可以包括一个输入/输出组件260,输入/输出组件260用于实现计算机系统与其他组件(例如,用户界面280等)之间的输入/输出数据流。As shown in FIG. 12 , the computer system may include a communication port 250, which is connected to a network for realizing data communication. For example, the computer system may send and receive information and data through the communication port 250, that is, the communication port 250 may enable the computer system to communicate with Other electronic devices communicate wirelessly or by wire to exchange data. The computer system may also include a processor group 220 (ie, the processors described above) for executing program instructions. The processor group 220 may consist of at least one processor (eg, a CPU). The computer system may include an internal communication bus 210 . The computer system may include various forms of program storage units and data storage units (ie, the memories or storage media described above), such as hard disk 270, read only memory (ROM) 230, random access memory (RAM) 240, capable of storing Various data files used for computer processing and/or communication, and possibly program instructions executed by the processor group 220 . The computer system may also include an input/output component 260 for enabling input/output data flow between the computer system and other components (eg, user interface 280, etc.).
通常,以下装置可以连接输入/输出组件260:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置;包括例如磁带、硬盘等的存储装置;以及通信接口。Typically, the following devices may be connected to the input/output assembly 260: input devices including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speakers, vibrators, etc. output device; including storage devices such as tapes, hard disks, etc.; and a communication interface.
虽然图12示出了具有各种装置的计算机系统,但应理解的是,并不要求计算机系统具备所有示出的装置,可以替代地,计算机系统可以具备更多或更少的装置。Although Figure 12 shows a computer system with various devices, it should be understood that the computer system is not required to have all of the devices shown, and may instead have more or fewer devices.
对于本公开,还有以下几点需要说明:For the present disclosure, the following points need to be noted:
(1)本公开实施例附图只涉及到与本公开实施例涉及到的结构,其他结构可参考通常设计。(1) The accompanying drawings of the embodiments of the present disclosure only relate to the structures involved in the embodiments of the present disclosure, and other structures may refer to general designs.
(2)为了清晰起见,在用于描述本发明的实施例的附图中,层或结构的厚度和尺寸被放大。可以理解,当诸如层、膜、区域或基板之类的元件被称作位于另一元件“上”或“下”时,该元件可以“直接”位于另一元件“上”或“下”,或者可以存在中间元件。(2) In the drawings for describing the embodiments of the present invention, the thickness and size of layers or structures are exaggerated for clarity. It will be understood that when an element such as a layer, film, region or substrate is referred to as being "on" or "under" another element, it can be "directly on" or "under" the other element, Or intermediate elements may be present.
(3)在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合以得到新的实施例。(3) The embodiments of the present disclosure and the features in the embodiments may be combined with each other to obtain new embodiments without conflict.
以上所述仅为本公开的具体实施方式,但本公开的保护范围并不局限于此,本公开的保护范围应以所述权利要求的保护范围为准。The above descriptions are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto, and the protection scope of the present disclosure should be subject to the protection scope of the claims.
Claims (17)
- 一种图像处理方法,其特征在于,包括:An image processing method, comprising:获取原始图像,其中,所述原始图像包括至少一个对象;acquiring an original image, wherein the original image includes at least one object;通过第一二值化模型对所述原始图像进行处理,以得到所述原始图像的第一二值化图像;The original image is processed by a first binarization model to obtain a first binarized image of the original image;对所述第一二值化图像进行处理,以得到像素外接轮廓图像,其中,所述像素外接轮廓图像包括多个外接轮廓像素,所述多个外接轮廓像素包围的区域内的像素为所述至少一个对象中的至少部分对象对应的像素;The first binarized image is processed to obtain a pixel circumscribed contour image, wherein the pixel circumscribed contour image includes a plurality of circumscribed contour pixels, and the pixels in the area surrounded by the plurality of circumscribed contour pixels are the pixels corresponding to at least some of the at least one object;通过第二二值化模型对所述原始图像进行处理,以得到第二二值化图像;Process the original image through a second binarization model to obtain a second binarized image;根据所述多个外接轮廓像素在所述像素外接轮廓图像中的位置,对所述第二二值化图像和所述第一二值化图像进行合成,以得到合成图像,其中,所述合成图像为二值化图像。According to the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image, the second binarized image and the first binarized image are synthesized to obtain a synthesized image, wherein the synthesized image The image is a binarized image.
- 根据权利要求1所述的图像处理方法,其特征在于,通过所述第一二值化模型对所述原始图像进行处理,以得到所述原始图像的第一二值化图像,包括:The image processing method according to claim 1, wherein processing the original image by using the first binarization model to obtain a first binarized image of the original image, comprising:对所述原始图像进行压缩处理,以得到输入图像,其中,所述输入图像的尺寸小于所述原始图像的尺寸;compressing the original image to obtain an input image, wherein the size of the input image is smaller than the size of the original image;通过所述第一二值化模型对所述输入图像进行处理,以得到所述原始图像的第一二值化图像。The input image is processed through the first binarization model to obtain a first binarized image of the original image.
- 根据权利要求2所述的图像处理方法,其特征在于,通过所述第一二值化模型对所述输入图像进行处理,以得到所述原始图像的第一二值化图像,包括:The image processing method according to claim 2, wherein processing the input image by using the first binarization model to obtain a first binarized image of the original image, comprising:通过所述第一二值化模型对所述输入图像进行处理,以得到所述输入图像的二值化预测图像;Process the input image by using the first binarization model to obtain a binarized prediction image of the input image;将所述二值化预测图像进行恢复尺寸处理,以得到所述第一二值化图像,其中,所述第一二值化图像的尺寸和所述原始图像的尺寸相同。The size of the binarized predicted image is restored to obtain the first binarized image, wherein the size of the first binarized image is the same as the size of the original image.
- 根据权利要求1所述的图像处理方法,其特征在于,对所述第一二值化图像进行处理,以得到像素外接轮廓图像,包括:The image processing method according to claim 1, wherein processing the first binarized image to obtain a pixel circumscribed contour image, comprising:对所述第一二值化图像进行模糊化处理,得到模糊图像;performing a blurring process on the first binarized image to obtain a blurred image;对所述模糊图像和所述第一二值化图像进行异或处理,以得到所述像素外接轮廓图像。XOR processing is performed on the blurred image and the first binarized image to obtain the pixel circumscribed contour image.
- 根据权利要求1所述的图像处理方法,其特征在于,根据所述像素外接轮廓图像中的所述多个外接轮廓像素的位置,对所述第二二值化图像和所述第一二值化图像进行合成,以得到所述合成图像,包括:The image processing method according to claim 1, wherein the second binarized image and the first binary image are processed according to the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image. The synthesized image is synthesized to obtain the synthesized image, including:获取所述像素外接轮廓图像中的所述多个外接轮廓像素的位置;obtaining the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image;提取所述第二二值化图像中与所述多个外接轮廓像素的位置对应的位置处的多个目标第二二值化像素;extracting a plurality of target second binarization pixels at positions corresponding to the positions of the plurality of circumscribed contour pixels in the second binarized image;根据所述第二二值化图像和所述第一二值化图像的像素对应关系,将所述第二二值化图像中的所述多个目标第二二值化像素分别合成到所述第一二值化图像中的相同位置,以得到所述合成图像。According to the pixel correspondence between the second binarized image and the first binarized image, the plurality of target second binarized pixels in the second binarized image are respectively synthesized into the The same position in the first binarized image to obtain the composite image.
- 根据权利要求5所述的图像处理方法,其特征在于,所述第二二值化图像中的所有第二二值化像素排列为n行m列,所述第一二值化图像中的所有第一二值化像素排列为n行m列,所述合成图像中的所有合成像素排列为n行m列,The image processing method according to claim 5, wherein all the second binarized pixels in the second binarized image are arranged in n rows and m columns, and all the second binarized pixels in the first binarized image are arranged in n rows and m columns. The first binarized pixels are arranged in n rows and m columns, and all the synthesized pixels in the synthesized image are arranged in n rows and m columns,根据所述第二二值化图像和所述第一二值化图像的像素对应关系,将所述第二二值化图像中的所述多个目标第二二值化像素分别合成到所述第一二值化图像中的相同位置,包括:According to the pixel correspondence between the second binarized image and the first binarized image, the plurality of target second binarized pixels in the second binarized image are respectively synthesized into the The same locations in the first binarized image, including:确定所述多个目标第二二值化像素中的第q个目标第二二值化像素,其中,所述第q个目标第二二值化像素位于所述第二二值化图像的第i行第j列;Determine the qth target second binarization pixel in the plurality of target second binarization pixels, wherein the qth target second binarization pixel is located in the second binarization image of the second binarization image. row i, column j;确定所述第一二值化图像中的位于所述第i行第j列的第q个目标第一二值化像素;determining the q-th target first binarized pixel located in the i-th row and the j-th column in the first binarized image;将所述第q个目标第一二值化像素的灰阶值替换为所述第q个目标第二二值化像素的灰阶值,以得到所述合成图像中位于所述第i行第j列的第q个目标合成像素,Replace the grayscale value of the qth target first binarized pixel with the grayscale value of the qth target second binarized pixel, so as to obtain the ith row in the composite image. The qth target synthetic pixel of column j,其中,所述第q个目标合成像素的灰阶值为所述第q个目标第二二值化像素的灰阶值,n、m、q、i、j均为正整数,且i小于等于n,j小于等于m,q小于等于所述多个目标第二二值化像素的数量。Wherein, the grayscale value of the qth target composite pixel is the grayscale value of the qth target second binarized pixel, n, m, q, i, and j are all positive integers, and i is less than or equal to n, j is less than or equal to m, q is less than or equal to the number of the plurality of target second binarized pixels.
- 根据权利要求1~6任一项所述的图像处理方法,其特征在于,通过第二二值化模型对所述原始图像进行处理,以得到第二二值化图像,包括:The image processing method according to any one of claims 1 to 6, wherein processing the original image through a second binarization model to obtain a second binarized image, comprising:对所述原始图像进行灰度化处理,得到灰度图像;Grayscale processing is performed on the original image to obtain a grayscale image;根据第一阈值,对所述灰度图像进行处理,得到中间二值化图像;processing the grayscale image according to the first threshold to obtain an intermediate binarized image;以所述中间二值化图像为导向图,对所述灰度图像进行导向滤波处理,得到滤波图像;Taking the intermediate binarized image as a guide image, performing guide filtering processing on the grayscale image to obtain a filtered image;根据第二阈值,确定所述滤波图像中的高值像素点,其中,所述高值像素点的灰度值大于所述第二阈值;determining high-value pixels in the filtered image according to a second threshold, wherein the grayscale value of the high-value pixels is greater than the second threshold;根据预设扩充系数,对所述高值像素点的灰度值进行扩充处理,得到扩充图像;According to the preset expansion coefficient, the gray value of the high-value pixel is expanded to obtain an expanded image;对所述扩充图像进行清晰化处理,得到清晰图像;以及performing sharpening processing on the expanded image to obtain a sharp image; and对所述清晰图像的对比度进行调整,得到所述第二二值化图像。The contrast of the clear image is adjusted to obtain the second binarized image.
- 根据权利要求1~6任一项所述的图像处理方法,其特征在于,所述第一二值化模型为基于神经网络的模型。The image processing method according to any one of claims 1 to 6, wherein the first binarization model is a model based on a neural network.
- 一种图像处理装置,其特征在于,包括:An image processing device, comprising:一获取模块,用于获取原始图像,其中,所述原始图像包括至少一个对象;an acquisition module for acquiring an original image, wherein the original image includes at least one object;第一二值化模块,用于通过第一二值化模型对所述原始图像进行处理,以得到所述原始图像的第一二值化图像;a first binarization module, configured to process the original image through a first binarization model to obtain a first binarized image of the original image;一处理模块,用于对所述第一二值化图像进行处理,以得到像素外接轮廓图像,其中,所述像素外接轮廓图像包括多个外接轮廓像素,所述多个外接轮廓像素包围的区域内的像素为所述至少一个对象中的至少部分对象对应的像素;a processing module, configured to process the first binarized image to obtain a pixel circumscribed contour image, wherein the pixel circumscribed contour image includes a plurality of circumscribed contour pixels, and an area surrounded by the plurality of circumscribed contour pixels The pixels within are pixels corresponding to at least some objects in the at least one object;第二二值化模块,用于通过第二二值化模型对所述原始图像进行处理,以得到第二二值化图像;a second binarization module, configured to process the original image through a second binarization model to obtain a second binarized image;一合成模块,用于根据所述多个外接轮廓像素在所述像素外接轮廓图像中的位置,对所述第二二值化图像和所述第一二值化图像进行合成,以得到所述合成图像,其中,所述合成图像为二值化图像。a synthesizing module for synthesizing the second binarized image and the first binarized image according to the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image to obtain the A composite image, wherein the composite image is a binarized image.
- 根据权利要求9所述的图像处理装置,其特征在于,所述第一二值 化模块执行通过第一二值化模型对所述原始图像进行处理,以得到所述原始图像的第一二值化图像的操作时,包括执行以下操作:The image processing apparatus according to claim 9, wherein the first binarization module performs processing on the original image through a first binarization model to obtain a first binary value of the original image When converting an image, this includes doing the following:对所述原始图像进行压缩处理,以得到输入图像,其中,所述输入图像的尺寸小于所述原始图像的尺寸;compressing the original image to obtain an input image, wherein the size of the input image is smaller than the size of the original image;通过所述第一二值化模型对所述输入图像进行处理,以得到所述原始图像的第一二值化图像。The input image is processed through the first binarization model to obtain a first binarized image of the original image.
- 根据权利要求10所述的图像处理装置,其特征在于,所述第一二值化模块执行通过所述第一二值化模型对所述输入图像进行处理,以得到所述原始图像的第一二值化图像的操作时,包括执行以下操作:The image processing apparatus according to claim 10, wherein the first binarization module performs processing on the input image through the first binarization model to obtain a first image of the original image. Operations on binarizing images include performing the following operations:通过所述第一二值化模型对所述输入图像进行处理,以得到所述输入图像的二值化预测图像;Process the input image by using the first binarization model to obtain a binarized prediction image of the input image;将所述二值化预测图像进行恢复尺寸处理,以得到所述第一二值化图像,其中,所述第一二值化图像的尺寸和所述原始图像的尺寸相同。The size of the binarized predicted image is restored to obtain the first binarized image, wherein the size of the first binarized image is the same as the size of the original image.
- 根据权利要求9所述的图像处理装置,其特征在于,所述处理模块执行对所述第一二值化图像进行处理,以得到像素外接轮廓图像的操作时,包括执行以下操作:The image processing apparatus according to claim 9, wherein, when the processing module performs the operation of processing the first binarized image to obtain a pixel circumscribed contour image, the operation includes performing the following operations:对所述第一二值化图像进行模糊化处理,得到模糊图像;performing a blurring process on the first binarized image to obtain a blurred image;对所述模糊图像和所述第一二值化图像进行异或处理,以得到所述像素外接轮廓图像。XOR processing is performed on the blurred image and the first binarized image to obtain the pixel circumscribed contour image.
- 根据权利要求9所述的图像处理装置,其特征在于,所述合成模块执行根据所述像素外接轮廓图像中的所述多个外接轮廓像素的位置,对所述第二二值化图像和所述第一二值化图像进行合成,以得到所述原始图像的合成图像的操作时,包括执行以下操作:The image processing apparatus according to claim 9, wherein the synthesis module executes a combination of the second binarized image and the second binarized image according to the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image. The operation of synthesizing the first binarized image to obtain the synthesized image of the original image includes performing the following operations:获取所述像素外接轮廓图像中的所述多个外接轮廓像素的位置;obtaining the positions of the plurality of circumscribed contour pixels in the pixel circumscribed contour image;提取所述第二二值化图像中与所述多个外接轮廓像素的位置对应的位置处的多个目标第二二值化像素;extracting a plurality of target second binarization pixels at positions corresponding to the positions of the plurality of circumscribed contour pixels in the second binarized image;根据所述第二二值化图像和所述第一二值化图像的像素对应关系,将所述第二二值化图像中的所述多个目标第二二值化像素分别合成到所述第一二值化图像中的相同位置,以得到所述原始图像的合成图像。According to the pixel correspondence between the second binarized image and the first binarized image, the plurality of target second binarized pixels in the second binarized image are respectively synthesized into the The same position in the first binarized image is obtained to obtain a composite image of the original image.
- 根据权利要求13所述的图像处理装置,其特征在于,所述第二二值化图像中的所有第二二值化像素排列为n行m列,所述第一二值化图像中的所有第一二值化像素排列为n行m列,所述合成图像中的所有合成像素排列为n行m列,The image processing apparatus according to claim 13, wherein all the second binarized pixels in the second binarized image are arranged in n rows and m columns, and all the second binarized pixels in the first binarized image are arranged in n rows and m columns. The first binarized pixels are arranged in n rows and m columns, and all the synthesized pixels in the synthesized image are arranged in n rows and m columns,所述合成模块执行根据所述第二二值化图像和所述第一二值化图像的像素对应关系,将所述第二二值化图像中的所述多个目标第二二值化像素分别合成到所述第一二值化图像中的相同位置的操作时,包括执行以下操作:The synthesis module performs, according to the pixel correspondence between the second binarized image and the first binarized image, the plurality of target second binarized pixels in the second binarized image. The operations of synthesizing to the same position in the first binarized image respectively include performing the following operations:确定所述多个目标第二二值化像素中的第q个目标第二二值化像素,其中,所述第q个目标第二二值化像素位于所述第二二值化图像的第i行第j列;Determine the qth target second binarization pixel in the plurality of target second binarization pixels, wherein the qth target second binarization pixel is located in the second binarization image of the second binarization image. row i, column j;确定所述第一二值化图像中的位于所述第i行第j列的第q个目标第一二值化像素;determining the q-th target first binarized pixel located in the i-th row and the j-th column in the first binarized image;将所述第q个目标第一二值化像素的灰阶值替换为所述第q个目标第二二值化像素的灰阶值,以得到所述合成图像中位于所述第i行第j列的第q个目标合成像素,Replace the grayscale value of the qth target first binarized pixel with the grayscale value of the qth target second binarized pixel, so as to obtain the ith row in the composite image. The qth target synthetic pixel of column j,其中,所述第q个目标合成像素的灰阶值为所述第q个目标第二二值化像素的灰阶值,n、m、q、i、j均为正整数,且i小于等于n,j小于等于m,q小于等于所述多个目标第二二值化像素的数量。Wherein, the grayscale value of the qth target composite pixel is the grayscale value of the qth target second binarized pixel, n, m, q, i, and j are all positive integers, and i is less than or equal to n, j is less than or equal to m, q is less than or equal to the number of the plurality of target second binarized pixels.
- 根据权利要求9~14任一项所述的图像处理装置,其特征在于,所述第二二值化模块包括:The image processing apparatus according to any one of claims 9 to 14, wherein the second binarization module comprises:灰度化模块,用于对所述原始图像进行灰度化处理,得到灰度图像;a grayscale module, configured to perform grayscale processing on the original image to obtain a grayscale image;中间二值化模块,用于根据第一阈值,对所述灰度图像进行处理,得到中间二值化图像;an intermediate binarization module, configured to process the grayscale image according to the first threshold to obtain an intermediate binarized image;滤波模块,用于以所述中间二值化图像为导向图,对所述灰度图像进行导向滤波处理,得到滤波图像;a filtering module, configured to use the intermediate binarized image as a guide image to perform guide filter processing on the grayscale image to obtain a filtered image;确定模块,用于根据第二阈值,确定所述滤波图像中的高值像素点,其中,所述高值像素点的灰度值大于所述第二阈值;a determination module, configured to determine a high-value pixel point in the filtered image according to a second threshold, wherein the gray value of the high-value pixel point is greater than the second threshold;扩充模块,用于根据预设扩充系数,对所述高值像素点的灰度值进行扩充处理,得到扩充图像;an expansion module, configured to perform expansion processing on the grayscale values of the high-value pixel points according to a preset expansion coefficient to obtain an expanded image;清晰化模块,用于对所述扩充图像进行清晰化处理,得到清晰图像,对 所述清晰图像的对比度进行调整,得到所述第二二值化图像。The sharpening module is used for sharpening the expanded image to obtain a clear image, and adjusting the contrast of the clear image to obtain the second binarized image.
- 一种电子设备,其特征在于,包括:An electronic device, comprising:一存储器,用于非瞬时性地存储计算机可读指令;a memory for non-transitory storage of computer-readable instructions;一处理器,用于运行所述计算机可读指令,所述计算机可读指令被所述处理器运行时实现根据权利要求1~8任一项所述的图像处理方法。A processor, configured to execute the computer-readable instructions, when the computer-readable instructions are executed by the processor, the image processing method according to any one of claims 1 to 8 is implemented.
- 一种非瞬时性计算机可读存储介质,其特征在于,所述非瞬时性计算机可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现根据权利要求1~8中任一项所述的图像处理方法。A non-transitory computer-readable storage medium, characterized in that, the non-transitory computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the computer-readable instructions according to claims 1 to 8 are implemented. The image processing method described in any one of.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010636558.4A CN111767924B (en) | 2020-07-03 | 2020-07-03 | Image processing method, image processing apparatus, electronic device, and storage medium |
CN202010636558.4 | 2020-07-03 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022002002A1 true WO2022002002A1 (en) | 2022-01-06 |
Family
ID=72724061
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/102912 WO2022002002A1 (en) | 2020-07-03 | 2021-06-29 | Image processing method, image processing apparatus, electronic device, and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111767924B (en) |
WO (1) | WO2022002002A1 (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111767924B (en) * | 2020-07-03 | 2024-01-26 | 杭州睿琪软件有限公司 | Image processing method, image processing apparatus, electronic device, and storage medium |
CN118096485B (en) * | 2021-04-06 | 2024-12-03 | 王可 | A method for realizing the security of massive chat big data pictures |
CN115100228B (en) * | 2022-07-25 | 2022-12-20 | 江西现代职业技术学院 | Image processing method, system, readable storage medium and computer device |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101443897A (en) * | 2006-05-16 | 2009-05-27 | 东京毅力科创株式会社 | Image binarizing method, image processing device and computer program |
CN109785369A (en) * | 2017-11-10 | 2019-05-21 | 中国移动通信有限公司研究院 | A kind of virtual reality portrait acquisition method and device |
CN110008954A (en) * | 2019-03-29 | 2019-07-12 | 重庆大学 | A method and system for extracting complex background text images based on multi-threshold fusion |
US20200082208A1 (en) * | 2018-09-06 | 2020-03-12 | International Business Machines Corporation | Image binarization using mean restrain |
CN111325657A (en) * | 2020-02-18 | 2020-06-23 | 北京奇艺世纪科技有限公司 | Image processing method, apparatus, electronic device, and computer-readable storage medium |
CN111767924A (en) * | 2020-07-03 | 2020-10-13 | 杭州睿琪软件有限公司 | Image processing method, image processing apparatus, electronic device, and storage medium |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107563977A (en) * | 2017-08-28 | 2018-01-09 | 维沃移动通信有限公司 | A kind of image processing method, mobile terminal and computer-readable recording medium |
CN109754379A (en) * | 2018-12-29 | 2019-05-14 | 北京金山安全软件有限公司 | Image processing method and device |
-
2020
- 2020-07-03 CN CN202010636558.4A patent/CN111767924B/en active Active
-
2021
- 2021-06-29 WO PCT/CN2021/102912 patent/WO2022002002A1/en active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101443897A (en) * | 2006-05-16 | 2009-05-27 | 东京毅力科创株式会社 | Image binarizing method, image processing device and computer program |
CN109785369A (en) * | 2017-11-10 | 2019-05-21 | 中国移动通信有限公司研究院 | A kind of virtual reality portrait acquisition method and device |
US20200082208A1 (en) * | 2018-09-06 | 2020-03-12 | International Business Machines Corporation | Image binarization using mean restrain |
CN110008954A (en) * | 2019-03-29 | 2019-07-12 | 重庆大学 | A method and system for extracting complex background text images based on multi-threshold fusion |
CN111325657A (en) * | 2020-02-18 | 2020-06-23 | 北京奇艺世纪科技有限公司 | Image processing method, apparatus, electronic device, and computer-readable storage medium |
CN111767924A (en) * | 2020-07-03 | 2020-10-13 | 杭州睿琪软件有限公司 | Image processing method, image processing apparatus, electronic device, and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111767924A (en) | 2020-10-13 |
CN111767924B (en) | 2024-01-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20230222631A1 (en) | Method and device for removing handwritten content from text image, and storage medium | |
WO2022002002A1 (en) | Image processing method, image processing apparatus, electronic device, and storage medium | |
WO2021233266A1 (en) | Edge detection method and apparatus, and electronic device and storage medium | |
CN113223025B (en) | Image processing method and device, neural network training method and device | |
US20190304066A1 (en) | Synthesis method of chinese printed character images and device thereof | |
US11823358B2 (en) | Handwritten content removing method and device and storage medium | |
CN113486828B (en) | Image processing method, device, equipment and storage medium | |
CN109117846B (en) | Image processing method and device, electronic equipment and computer readable medium | |
WO2021146937A1 (en) | Character recognition method, character recognition device and storage medium | |
US20150070373A1 (en) | Clarification of Zoomed Text Embedded in Images | |
US20210279509A1 (en) | Method and System For Processing Images Using Cross-Stage Skip Connections | |
CN113901952A (en) | Print form and handwritten form separated character recognition method based on deep learning | |
US10049268B2 (en) | Selective, user-mediated content recognition using mobile devices | |
CN110717497A (en) | Image similarity matching method and device and computer readable storage medium | |
CN113436222A (en) | Image processing method, image processing apparatus, electronic device, and storage medium | |
US11985287B2 (en) | Image processing method, image processing device, electronic apparatus and storage medium | |
RU2633182C1 (en) | Determination of text line orientation | |
WO2024174726A1 (en) | Handwritten and printed text detection method and device based on deep learning | |
CN111556251A (en) | Electronic book generation method, device and medium | |
CN113674144A (en) | Image processing method, terminal equipment and readable storage medium | |
WO2022247702A1 (en) | Image processing method and apparatus, electronic device, and storage medium | |
WO2023130966A1 (en) | Image processing method, image processing apparatus, electronic device and storage medium | |
CN113365071B (en) | Image layered compression method and image layered compression device | |
Temiz | Enhancing the Resolution of Historical Ottoman Texts Using Deep Learning-Based Super-Resolution Techniques. | |
Noola et al. | An approach to extract line, word and character from scene text image |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21834554 Country of ref document: EP Kind code of ref document: A1 |