WO2022164575A1 - Shadow compensation in images - Google Patents

Shadow compensation in images Download PDF

Info

Publication number
WO2022164575A1
WO2022164575A1 PCT/US2021/070900 US2021070900W WO2022164575A1 WO 2022164575 A1 WO2022164575 A1 WO 2022164575A1 US 2021070900 W US2021070900 W US 2021070900W WO 2022164575 A1 WO2022164575 A1 WO 2022164575A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
shadow
grayscale image
grayscale
generate
Prior art date
Application number
PCT/US2021/070900
Other languages
French (fr)
Inventor
Rithvik Kumar T
Neethu John .
Sumit Nath
Original Assignee
Hewlett-Packard Development Company, L.P.
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hewlett-Packard Development Company, L.P. filed Critical Hewlett-Packard Development Company, L.P.
Publication of WO2022164575A1 publication Critical patent/WO2022164575A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • G06T5/94Dynamic range modification of images or parts thereof based on local image properties, e.g. for local contrast enhancement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30176Document

Definitions

  • FIG. 1 is a block diagram of an example image acquisition device, including a shadow correction module to compensate for a shadow in an input image;
  • FIG. 2A depicts an example grayscale image including an arbitrarily shaped shadow
  • FIG. 2B depicts an example shadow map for the grayscale image of FIG. 2A, depicting the arbitrarily shaped shadow
  • FIG. 2C depicts an example output image generated by compensating for the shadow using the shadow map of FIG. 2B;
  • FIG. 3 is a flowchart illustrating an example method for generating an output image by compensating for a shadow in a scan image;
  • FIG. 4A depicts an example grayscale image including a shadow at a crease region
  • FIG. 4B depicts an example binary image of the grayscale image of FIG. 4A
  • FIG. 4C depicts an example horizontally and vertically flipped copy of the binary image of FIG. 4B;
  • FIG. 4D depicts an example appended binary image generated by appending the binary image of FIG. 4B and the flipped copy of FIG. 4C;
  • FIG. 4E is an example appended binary image depicting a shape of the shadow
  • FIG. 4F is the example appended binary image of FIG. 4E, depicting an orientation angle of the shadow
  • FIG. 4G depicts an example shadow map generated by correcting the shadow orientation based on the orientation angle shown in FIG. 4F;
  • FIG. 4H depicts an example output image generated by compensating for the shadow using the shadow map of FIG. 4G;
  • FIG. 5 is a flowchart illustrating an example method for generating a shadow map of a scan image
  • FIG. 6A depicts an example flipped copy of the grayscale image of FIG. 4A
  • FIG. 6B depicts an example appended grayscale image generated by appending the grayscale image of FIG. 4A and the flipped copy of FIG. 6A;
  • FIG. 6C depicts an example rotated grayscale image generated by rotating the appended grayscale image of FIG. 6B based on an orientation of the shadow;
  • FIG. 7 is a flowchart illustrating an example method for generating an output image by compensating for a shadow in a scan image using a shadow map
  • FIGs. 8A and 8B depict an example rotated grayscale image and an example appended grayscale image in an actual orientation, respectively, corresponding to the example method of FIG. 7;
  • FIG. 9 is a block diagram of an example image acquisition device including a non-transitory machine-readable storage medium storing instructions to generate an output image by compensating for a non-uniform shadow in an input image;
  • FIG. 10A depicts an example scan image including a first shadow at a curl region and a second shadow at a crease region;
  • FIG. 10B depicts an example output image corresponding to the scan image of FIG. 10A, without the first and second shadows.
  • the captured image may include a shadow due to changes in an environment illumination (e.g., due to change in luminance, which is a measure of an amount of light falling on the document).
  • a good source of light while capturing the document may result in a shadow-free image.
  • the good source of light may not be a feasible option in some instances.
  • the scan image may include the shadow that spans across a crease region of the document, for instance, due to hard press of the document (e.g., a book) while scanning.
  • An example crease region may include a binding portion of a page of an unfolded book, a presence of a curl, line, or ridge produced on the document, and/or the like.
  • the term “shadow” described herein may refer to a darker region in at least one region of the captured or scan image (e.g., a central region, a border region, and/or the like).
  • the presence of shadows may significantly degrade the quality of the images. For example, if text or characters are involved in the shadow, the text may not be recognized. Thus, the shadows may decrease readability of the text and degrade visual quality of the image. Also, the shadow may cause discomfort in document’s visual perception.
  • Examples described herein may provide an image acquisition device to perform a shadow correction in images.
  • the image acquisition device may receive an input image having a shadow. Further, the image acquisition device may convert the input image into a grayscale image, for instance, if the input image is a color image. Furthermore, the image acquisition device may determine a foreground object or foreground element (e.g., a graphic, text, image, or the like) on the grayscale image having a maximum height. Further, the image acquisition device may generate the shadow map by performing a morphological closing operation on the grayscale image using a structural element.
  • a foreground object or foreground element e.g., a graphic, text, image, or the like
  • the structural element may include a dimension that corresponds to the maximum height.
  • the structural element may refer to a matrix that identifies pixels in the input image being processed and defines a neighborhood used in the processing of each pixel.
  • a size of the structural element may be selected based on the maximum height of the foreground object in the input image.
  • the image acquisition device may generate an output image by compensating for the shadow in the input image using the shadow map.
  • examples described herein may eliminate the shadows that mask the information on the images by normalizing illumination, thereby providing a better visibility of the content (e.g., text, graphics, and/or the like) in the images.
  • FIG. 1 is a block diagram of an example image acquisition device 100, including a shadow correction module 106 to compensate for a shadow in an input image.
  • image acquisition device 100 may be a mobile phone, a digital camera, a scanner, a multifunctional printer, or any other device capable of processing the input image.
  • image acquisition device 100 may include an image scanner to scan a document to generate the scan image or input image.
  • the document may be laid face-down on a transparent platen of the image scanner so that a reading unit installed in the image scanner can read the document through the platen to generate the scan image.
  • image acquisition device 100 may include a camera to capture the document to generate the input image.
  • image acquisition device 100 may receive the input image (e.g., a camera captured image or a scan image) from an optical imaging device externally connected to image acquisition device 100.
  • the input image may be a pre-stored image or may be generated based on scanning the document in real-time.
  • image acquisition device 100 may include a processor 102 and a memory 104 including a shadow correction module 106.
  • Processor 102 may be a type of central processing unit (CPU), microprocessor, or processing logic that interprets and executes machine-readable instructions stored in memory 104 of image acquisition device 100.
  • shadow correction module 106 may receive the input image having a shadow.
  • the input image may be a camera captured image or a scan image of a document.
  • the document may be a receipt, a page from a book, a brochure, a flyer, or the like including content such as text, graphics, or a combination thereof.
  • An example camera captured input image 200A is depicted in FIG. 2A.
  • example input image 200A may include an arbitrarily shaped shadow 204 due to uneven lighting (e.g., as shown in 202) while capturing the document using the camera.
  • shadow correction module 106 may convert the input image into a grayscale image, for instance, if the input image is a color image.
  • the grayscale image may include shades of gray with a single intensity value for each pixel in the input image.
  • shadow correction module 106 may determine a foreground element on the grayscale image having a maximum height.
  • the foreground element may be an object on the grayscale image such as text, a graphic, a table, or the like.
  • shadow correction module 106 may determine the foreground element having the maximum height as follows. Shadow correction module 106 may remove an outlier from the grayscale image.
  • shadow correction module 106 may filter the shadow on the grayscale image using a variance filter to output a blob corresponding to each foreground element on the grayscale image and a size of each blob. Furthermore, shadow correction module 106 may measure a height of each blob. Then, shadow correction module 106 may determine the foreground element having the maximum height based on the height of each blob. The size of the structural element may be selected based on the maximum height of the determined foreground element in the input image.
  • shadow correction module 106 may generate a shadow map by performing a morphological closing operation on the grayscale image using a structural element having a dimension corresponding to the maximum height.
  • the shadow map may have a form of an image, which is composed of shading data for each pixel in the shadow on the input image and is used to compensate for the shadow.
  • the shadow data of one pixel may be data indicating the estimated background pixel value (e.g., representing brightness) of the pixel.
  • the pixel value may be in the range of 0-255, for example.
  • the morphological closing operation may include a morphological dilation of the grayscale image by the structuring element followed by a morphological erosion of the dilated image by the same structuring element to result in a closed image (i.e., the shadow map).
  • the morphological closing operation with the structural element may remove the foreground content/elements (e.g., graphics, text, tables, or the like) from the grayscale image to generate the shadow map.
  • the content may be removed from the grayscale image by replacing black pixels with white pixels.
  • the shadow map described herein may refer to an image that includes at least one shadow without any other foreground elements or foreground objects.
  • An example shadow map 200B depicting shadow 204 is shown in FIG.2B.
  • shadow correction module 106 may generate an output image by compensating for the shadow in the input image using the shadow map.
  • shadow correction module 106 may generate the output image by compensating for the shadow in the grayscale image using the shadow map. For example, if the input image is a color image, the shadow correction can be performed in the luminance channel, while avoiding the chrominance channels. Further, if the input image is the color image, shadow correction module 106 may convert the grayscale image into an original format of the input image to generate the output image upon compensating for the shadow.
  • An example output image 200C is depicted in FIG. 2C, in which shadow 204 of FIG. 2A is compensated using shadow map 200B of FIG. 2B.
  • image acquisition device 100 such as a scanner or a multifunction printer may scan a document to generate a scan image, process the scan image, and output a shadow-corrected (e.g., shadow-compensated) image, for instance, a physical copy or a digital copy.
  • image acquisition device 100 such as a mobile phone, a computer, a digital camera, or the like may capture an image of a document, process the captured image, and output a shadow-corrected (e.g., shadow-compensated) image, for instance, a digital copy.
  • image acquisition device 100 may process a stored image (e.g., a scan image or a captured image) and output a shadow- corrected (e.g., shadow-compensated) image.
  • the functionalities described in FIG. 1 in relation to instructions to implement functions of shadow correction module 106 and any additional instructions described herein in relation to the storage medium, may be implemented as engines or modules including any combination of hardware and programming to implement the functionalities of the modules or engines described herein.
  • the functions of shadow correction module 106 may also be implemented by a respective processor.
  • the processor may include, for example, one processor or multiple processors included in a single device or distributed across multiple devices.
  • FIG. 3 is a flowchart illustrating an example method 300 for generating an output image by compensating for a shadow in a scan image.
  • a scan image including a color scanned page may be received.
  • the scan image may include a shadow that spans across a crease region.
  • the scan image includes a colored single-page scanned document of a book.
  • the scan image may be converted into a grayscale image.
  • the input image i.e., a Red, Green, and Blue (RGB) image (i.e., a true color image
  • RGB Red, Green, and Blue
  • Converting the RGB image to a grayscale image may involve separating the RGB image into luminance and chroma components.
  • YCbCr is an example to separate the RGB image into luminance and chroma components.
  • the luminance (Y) channel of the YCtCr color space may be used to represent the scan image in grayscale.
  • the chroma components C and Cr may represent the blue-difference and red-difference.
  • method 300 may be carried out in the luminance channel (e.g., a channel including intensity information).
  • An example grayscale image 400A including a non-uniform shadow 402 at the crease region is depicted in FIG. 4A.
  • grayscale image 400A may include shadow 402 that spans non-uniformly along the crease region in the scan image acquired through a flatbed scanner.
  • the grayscale image may be converted into a binary image, for instance, based on a pre-defined gray threshold.
  • the gray threshold may depend on a nature of the grayscale image.
  • the gray threshold may help to generate the binary image from the grayscale image.
  • an Otsu thresholding may be used to determine a threshold for the grayscale image and generate the binary image from the grayscale image.
  • An example binary image 400B with non-uniform shadow 402 is depicted in FIG. 4B.
  • the Otsu thresholding may convert the grayscale image to a monochrome image, i.e., to generate a single intensity threshold that separate pixels into two classes, foreground, and background.
  • a horizontally and vertically flipped copy of the binary image may be generated.
  • An example horizontally and vertically flipped copy 400C of binary image 400B of FIG. 4B with a non-uniform shadow 404 is depicted in FIG. 4C.
  • the flipped copy (e.g., 400C of FG. 4C) of the binary image may be appended to a side of the binary image (e.g., 400B of FIG. 4B) based on the crease region.
  • the flipped copy of the binary image may be appended to the right side of the binary image.
  • the flipped copy may be appended to the left side of the binary image. For example, consider that the input image is generated by scanning a page of an unfolded book.
  • the flipped copy when the page comes in a left side of the crease (e.g., a binding portion), the flipped copy is appended at a right side of the binary image. Similarly, when the page comes in a right side of the crease, the flipped copy may be appended at a left side of the binary image.
  • the binary image in order to make the shadow noticeable along the crease region, the binary image may be appended with the flipped copy of the binary image.
  • the shadow formed in such appended binary images may be noticeable because of symmetry introduced by stitching a binary image with an associated horizontally and vertically flipped copy.
  • An example appended image 400D generated by appending binary image 400B and flipped copy 400C with a non-uniform shadow 406 (e.g., appended shadows 402 and 404) at a central region is depicted in FIG. 4D.
  • an orientation of the shadow in the appended binary image may be determined.
  • the orientation of the shadow may refer to an angle of the shadow with respect to a reference plane (e.g., an appended binary image plane).
  • determining the orientation of the shadow may include:
  • the morphological opening operation may remove unwanted parts or region (e.g., content including text, graphics, or the like) and retain the shape of the shadow across the crease region.
  • the morphological opening operation may be used to remove small objects from the binary image while preserving the shape and size of larger objects in the binary image. For example, assuming that the scan image includes dark foreground elements (e.g., text, images, graphics, or the like) on a lighter or white background, the morphological opening operation may include an erosion followed by a dilation using a same structuring element for both operations.
  • an erosion operation may remove objects (e.g., text, graphics, or the like) that are smaller than the structuring element and a dilation operation restores the size and shape of the remaining objects (i.e., the shadow).
  • An example appended binary image 400E depicting the shape of non-uniform shadow 406 is shown in FIG. 4E.
  • FIG. 4F An example oriented and maximum area rectangle 408 inscribed within non-uniform shadow 406 is depicted in FIG. 4F.
  • the orientation of the maximum area rectangle may be determined by measuring a slope of a side with maximum length in the rectangle. As depicted in FIG. 4F, the orientation of maximum area rectangle 408 approximates the orientation of shadow 406.
  • a shadow map of the appended binary image may be generated by correcting the orientation of the shadow.
  • the shadow map may have a form of an image, which is composed of shading data for each pixel in the crease region (e.g., a binding portion) on the scan image and is used to correct the shadow.
  • An example shadow map 400G with a uniform or straight shadow 412 (e.g., perpendicular to a reference plane) across the crease is depicted in FIG. 4G.
  • An example method for generating the shadow map is described in FIG. 5.
  • an output image may be generated by compensating for the shadow in the scan image using the shadow map.
  • the output image is generated by dividing the greyscale image by the shadow map.
  • An example output image 400H is depicted in FIG. 4H.
  • An example method for generating the output image is described in FIG. 7.
  • FIG. 5 is a flowchart illustrating an example method 500 for generating a shadow map (e.g., shadow map 400G of FIG. 4G) of a scan image.
  • the scan image may be converted to a grayscale image (e.g., as depicted in FIG. 4A).
  • a horizontally and vertically flipped copy of the grayscale image may be generated.
  • An example flipped grayscale image 600A including shadow 602 (e.g., a flipped version of shadow 402) is depicted in FIG. 6A.
  • the flipped copy of the grayscale image may be appended to a side of the grayscale image based on the crease region.
  • FIG. 6B An example appended grayscale image 600B including shadow 604 at a substantially central region is depicted in FIG. 6B.
  • the appended grayscale image may be rotated by a determined orientation (e.g., orientation angle 410 as shown in FIG. 4F) to make shadow 604 substantially vertical across the crease region as depicted in 600C of FIG. 6C.
  • a determined orientation e.g., orientation angle 410 as shown in FIG. 4F
  • the shadow map (e.g., shadow map 400G of FIG. 4G) may be generated by removing content from the rotated grayscale image.
  • generating the shadow map may include:
  • the size of the structural element may correspond to a maximum height of a foreground element on the grayscale image.
  • the size of the structuring element may be a deciding factor in extracting the shadow from the scan image. For example, in the scan image including a combination of textual and graphic content, a wrong size of the structuring element may retain some graphic part in addition to the shadow.
  • selecting the size of the structuring element equal to a maximum height of a foreground element (e.g., a graphic, text, or image) on the scan image may remove the content on the rotated grayscale image by retaining the shadow.
  • the size for the structuring element may be determined by removing outliers like vertical lines which could be part of a table or vertical crease of the scan image.
  • the morphological closing operation with a predetermined radius and a vertical shape may be performed to close vertical lines on the scan image.
  • the morphed output is passed through a variance filter. The variation of intensities across pixels in a shadow region is relatively lower as compared to a non-shadow region.
  • a fixed radius rectangular kernel-based variance filter is used to negate shadow effect and output a blob of foreground elements in their actual size. Further, a height of each blob may be determined to determine the maximum height. The determined maximum height may then be used as the size of the aforementioned structuring element. In other examples, the blob of elements can also be determined, for instance, by using a connected component analysis on the grayscale image or the binary image.
  • FIG. 7 is a flowchart illustrating an example method 700 for generating an output image by compensating for a shadow in a scan image using a shadow map.
  • a shadow map e.g., shadow map 400G as depicted in FIG. 4G
  • a rotated grayscale image e.g., rotated grayscale image 600C as depicted in FIG. 6C.
  • An example rotated grayscale image in which the shadow is compensated is depicted in 800A of FIG. 8A.
  • Example grayscale image 800A may include a grayscale image 802 and a flipped copy 804 of grayscale image 802, in which the shadow is compensated.
  • the appended grayscale image may be rotated back by the determined orientation (e.g., orientation angle 410 as shown in FIG. 4F) to generate the appended grayscale image in an actual orientation.
  • An example appended grayscale image in the actual orientation without the shadow is depicted in 800B of FIG. 8B.
  • the flipped copy (e.g., flipped copy 804 as shown in FIG. 8B) of the grayscale image may be detached from the re-rotated grayscale image, upon detaching the flipped copy of the grayscale image, at 708, the output image may be generated by converting the grayscale image to a color image, for instance, using the chroma components (Cb and Cr).
  • example method 700 may perform luminance correction.
  • the shadow- compensated grayscale image may be obtained by dividing the shadow map from the rotated grayscale image. Then, chroma channels (Cr and Cb) are combined with the shadow corrected luminance image (Y). Further, the shadow corrected output image is converted from YCbCr to RGB color space to get final output image.
  • Example method 300, 500, or 700 depicted in FIG. 3, 5, or 7 represents generalized illustrations, and that other processes may be added, or existing processes may be removed, modified, or rearranged without departing from the scope and spirit of the present application.
  • the processes may represent instructions stored on a computer-readable storage medium that, when executed, may cause a processor to respond, to perform actions, to change states, and/or to make decisions.
  • the processes of method 300, 500, or 700 may represent functions and/or actions performed by functionally equivalent circuits like analog circuits, digital signal processing circuits, application specific integrated circuits (ASICs), or other hardware components associated with the system.
  • ASICs application specific integrated circuits
  • FIG. 9 is a block diagram of an example image acquisition device 900 including a non-transitory machine-readable storage medium 904 storing instructions to generate an output image by compensating for a non-uniform shadow in a grayscale image.
  • Image acquisition device 900 may include a processor 902 and machine-readable storage medium 904 communicatively coupled through a system bus.
  • Processor 902 may be any type of central processing unit (CPU), microprocessor, or processing logic that interprets and executes machine-readable instructions stored in machine-readable storage medium 904.
  • Machine-readable storage medium 904 may be a random-access memory (RAM) or another type of dynamic storage device that may store information and machine-readable instructions that may be executed by processor 902.
  • machine-readable storage medium 904 may be synchronous DRAM (SDRAM), double data rate (DDR), rambus DRAM (RDRAM), rambus RAM, etc., or storage memory media such as a floppy disk, a hard disk, a CD-ROM, a DVD, a pen drive, and the like.
  • machine-readable storage medium 904 may be non-transitory machine-readable medium.
  • Machine-readable storage medium 904 may be remote but accessible to image acquisition device 900.
  • machine-readable storage medium 904 may store instructions 906-918.
  • instructions 906-918 may be executed by processor 902 to generate an output image by compensating for a non-uniform shadow in the grayscale image.
  • Instructions 906 may be executed by processor 902 to receive a grayscale image having a non-uniform shadow that spans across a crease region.
  • Instructions 908 may be executed by processor 902 to convert the grayscale image into a binary image.
  • Instructions 910 may be executed by processor 902 to generate a flipped copy of the binary image.
  • Instructions 912 may be executed by processor 902 to append the flipped copy of the binary image to a side of the binary image based on the crease region.
  • Instructions 914 may be executed by processor 902 to determine an orientation of the shadow in the appended binary image.
  • instructions to determine the orientation of the shadow may include instructions to: o perform a morphological opening operation on the appended binary image to retain a shape of the shadow, o position an oriented and maximum area rectangle inscribed within the shadow, and o determine the orientation of the shadow in the appended binary image based on an orientation of the maximum area rectangle.
  • Instructions 916 may be executed by processor 902 to generate a shadow map by converting the non-uniform shadow to a substantially uniform shadow based on the orientation.
  • instructions to generate the shadow map by converting the non-uniform shadow to the substantially uniform shadow may include instructions to: o generate a flipped copy of the grayscale image, o append the flipped copy of the grayscale image to a side of the grayscale image based on the crease region, o rotate the appended grayscale image by the determined orientation to make the shadow substantially uniform across the crease region, and o generate the shadow map of the appended grayscale image.
  • the shadow map may include the substantially uniform shadow.
  • instructions to generate the shadow map may include instructions to determine a size of a structural element to perform a morphological closing operation and generate the shadow map by performing the morphological closing operation on the rotated grayscale image using the structural element with the determined size.
  • the size of the structural element may be determined by: o removing an outlier from the grayscale image, o filter the shadow on the grayscale image using a variance filter to output a blob corresponding to each foreground element on the grayscale image and a size of each blob, o measure a height of each blob, and o determine a height of a blob having a maximum value as the size of the structural element.
  • Instructions 918 may be executed by processor 902 to generate an output image by compensating for the non-uniform shadow in the grayscale image using the shadow map.
  • instructions 918 to generate the output image may include instructions to: o compensate for the shadow in the appended grayscale image using the shadow map, o upon compensating for the shadow in the appended grayscale image, rotate back the appended grayscale image by the determined orientation to generate the appended grayscale image in an actual orientation, and o detach the flipped copy of the grayscale image from the rotated back grayscale image to generate the output image.
  • Examples described herein may generate an output image by compensating for multiple shadows (e.g., shadow at different locations such as a central region, a side region corresponding to a binding portion, or the like) from an input image, for instance, as depicted in FIGs. 10A and 10B.
  • FIG. 10A may depict an input image 1000A having multiple shadows, i.e., a first shadow 1002 at a curl/fold region and a second shadow 1004 at a crease region (e.g., a binding part of an unfolded book).
  • the morphological closing operation with a structural element as described with respect to FIG. 1 may compensate for first shadow 1002 in the input image.
  • correcting an orientation of second shadow 1004 at the crease region in combination with the morphological closing operation with the structural element as described with respect to FIGs. 3 and 9 may compensate for first shadow 1002 and second shadow 1004 in input image 1000A.
  • a shadow map for the input image may include both first shadow 1002 and second shadow 1004, which can be compensated in input image 1000A to generate an output image.
  • An example output image 1000B corresponding to input mage 1000A without first shadow 1002 and second shadow 1004 is depicted in FIG. 10B.
  • examples described in FIGs. 3 and 9 may correct shadows in a binding portion on a scan image of an unfolded book as well as shadows in other portions (e.g., curl regions) of the scan image.

Landscapes

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

Abstract

An image acquisition device may include a processor and a memory including a shadow correction module. The shadow correction module may receive an input image having a shadow and convert the input image into a grayscale image. Further, the shadow correction module may determine a foreground element on the grayscale image having a maximum height. Furthermore, the shadow correction module may generate the shadow map by performing a morphological closing operation on the grayscale image using a structural element having a dimension corresponding to the maximum height. Further, the shadow correction module may generate an output image by compensating for the shadow in the input image using the shadow map.

Description

SHADOW COMPENSATION IN IMAGES
BACKGROUND
[0001] The rapid adoption of digitization in various domains such as health care, banking, education, aviation, and the like brings transparency in document processing. The advent of scanners and mobile phone cameras cater to the digitization. Digitization may involve scanning of documents such as pages of a book, receipts, certificates, and the like. The document processing technologies may allow to capture the documents using various types of optical imaging devices such as mobile phone cameras, flatbed scanners, or the like. For example, mobile phones may include cameras, for instance high resolution cameras, which allow users the ability to capture images of documents. Similarly, to copy or scan a page of a book, the page may have to be laid face-down on a transparent platen of the flatbed scanner or a copying machine so that a reading unit installed in the flatbed scanner can read the document through the platen.
BRIEF DESCRIPTION OF THE DRAWINGS
[0002] Examples are described in the following detailed description and in reference to the drawings, in which:
[0003] FIG. 1 is a block diagram of an example image acquisition device, including a shadow correction module to compensate for a shadow in an input image;
[0004] FIG. 2A depicts an example grayscale image including an arbitrarily shaped shadow;
[0005] FIG. 2B depicts an example shadow map for the grayscale image of FIG. 2A, depicting the arbitrarily shaped shadow;
[0006] FIG. 2C depicts an example output image generated by compensating for the shadow using the shadow map of FIG. 2B; [0007] FIG. 3 is a flowchart illustrating an example method for generating an output image by compensating for a shadow in a scan image;
[0008] FIG. 4A depicts an example grayscale image including a shadow at a crease region;
[0009] FIG. 4B depicts an example binary image of the grayscale image of FIG. 4A;
[0010] FIG. 4C depicts an example horizontally and vertically flipped copy of the binary image of FIG. 4B;
[0011] FIG. 4D depicts an example appended binary image generated by appending the binary image of FIG. 4B and the flipped copy of FIG. 4C;
[0012] FIG. 4E is an example appended binary image depicting a shape of the shadow;
[0013] FIG. 4F is the example appended binary image of FIG. 4E, depicting an orientation angle of the shadow;
[0014] FIG. 4G depicts an example shadow map generated by correcting the shadow orientation based on the orientation angle shown in FIG. 4F;
[0015] FIG. 4H depicts an example output image generated by compensating for the shadow using the shadow map of FIG. 4G;
[0016] FIG. 5 is a flowchart illustrating an example method for generating a shadow map of a scan image; [0017] FIG. 6A depicts an example flipped copy of the grayscale image of FIG. 4A;
[0018] FIG. 6B depicts an example appended grayscale image generated by appending the grayscale image of FIG. 4A and the flipped copy of FIG. 6A;
[0019] FIG. 6C depicts an example rotated grayscale image generated by rotating the appended grayscale image of FIG. 6B based on an orientation of the shadow;
[0020] FIG. 7 is a flowchart illustrating an example method for generating an output image by compensating for a shadow in a scan image using a shadow map;
[0021] FIGs. 8A and 8B depict an example rotated grayscale image and an example appended grayscale image in an actual orientation, respectively, corresponding to the example method of FIG. 7;
[0022] FIG. 9 is a block diagram of an example image acquisition device including a non-transitory machine-readable storage medium storing instructions to generate an output image by compensating for a non-uniform shadow in an input image;
[0023] FIG. 10A depicts an example scan image including a first shadow at a curl region and a second shadow at a crease region; and
[0024] FIG. 10B depicts an example output image corresponding to the scan image of FIG. 10A, without the first and second shadows.
DETAILED DESCRIPTION
[0025] Even with a widespread use of computers, the use of paper-based documents (e.g., books, certificates, receipts, and the like) to record, communicate, and store information remains popular in various domains (e.g., health care, banking, education, aviation, and the like). Such documents may have to be converted to electronic format via digitization, for instance, to store, access, produce, and analyze the documents. Digitization may involve scanning of documents. The advent of optical imaging devices such as mobile phone cameras, flatbed scanners, or the like cater to the digitization.
[0026] When a mobile phone is used to capture an image of a document, the captured image may include a shadow due to changes in an environment illumination (e.g., due to change in luminance, which is a measure of an amount of light falling on the document). A good source of light while capturing the document may result in a shadow-free image. However, the good source of light may not be a feasible option in some instances. Similarly, when a flatbed scanner outputs a scan image of the document, the scan image may include the shadow that spans across a crease region of the document, for instance, due to hard press of the document (e.g., a book) while scanning. An example crease region may include a binding portion of a page of an unfolded book, a presence of a curl, line, or ridge produced on the document, and/or the like.
[0027] The term “shadow” described herein may refer to a darker region in at least one region of the captured or scan image (e.g., a central region, a border region, and/or the like). The presence of shadows may significantly degrade the quality of the images. For example, if text or characters are involved in the shadow, the text may not be recognized. Thus, the shadows may decrease readability of the text and degrade visual quality of the image. Also, the shadow may cause discomfort in document’s visual perception.
[0028] Examples described herein may provide an image acquisition device to perform a shadow correction in images. The image acquisition device may receive an input image having a shadow. Further, the image acquisition device may convert the input image into a grayscale image, for instance, if the input image is a color image. Furthermore, the image acquisition device may determine a foreground object or foreground element (e.g., a graphic, text, image, or the like) on the grayscale image having a maximum height. Further, the image acquisition device may generate the shadow map by performing a morphological closing operation on the grayscale image using a structural element.
[0029] In an example, the structural element may include a dimension that corresponds to the maximum height. The structural element may refer to a matrix that identifies pixels in the input image being processed and defines a neighborhood used in the processing of each pixel. In this example, a size of the structural element may be selected based on the maximum height of the foreground object in the input image. Further, the image acquisition device may generate an output image by compensating for the shadow in the input image using the shadow map. Thus, examples described herein may eliminate the shadows that mask the information on the images by normalizing illumination, thereby providing a better visibility of the content (e.g., text, graphics, and/or the like) in the images.
[0030] In the following description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present techniques. However, the example apparatuses, devices, and systems, may be practiced without these specific details. Reference in the specification to “an example” or similar language means that a particular feature, structure, or characteristic described may be included in at least that one example but may not be in other examples.
[0031] Turning now to the figures, FIG. 1 is a block diagram of an example image acquisition device 100, including a shadow correction module 106 to compensate for a shadow in an input image. For example, image acquisition device 100 may be a mobile phone, a digital camera, a scanner, a multifunctional printer, or any other device capable of processing the input image. In an example, image acquisition device 100 may include an image scanner to scan a document to generate the scan image or input image. In this example, the document may be laid face-down on a transparent platen of the image scanner so that a reading unit installed in the image scanner can read the document through the platen to generate the scan image. In another example, image acquisition device 100 may include a camera to capture the document to generate the input image. In yet another example, image acquisition device 100 may receive the input image (e.g., a camera captured image or a scan image) from an optical imaging device externally connected to image acquisition device 100. In some examples, the input image may be a pre-stored image or may be generated based on scanning the document in real-time.
[0032] As shown in FIG. 1, image acquisition device 100 may include a processor 102 and a memory 104 including a shadow correction module 106. Processor 102 may be a type of central processing unit (CPU), microprocessor, or processing logic that interprets and executes machine-readable instructions stored in memory 104 of image acquisition device 100.
[0033] During operation, shadow correction module 106 may receive the input image having a shadow. For example, the input image may be a camera captured image or a scan image of a document. For example, the document may be a receipt, a page from a book, a brochure, a flyer, or the like including content such as text, graphics, or a combination thereof. An example camera captured input image 200A is depicted in FIG. 2A. As shown in FIG. 2A, example input image 200A may include an arbitrarily shaped shadow 204 due to uneven lighting (e.g., as shown in 202) while capturing the document using the camera.
[0034] Referring back to FIG. 1 , shadow correction module 106 may convert the input image into a grayscale image, for instance, if the input image is a color image. For example, the grayscale image may include shades of gray with a single intensity value for each pixel in the input image. Furthermore, shadow correction module 106 may determine a foreground element on the grayscale image having a maximum height. For example, the foreground element may be an object on the grayscale image such as text, a graphic, a table, or the like. [0035] In an example, shadow correction module 106 may determine the foreground element having the maximum height as follows. Shadow correction module 106 may remove an outlier from the grayscale image. Further, shadow correction module 106 may filter the shadow on the grayscale image using a variance filter to output a blob corresponding to each foreground element on the grayscale image and a size of each blob. Furthermore, shadow correction module 106 may measure a height of each blob. Then, shadow correction module 106 may determine the foreground element having the maximum height based on the height of each blob. The size of the structural element may be selected based on the maximum height of the determined foreground element in the input image.
[0036] Further, shadow correction module 106 may generate a shadow map by performing a morphological closing operation on the grayscale image using a structural element having a dimension corresponding to the maximum height. For example, the shadow map may have a form of an image, which is composed of shading data for each pixel in the shadow on the input image and is used to compensate for the shadow. The shadow data of one pixel may be data indicating the estimated background pixel value (e.g., representing brightness) of the pixel. The pixel value may be in the range of 0-255, for example.
[0037] For example, consider that the input image includes dark foreground elements (e.g., text, images, graphics, or the like) on a lighter or white background. In this example, the morphological closing operation may include a morphological dilation of the grayscale image by the structuring element followed by a morphological erosion of the dilated image by the same structuring element to result in a closed image (i.e., the shadow map). The morphological closing operation with the structural element may remove the foreground content/elements (e.g., graphics, text, tables, or the like) from the grayscale image to generate the shadow map. In this example, the content may be removed from the grayscale image by replacing black pixels with white pixels. The shadow map described herein may refer to an image that includes at least one shadow without any other foreground elements or foreground objects. An example shadow map 200B depicting shadow 204 is shown in FIG.2B.
[0038] Furthermore, shadow correction module 106 may generate an output image by compensating for the shadow in the input image using the shadow map. In an example, shadow correction module 106 may generate the output image by compensating for the shadow in the grayscale image using the shadow map. For example, if the input image is a color image, the shadow correction can be performed in the luminance channel, while avoiding the chrominance channels. Further, if the input image is the color image, shadow correction module 106 may convert the grayscale image into an original format of the input image to generate the output image upon compensating for the shadow. An example output image 200C is depicted in FIG. 2C, in which shadow 204 of FIG. 2A is compensated using shadow map 200B of FIG. 2B.
[0039] In an example, image acquisition device 100 such as a scanner or a multifunction printer may scan a document to generate a scan image, process the scan image, and output a shadow-corrected (e.g., shadow-compensated) image, for instance, a physical copy or a digital copy. In another example, image acquisition device 100 such as a mobile phone, a computer, a digital camera, or the like may capture an image of a document, process the captured image, and output a shadow-corrected (e.g., shadow-compensated) image, for instance, a digital copy. In yet another example, image acquisition device 100 may process a stored image (e.g., a scan image or a captured image) and output a shadow- corrected (e.g., shadow-compensated) image.
[0040] In some examples, the functionalities described in FIG. 1 , in relation to instructions to implement functions of shadow correction module 106 and any additional instructions described herein in relation to the storage medium, may be implemented as engines or modules including any combination of hardware and programming to implement the functionalities of the modules or engines described herein. The functions of shadow correction module 106 may also be implemented by a respective processor. In examples described herein, the processor may include, for example, one processor or multiple processors included in a single device or distributed across multiple devices.
[0041] FIG. 3 is a flowchart illustrating an example method 300 for generating an output image by compensating for a shadow in a scan image. At 302, a scan image including a color scanned page may be received. The scan image may include a shadow that spans across a crease region. For example, the scan image includes a colored single-page scanned document of a book. At 304, the scan image may be converted into a grayscale image. For example, the input image, i.e., a Red, Green, and Blue (RGB) image (i.e., a true color image) may be converted to the grayscale image. Converting the RGB image to a grayscale image may involve separating the RGB image into luminance and chroma components. YCbCr is an example to separate the RGB image into luminance and chroma components. The luminance (Y) channel of the YCtCr color space may be used to represent the scan image in grayscale. The chroma components C and Cr may represent the blue-difference and red-difference. For example, method 300 may be carried out in the luminance channel (e.g., a channel including intensity information). An example grayscale image 400A including a non-uniform shadow 402 at the crease region is depicted in FIG. 4A. In FIG. 4A, grayscale image 400A may include shadow 402 that spans non-uniformly along the crease region in the scan image acquired through a flatbed scanner.
[0042] At 306, the grayscale image may be converted into a binary image, for instance, based on a pre-defined gray threshold. The gray threshold may depend on a nature of the grayscale image. The gray threshold may help to generate the binary image from the grayscale image. In an example, an Otsu thresholding may be used to determine a threshold for the grayscale image and generate the binary image from the grayscale image. An example binary image 400B with non-uniform shadow 402 is depicted in FIG. 4B. For example, the Otsu thresholding may convert the grayscale image to a monochrome image, i.e., to generate a single intensity threshold that separate pixels into two classes, foreground, and background. At 308, a horizontally and vertically flipped copy of the binary image may be generated. An example horizontally and vertically flipped copy 400C of binary image 400B of FIG. 4B with a non-uniform shadow 404 is depicted in FIG. 4C.
[0043] At 310, the flipped copy (e.g., 400C of FG. 4C) of the binary image may be appended to a side of the binary image (e.g., 400B of FIG. 4B) based on the crease region. When the shadow appears on a right side of the input image, then the flipped copy of the binary image may be appended to the right side of the binary image. When the shadow appears on a left side of the input image, then the flipped copy may be appended to the left side of the binary image. For example, consider that the input image is generated by scanning a page of an unfolded book. In this example, when the page comes in a left side of the crease (e.g., a binding portion), the flipped copy is appended at a right side of the binary image. Similarly, when the page comes in a right side of the crease, the flipped copy may be appended at a left side of the binary image. Thus, in order to make the shadow noticeable along the crease region, the binary image may be appended with the flipped copy of the binary image. The shadow formed in such appended binary images may be noticeable because of symmetry introduced by stitching a binary image with an associated horizontally and vertically flipped copy. An example appended image 400D generated by appending binary image 400B and flipped copy 400C with a non-uniform shadow 406 (e.g., appended shadows 402 and 404) at a central region is depicted in FIG. 4D.
[0044] At 312, an orientation of the shadow in the appended binary image may be determined. The orientation of the shadow may refer to an angle of the shadow with respect to a reference plane (e.g., an appended binary image plane). In an example, determining the orientation of the shadow may include:
- performing a morphological opening operation on the appended binary image to retain a shape of the shadow. For example, the morphological opening operation may remove unwanted parts or region (e.g., content including text, graphics, or the like) and retain the shape of the shadow across the crease region. The morphological opening operation may be used to remove small objects from the binary image while preserving the shape and size of larger objects in the binary image. For example, assuming that the scan image includes dark foreground elements (e.g., text, images, graphics, or the like) on a lighter or white background, the morphological opening operation may include an erosion followed by a dilation using a same structuring element for both operations. In the morphological opening operation, an erosion operation may remove objects (e.g., text, graphics, or the like) that are smaller than the structuring element and a dilation operation restores the size and shape of the remaining objects (i.e., the shadow). An example appended binary image 400E depicting the shape of non-uniform shadow 406 is shown in FIG. 4E.
- positioning an oriented and maximum area rectangle inscribed within the shadow. An example oriented and maximum area rectangle 408 inscribed within non-uniform shadow 406 is depicted in FIG. 4F.
- determining the orientation of the shadow in the appended binary image based on an orientation of the maximum area rectangle (e.g., an orientation angle 410 as shown in FIG. 4F). For example, the orientation of the maximum area rectangle may be determined by measuring a slope of a side with maximum length in the rectangle. As depicted in FIG. 4F, the orientation of maximum area rectangle 408 approximates the orientation of shadow 406.
[0045] In some examples, other methods such as a flood fill operation can also be applied to remove the content from the appended binary image and retain the shape of the shadow. At 314, a shadow map of the appended binary image may be generated by correcting the orientation of the shadow. For example, the shadow map may have a form of an image, which is composed of shading data for each pixel in the crease region (e.g., a binding portion) on the scan image and is used to correct the shadow. An example shadow map 400G with a uniform or straight shadow 412 (e.g., perpendicular to a reference plane) across the crease is depicted in FIG. 4G. An example method for generating the shadow map is described in FIG. 5. At 316, an output image may be generated by compensating for the shadow in the scan image using the shadow map. For example, the output image is generated by dividing the greyscale image by the shadow map. An example output image 400H is depicted in FIG. 4H. An example method for generating the output image is described in FIG. 7.
[0046] FIG. 5 is a flowchart illustrating an example method 500 for generating a shadow map (e.g., shadow map 400G of FIG. 4G) of a scan image. The scan image may be converted to a grayscale image (e.g., as depicted in FIG. 4A). At 502, a horizontally and vertically flipped copy of the grayscale image may be generated. An example flipped grayscale image 600A including shadow 602 (e.g., a flipped version of shadow 402) is depicted in FIG. 6A. At 504, the flipped copy of the grayscale image may be appended to a side of the grayscale image based on the crease region. An example appended grayscale image 600B including shadow 604 at a substantially central region is depicted in FIG. 6B. At 506, the appended grayscale image may be rotated by a determined orientation (e.g., orientation angle 410 as shown in FIG. 4F) to make shadow 604 substantially vertical across the crease region as depicted in 600C of FIG. 6C.
[0047] At 508, the shadow map (e.g., shadow map 400G of FIG. 4G) may be generated by removing content from the rotated grayscale image. In an example, generating the shadow map may include:
- determining a size of a structural element to perform a morphological closing operation. In an example, the size of the structural element may correspond to a maximum height of a foreground element on the grayscale image.
- generating the shadow map by performing the morphological closing operation on the rotated grayscale image using the structural element with the determined size. The morphological closing operation may be performed to remove content (e.g., text, graphics, tables, and the like) of the grayscale image and retain shadow 604. An example shadow map 400G is depicted in FIG. 4G. [0048] In an example, the size of the structuring element may be a deciding factor in extracting the shadow from the scan image. For example, in the scan image including a combination of textual and graphic content, a wrong size of the structuring element may retain some graphic part in addition to the shadow. Thus, selecting the size of the structuring element equal to a maximum height of a foreground element (e.g., a graphic, text, or image) on the scan image may remove the content on the rotated grayscale image by retaining the shadow. In an example, the size for the structuring element may be determined by removing outliers like vertical lines which could be part of a table or vertical crease of the scan image. Further, the morphological closing operation with a predetermined radius and a vertical shape may be performed to close vertical lines on the scan image. Furthermore, the morphed output is passed through a variance filter. The variation of intensities across pixels in a shadow region is relatively lower as compared to a non-shadow region. Hence, a fixed radius rectangular kernel-based variance filter is used to negate shadow effect and output a blob of foreground elements in their actual size. Further, a height of each blob may be determined to determine the maximum height. The determined maximum height may then be used as the size of the aforementioned structuring element. In other examples, the blob of elements can also be determined, for instance, by using a connected component analysis on the grayscale image or the binary image.
[0049] FIG. 7 is a flowchart illustrating an example method 700 for generating an output image by compensating for a shadow in a scan image using a shadow map. At 702, a shadow map (e.g., shadow map 400G as depicted in FIG. 4G) may be used to compensate for the shadow in a rotated grayscale image (e.g., rotated grayscale image 600C as depicted in FIG. 6C). An example rotated grayscale image in which the shadow is compensated is depicted in 800A of FIG. 8A. Example grayscale image 800A may include a grayscale image 802 and a flipped copy 804 of grayscale image 802, in which the shadow is compensated. [0050] At 704, upon compensating for the shadow, the appended grayscale image may be rotated back by the determined orientation (e.g., orientation angle 410 as shown in FIG. 4F) to generate the appended grayscale image in an actual orientation. An example appended grayscale image in the actual orientation without the shadow is depicted in 800B of FIG. 8B. At 706, the flipped copy (e.g., flipped copy 804 as shown in FIG. 8B) of the grayscale image may be detached from the re-rotated grayscale image, upon detaching the flipped copy of the grayscale image, at 708, the output image may be generated by converting the grayscale image to a color image, for instance, using the chroma components (Cb and Cr). An example output image 400H is depicted in FIG. 4H. Thus, example method 700 may perform luminance correction. For example, the shadow- compensated grayscale image may be obtained by dividing the shadow map from the rotated grayscale image. Then, chroma channels (Cr and Cb) are combined with the shadow corrected luminance image (Y). Further, the shadow corrected output image is converted from YCbCr to RGB color space to get final output image.
[0051] Example method 300, 500, or 700 depicted in FIG. 3, 5, or 7 represents generalized illustrations, and that other processes may be added, or existing processes may be removed, modified, or rearranged without departing from the scope and spirit of the present application. In addition, the processes may represent instructions stored on a computer-readable storage medium that, when executed, may cause a processor to respond, to perform actions, to change states, and/or to make decisions. The processes of method 300, 500, or 700 may represent functions and/or actions performed by functionally equivalent circuits like analog circuits, digital signal processing circuits, application specific integrated circuits (ASICs), or other hardware components associated with the system. Furthermore, example method 300, 500, or 700 may not be intended to limit the implementation of the present application, but rather example method 300, 500, or 700 illustrates functional information to design/fabricate circuits, generate machine-readable instructions, or use a combination of hardware and machine- readable instructions to perform the illustrated processes. [0052] FIG. 9 is a block diagram of an example image acquisition device 900 including a non-transitory machine-readable storage medium 904 storing instructions to generate an output image by compensating for a non-uniform shadow in a grayscale image. Image acquisition device 900 may include a processor 902 and machine-readable storage medium 904 communicatively coupled through a system bus. Processor 902 may be any type of central processing unit (CPU), microprocessor, or processing logic that interprets and executes machine-readable instructions stored in machine-readable storage medium 904.
[0053] Machine-readable storage medium 904 may be a random-access memory (RAM) or another type of dynamic storage device that may store information and machine-readable instructions that may be executed by processor 902. For example, machine-readable storage medium 904 may be synchronous DRAM (SDRAM), double data rate (DDR), rambus DRAM (RDRAM), rambus RAM, etc., or storage memory media such as a floppy disk, a hard disk, a CD-ROM, a DVD, a pen drive, and the like. In an example, machine-readable storage medium 904 may be non-transitory machine-readable medium. Machine-readable storage medium 904 may be remote but accessible to image acquisition device 900.
[0054] As shown in FIG. 9, machine-readable storage medium 904 may store instructions 906-918. In an example, instructions 906-918 may be executed by processor 902 to generate an output image by compensating for a non-uniform shadow in the grayscale image. Instructions 906 may be executed by processor 902 to receive a grayscale image having a non-uniform shadow that spans across a crease region.
[0055] Instructions 908 may be executed by processor 902 to convert the grayscale image into a binary image. Instructions 910 may be executed by processor 902 to generate a flipped copy of the binary image. Instructions 912 may be executed by processor 902 to append the flipped copy of the binary image to a side of the binary image based on the crease region. [0056] Instructions 914 may be executed by processor 902 to determine an orientation of the shadow in the appended binary image. In an example, instructions to determine the orientation of the shadow may include instructions to: o perform a morphological opening operation on the appended binary image to retain a shape of the shadow, o position an oriented and maximum area rectangle inscribed within the shadow, and o determine the orientation of the shadow in the appended binary image based on an orientation of the maximum area rectangle.
[0057] Instructions 916 may be executed by processor 902 to generate a shadow map by converting the non-uniform shadow to a substantially uniform shadow based on the orientation. In an example, instructions to generate the shadow map by converting the non-uniform shadow to the substantially uniform shadow may include instructions to: o generate a flipped copy of the grayscale image, o append the flipped copy of the grayscale image to a side of the grayscale image based on the crease region, o rotate the appended grayscale image by the determined orientation to make the shadow substantially uniform across the crease region, and o generate the shadow map of the appended grayscale image. The shadow map may include the substantially uniform shadow.
[0058] In an example, instructions to generate the shadow map may include instructions to determine a size of a structural element to perform a morphological closing operation and generate the shadow map by performing the morphological closing operation on the rotated grayscale image using the structural element with the determined size. In an example, the size of the structural element may be determined by: o removing an outlier from the grayscale image, o filter the shadow on the grayscale image using a variance filter to output a blob corresponding to each foreground element on the grayscale image and a size of each blob, o measure a height of each blob, and o determine a height of a blob having a maximum value as the size of the structural element.
[0059] Instructions 918 may be executed by processor 902 to generate an output image by compensating for the non-uniform shadow in the grayscale image using the shadow map. In an example, instructions 918 to generate the output image may include instructions to: o compensate for the shadow in the appended grayscale image using the shadow map, o upon compensating for the shadow in the appended grayscale image, rotate back the appended grayscale image by the determined orientation to generate the appended grayscale image in an actual orientation, and o detach the flipped copy of the grayscale image from the rotated back grayscale image to generate the output image.
[0060] Examples described herein may generate an output image by compensating for multiple shadows (e.g., shadow at different locations such as a central region, a side region corresponding to a binding portion, or the like) from an input image, for instance, as depicted in FIGs. 10A and 10B. FIG. 10A may depict an input image 1000A having multiple shadows, i.e., a first shadow 1002 at a curl/fold region and a second shadow 1004 at a crease region (e.g., a binding part of an unfolded book). In an example, the morphological closing operation with a structural element as described with respect to FIG. 1 may compensate for first shadow 1002 in the input image. Further, correcting an orientation of second shadow 1004 at the crease region in combination with the morphological closing operation with the structural element as described with respect to FIGs. 3 and 9 may compensate for first shadow 1002 and second shadow 1004 in input image 1000A. In this example, a shadow map for the input image may include both first shadow 1002 and second shadow 1004, which can be compensated in input image 1000A to generate an output image. An example output image 1000B corresponding to input mage 1000A without first shadow 1002 and second shadow 1004 is depicted in FIG. 10B. Thus, examples described in FIGs. 3 and 9 may correct shadows in a binding portion on a scan image of an unfolded book as well as shadows in other portions (e.g., curl regions) of the scan image.
[0061] The above-described examples are for the purpose of illustration. Although the above examples have been described in conjunction with example implementations thereof, numerous modifications may be possible without materially departing from the teachings of the subject matter described herein. Other substitutions, modifications, and changes may be made without departing from the spirit of the subject matter. Also, the features disclosed in this specification (including any accompanying claims, abstract, and drawings), and/or any method or process so disclosed, may be combined in any combination, except combinations where some of such features are mutually exclusive.
[0062] The terms “include,” “have,” and variations thereof, as used herein, have the same meaning as the term “comprise” or appropriate variation thereof. Furthermore, the term “based on”, as used herein, means “based at least in part on.” Thus, a feature that is described as based on some stimulus can be based on the stimulus or a combination of stimuli including the stimulus. In addition, the terms “first” and “second” are used to identify individual elements and may not meant to designate an order or number of those elements.
[0063] The present description has been shown and described with reference to the foregoing examples. It is understood, however, that other forms, details, and examples can be made without departing from the spirit and scope of the present subject matter that is defined in the following claims.

Claims

WHAT IS CLAIMED IS:
1. An image acquisition device comprising: a processor; and a memory comprising a shadow correction module to: receive an input image having a shadow; convert the input image into a grayscale image; determine a foreground element on the grayscale image having a maximum height; generate a shadow map by performing a morphological closing operation on the grayscale image using a structural element having a dimension corresponding to the maximum height; and generate an output image by compensating for the shadow in the input image using the shadow map.
2. The image acquisition device of claim 1 , wherein the shadow correction module is to: remove an outlier from the grayscale image; filter the shadow on the grayscale image using a variance filter to output a blob corresponding to each foreground element on the grayscale image and a size of each blob; measure a height of each blob; and determine the foreground element having the maximum height based on the height of each blob.
3. The image acquisition device of claim 1 , wherein the shadow correction module is to: compensate for the shadow in the grayscale image using the shadow map; and upon compensating for the shadow in the grayscale image, convert the grayscale image into an original format of the input image to generate the output image.
4. The image acquisition device of claim 1 , comprising: a scanner module to scan a document to generate the input image.
5. The image acquisition device of claim 1 , comprising: a camera to capture a document to generate the input image.
6. A method comprising: receiving a scan image including a color scanned page, the scan image comprising a shadow that spans across a crease region; converting the scan image into a grayscale image; converting the grayscale image into a binary image; generating a horizontally and vertically flipped copy of the binary image; appending the flipped copy of the binary image to a side of the binary image based on the crease region; determining an orientation of the shadow in the appended binary image; generating a shadow map of the appended binary image by correcting the orientation of the shadow; and generating an output image by compensating for the shadow in the scan image using the shadow map.
7. The method of claim 6, wherein determining the orientation of the shadow comprises: performing a morphological opening operation on the appended binary image to retain a shape of the shadow; positioning an oriented and maximum area rectangle inscribed within the shadow; and determining the orientation of the shadow in the appended binary image based on an orientation of the maximum area rectangle.
8. The method of claim 6, wherein generating the shadow map of the appended binary image comprises: generating a horizontally and vertically flipped copy of the grayscale image; appending the flipped copy of the grayscale image to a side of the grayscale image based on the crease region; rotating the appended grayscale image by the determined orientation to make the shadow substantially vertical across the crease region; and generating the shadow map by removing content from the rotated grayscale image.
9. The method of claim 8, wherein generating the shadow map comprises: determining a size of a structural element to perform a morphological closing operation, wherein the size of the structural element corresponds to a maximum height of a foreground element on the grayscale image; and generating the shadow map by performing the morphological closing operation on the rotated grayscale image using the structural element with the determined size.
10. The method of claim 9, wherein generating the output image comprises: compensating for the shadow in the rotated grayscale image using the shadow map; upon compensating for the shadow in the rotated grayscale image, rotating back the appended grayscale image by the determined orientation to generate the appended grayscale image in an actual orientation; detaching the flipped copy of the grayscale image from the rotated back grayscale image; and upon detaching the flipped copy of the grayscale image, generating the output image by converting the grayscale image to a color image.
11. A non-transitory computer-readable storage medium storing instructions that, when executed by a processor of an image acquisition device, cause the processor to: receive a grayscale image having a non-uniform shadow that spans across a crease region; - 22 - convert the grayscale image into a binary image; generate a flipped copy of the binary image; append the flipped copy of the binary image to a side of the binary image based on the crease region; determine an orientation of the shadow in the appended binary image; generate a shadow map by converting the non-uniform shadow to a substantially uniform shadow based on the orientation; and generate an output image by compensating for the non-uniform shadow in the grayscale image using the shadow map.
12. The non-transitory computer-readable storage medium of claim 11 , wherein instructions to determine the orientation of the shadow comprise instructions to: perform a morphological opening operation on the appended binary image to retain a shape of the shadow; position an oriented and maximum area rectangle inscribed within the shadow; and determine the orientation of the shadow in the appended binary image based on an orientation of the maximum area rectangle.
13. The non-transitory computer-readable storage medium of claim 11 , wherein instructions to generate the shadow map by converting the non-uniform shadow to the substantially uniform shadow comprise instructions to: generate a flipped copy of the grayscale image; append the flipped copy of the grayscale image to a side of the grayscale image based on the crease region; rotate the appended grayscale image by the determined orientation to make the shadow substantially uniform across the crease region; and generate the shadow map of the appended grayscale image, the shadow map including the substantially uniform shadow. - 23 -
14. The non-transitory computer-readable storage medium of claim 13, wherein instructions to generate the shadow map comprise instructions to: determine a size of a structural element to perform a morphological closing operation, comprises: remove an outlier from the grayscale image; filter the shadow on the grayscale image using a variance filter to output a blob corresponding to each foreground element on the grayscale image and a size of each blob; measure a height of each blob; and determine a height of a blob having a maximum value as the size of the structural element; and generate the shadow map by performing the morphological closing operation on the rotated grayscale image using the structural element with the determined size.
15. The non-transitory computer-readable storage medium of claim 11 , wherein instructions to generate the output image comprise instructions to: compensate for the shadow in the appended grayscale image using the shadow map; upon compensating for the shadow in the appended grayscale image, rotate back the appended grayscale image by the determined orientation to generate the appended grayscale image in an actual orientation; and detach the flipped copy of the grayscale image from the rotated back grayscale image to generate the output image.
PCT/US2021/070900 2021-01-29 2021-07-19 Shadow compensation in images WO2022164575A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
IN202141004085 2021-01-29
IN202141004085 2021-01-29

Publications (1)

Publication Number Publication Date
WO2022164575A1 true WO2022164575A1 (en) 2022-08-04

Family

ID=82653746

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/US2021/070900 WO2022164575A1 (en) 2021-01-29 2021-07-19 Shadow compensation in images

Country Status (1)

Country Link
WO (1) WO2022164575A1 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120294528A1 (en) * 2011-05-19 2012-11-22 Jia Li Method of Detecting and Correcting Digital Images of Books in the Book Spine Area
US20160028921A1 (en) * 2005-03-24 2016-01-28 Kofax, Inc. Systems and methods of processing scanned data

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160028921A1 (en) * 2005-03-24 2016-01-28 Kofax, Inc. Systems and methods of processing scanned data
US20120294528A1 (en) * 2011-05-19 2012-11-22 Jia Li Method of Detecting and Correcting Digital Images of Books in the Book Spine Area

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
GATOS B. ET AL.: "Adaptive degraded document image binarization", PATTERN RECOGNITION, vol. 39, 2006, pages 317 - 327, XP005213674, DOI: 10.1016/j.patcog. 2005.09.01 0 *
JIN YUWEI, XU WENBO, HU ZHONGWEN, JIA HAITAO, LUO XIN, SHAO DONGHANG: "GSCA-UNet: Towards Automatic Shadow Detection in Urban Aerial Imagery with Global-Spatial-Context Attention Module", REMOTE SENSING, vol. 12, no. 17, 3 September 2020 (2020-09-03), CH , pages 2864, 1 - 2864, 23, XP009538937, ISSN: 2072-4292, DOI: 10.3390/rs12172864 *

Similar Documents

Publication Publication Date Title
JP6216871B2 (en) Document boundary detection method
JP4261005B2 (en) Region-based image binarization system
JP5810628B2 (en) Image processing apparatus and image processing program
CN110536040B (en) Image processing apparatus for performing multi-cropping processing, method of generating image, and medium
JP5488530B2 (en) Image processing apparatus and image processing program
JP4362538B2 (en) Image processing apparatus, image forming apparatus, image transmitting apparatus, image reading apparatus, image processing system, image processing method, image processing program, and recording medium thereof
US20180184012A1 (en) Image processing apparatus, control method, and storage medium
US11120530B2 (en) Image processing apparatus, image processing method, and storage medium
JP5782838B2 (en) Image processing apparatus and image processing program
JP5541679B2 (en) Image processing apparatus and method, and program
US20070269109A1 (en) Method and apparatus for processing selected images on image reproduction machines
US8411940B2 (en) Method for fast up-scaling of color images and method for interpretation of digitally acquired documents
KR20100032279A (en) Image processing apparatus, image forming apparatus and computer readable medium
JP2015015599A (en) Image processing apparatus, image forming apparatus, image processing method, and program and recording medium of the same
TW384612B (en) Image processing system and method capable of converting gray-level images into binary images
WO2022164575A1 (en) Shadow compensation in images
JP2010186246A (en) Image processing apparatus, method, and program
CN111445402A (en) Image denoising method and device
CN101197913B (en) Image processing apparatus and control method
US9648208B2 (en) Method and apparatus and using an enlargement operation to reduce visually detected defects in an image
JP2007166431A (en) Unit and method for processing image, program, and storage medium storing the same
JP2013045205A (en) Image processor, image processing method and image processing program
Konya et al. Adaptive methods for robust document image understanding
JP2001222717A (en) Document image recognition method and system, and computer readable recording medium
CN112991470B (en) Certificate photo background color checking method and system under complex background

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: 21923576

Country of ref document: EP

Kind code of ref document: A1