# Patent

## Title
Generating an erosion image utilizing parallel pixel processing

## Abstract

An erosion image is generated from an original digital image utilizing a processing image (b) and a target image (T), where each pixel in the target image is processed in parallel. The process entails, for each target pixel, i) determining coordinate values for the target pixel, ii) determining a surrounding pixel area for the target pixel, iii) and processing each pixel in the surrounding pixel area to determine whether or not to updated the value of the target pixel. In processing each surrounding pixel, a determination is made whether the pixel has a value of 1. If not, then the next surrounding pixel is processed. If so, then a determination is made which pixel element of a structuring element overlays the target pixel, and whether that SE pixel has a value of 1. If so, then the value of the target pixel is updated. If not, then the next pixel in the surrounding pixel area is processed. Once the target pixel has been updated a set number of times to a predetermined value (e.g., 2), the processing of the remaining surrounding pixels is terminated. After all target pixels have been processed, an output image is obtained by setting target pixels having a value of 2 to a binary value of 1, and setting the other pixels to a binary value of 0. The resultant output image is an erosion image that is then output.

## Background
BACKGROUND OF THE INVENTION
1. Field of the Invention
The invention generally relates to image processing techniques for generating an erosion image, and more specifically relates to performing morphology of a digital image utilizing parallel binarization processing of each pixel of an image, and performing parallel processing of each pixel in a target image to obtain an erosion image.
2. Description of the Related Art
Conventionally, an erosion image is generated from an input image in four steps: binarization, extension, erosion, and clipping, where each step is performed sequentially and the binarization and erosion processes are performed on each pixel of the input image in sequence. For example, in the binarization step, each pixel of the input image is binarized in sequence utilizing a threshold value for each pixel. The result is a binarized image in which each pixel is represented by either a 0 or a 1. The binarization process typically is performed by scanning each row of the input image from left to right to process each pixel in sequence, then processing the next row of pixels from left to right, etc. until all rows have been processed. An example of a conventional binarization process of an input image is shown in FIG. 1A where a threshold value (T=4) is utilized. In the extension step, additional pixels are added to the boundaries of the binarized image according to the dimensions (height and width) of a Structuring Element (SE) and the location of the origin thereof, which is utilized for the erosion process. Thus, the extended image is a binary image that is larger in size than the original binary image obtained by binarizing the input image. Two example types of structuring elements are shown in FIG. 1B, while an example of an extension process is shown in FIG. 1C.
The conventional erosion process is then performed on each pixel of the extended binary image in sequence, much like the binarization step processes each pixel in sequence. Thus, the conventional erosion process can be time consuming depending on the size of the image. In more detail, in the erosion process, the extended binary image is first utilized to create a processing image, where each pixel of the binary image that includes a value of 1 is identified as a pixel of interest. FIG. 1D depicts an example of a conventional process for obtaining a processing image. The structuring element is then used to generate the erosion image from the processing image. FIGS. 1E and 1F depict a conventional sequential erosion process, which will now be described in detail.
In the conventional sequential erosion process, the structuring element is applied to each pixel in sequence, with the origin of the SE being placed upon the pixel being processed. The first row of the processing image is scanned, left to right, in sequence. Pixels surrounding the first pixel of interest are then processed in sequence utilizing the overlapping pixels of the structuring element so that the value of each pixel of the processing image in which an overlapping pixel of the structuring element that includes a 1 is updated by 1. Each pixel in the first row is scanned in sequence for pixels of interest with the inverted structuring element being translated across the row accordingly. Once each pixel in the first row of the processing image has been processed in sequence, the second row of the processing image is processed, left to right, in the same manner. This sequential erosion image processing continues until each row of the processing image has been processed.
After the erosion image has been generated, the erosion image is clipped by deleting the pixels added in the extension process. In this regard, the additional extended pixels are required to be processed in the sequential processing, thereby adding additional processing time. Each pixel in the erosion image with a value of 1 is then ignored, while pixels with a value of 2 or more are retained, thereby resulting in an eroded image that has less object pixels (pixels with a value of 1) than the original input image. The clipped image is then output as the final resulting image. An example of the clipping process is depicted in FIG. 1G.
One problem with the foregoing conventional erosion image process is that each pixel of the image is processed sequentially during both the binarization process and during the erosion processes. Another problem is that the binarization, extension, erosion and clipping process are each performed in sequence. As a result, the time needed to generate the erosion image increases with the size of the digital image. Thus, very high resolution images (e.g., a 2048×2048, or 2K×2K, pixel digital image) require a greater amount of time to process. For instance, it has been found that the foregoing conventional sequential process applied to a 2K×2K image was able to process 0.20 frames per sec (fps), or approximately 5 seconds to process one frame. As will be described below, the invention has been found to result in the ability to process approximately 250 frames per second., or 0.004 seconds to process one frame.
SUMMARY OF THE INVENTION
The present invention addresses the foregoing by providing a parallel process for generating an erosion image from an original image. According to the invention, an original digital image having a plurality of pixels is input. From the original image, an extended-binarized image is generated. In generating the extended-binarized image, each of the plurality of pixels are binarized in parallel. The extended-binarized image is then processed to obtain an output (erosion) image. One feature of the invention is that, in processing the extended-binarized image for dilation processing, each pixel is processed in parallel rather than in sequence. That is, each pixel is processed concurrently rather than being processed in sequence as discussed above for the conventional technique. The parallel processing results in essentially the same output image as that resulting from the conventional sequential processing technique, albeit obtained much faster than the conventional technique.
In processing the extended-binarized image to generate the erosion image, a processing image is obtained. The processing image is the same size as the extended-binarized image, and is obtained from the extended-binarized image by resetting the values of each pixel in the extended-binarized image to zero, while identifying those pixels in the extended-binarized image having a value of 1 as a pixel of interest. A target image is then set up, where the target image is the same size as the input image, but each pixel is initially blank and, as to be described in more detail below, the value of each target pixel is updated during the processing.
In generating the erosion image, the processing image, the target image and a structuring element are utilized. Thus, there are three sets of pixel coordinate values taken into consideration in the calculations: the processing image (b) coordinate values, the target image (T) coordinate values, and the structuring element (SE) coordinate values. Each pixel in the target image is processed individually and concurrently in the following manner. First, the coordinate values for the target pixel being processed are obtained in the target coordinate system. A determination is made of a surrounding pixel area in the processing image surrounding the target pixel. The determination is made based on the coordinate values for the target pixel and the size of the structuring element. Each pixel in the surrounding pixel area is processed in a predetermined order to determine whether or not to update the value of the target pixel. That is, a determination is first made to see if the surrounding pixel was identified as a pixel of interest in the processing image. If not, then the next surrounding pixel is processed. When any surrounding pixel has been found to have been identified as a pixel of interest, a calculation is performed to see which pixel element of the structuring element overlays the target pixel and a determination is made whether that SE pixel element has a value of one. If so, then it is determined to update the value of the target pixel. If not, then the target pixel is not updated and the next surrounding pixel is processed. If, when processing any surrounding pixel it is determined that the value of the target pixel is to be updated, then the update is performed. In this case, a determination is then made whether the current updated value of the target pixel has reached a predetermined value (N). As an example, N may be set to be equal to the number of SE pixels that have a value of 1, and so for a 2×2 SE in which two pixel have a value of 1, N would be set to 2. If the current updated value of the target pixel is found to be equal to N, then there is no need to process the remaining pixels in the surrounding pixel area and the remaining pixels are therefore ignored and the processing of the remaining pixels in the surrounding pixel area is terminated. If, however, the currently updated value is less than N, then remaining pixels in the surrounding pixel area are processed until the updated value of the target pixel reaches N or until all surrounding pixels have been processed. Then, pixels in the target image whose value has been updated to N are set to a first binary value (e.g., 1) and pixels in the target image whose updated value is less than N are set to be a second binary value (e.g., 0). The result is a generated erosion image which is then output as an output image.
By virtue of the foregoing arrangement, it is possible to generate an erosion image from a corresponding input digital image faster than with a traditional sequential approach, enabling real-time, fast fps, hi-resolution image processing and analysis, while producing an erosion image substantially similar to an erosion image produced using a traditional sequential approach. For example, by utilizing parallel processing to generate an erosion image according to the foregoing arrangement, a 2K×2K digital image can be processed at speeds of 250 fps, which is much faster than the 0.20 fps obtained by the traditional sequential approach.
Thus, in one aspect, the invention is directed to a digital image processing method implemented in a computer for generating an erosion image from a corresponding original digital image having a plurality of pixels. The method comprises inputting the original digital image and generating an extended binary image by adding pixels to a boundary of the original image based on a structuring element. The extended image is binarized, utilizing a threshold value, with each of the plurality of pixels of the original digital image and the pixels added to the boundary being binarized in parallel. A processing image (b) is obtained from the extended binary image, wherein each pixel in the extended binary image having a value of 1 is identified as a pixel of interest in the processing image (b). A target image (T) is also obtained from the extended binarized image, the target image being a same size as the original input image. An erosion image is then generated utilizing the processing image (b) and the target image (T), where the erosion image is obtained by processing each target pixel in the target image in parallel by performing the following steps on the target pixel.
First, coordinate values for the target pixel in the target image (T) are obtained. A surrounding pixel area is determined in the processing image (b) surrounding a processing image pixel corresponding to the target pixel, the determination being made based on the coordinate values (TCol, TRow) for the target pixel and a size (height and width) of a structuring element. Each pixel in the surrounding pixel area is processed in a predetermined order to determine whether or not to update the value of the target pixel. The processing on each pixel in the surrounding pixel area is performed by determining whether or not a current pixel of the surrounding pixel area being processed has been identified as a pixel of interest in the processing image. In a case where it is determined that the current pixel has not been identified as a pixel of interest, then it is determined that the target pixel is not to be updated based on processing of the current pixel in the surrounding pixel area, and processing of a next surrounding pixel in the predetermined order commences. For the next pixel, the process returns to the pixel of interest determination step. In a case where it is determined that the current surrounding pixel has been identified as a pixel of interest, then the following steps are performed.
A determination is made as to which pixel element in the structuring element overlays the target pixel when an origin of the structuring element is located at the current surrounding pixel. A pixel value is obtained for the structuring element pixel element determined as overlaying the target pixel, and a determination is made whether or not to update the value of the target pixel based on the obtained pixel value for the structuring element pixel. If the obtained pixel value is a first value (e.g., 0), a determination is made not to update the target pixel and processing commences for a next surrounding pixel in the predetermined order, thereby returning to the pixel of interest determination step for the next surrounding pixel. If, however, the obtained pixel value is a second value (e.g., 1), a determination is made to update the value of the target pixel. The value of the target pixel is thereby updated. Then, a determination is made whether or not the updated value of the target pixel is equal to a predetermined value (N). If the updated value of the target pixel is equal to the predetermined value (N), then processing of remaining pixels in the surrounding pixel area is terminated and the value of the target pixel in the target image is set as the predetermined value (N). If, however, the updated value of the target pixel is less than the predetermined value (N) and where all surrounding pixels have been processed, then the value of the target pixel in the target image is set based on the number of updates (if any) that have been performed. If the updated value of the target pixel is less than the predetermined value (N) and additional surrounding pixels remain to be processed, the processing returns to the pixel of interest determination step for a next pixel of the surrounding pixels to be processed in the predetermined order.
Once all of the target pixels have been processed an the values of the target pixels in the target image have been set based on the updating, an output image is obtained. The output image is obtained by setting a value of pixels in the updated target image having the predetermined value (N) to a first binary value (e.g., 1) and setting pixels in the updated target image having an updated value less than the predetermined value (N) to a second binary value (e.g. 0), thereby resulting an erosion image. The erosion image is then output.
The invention can be utilized to remove pixels from a digital image. For example, thick objects or lines can be thinned for better viewing. This process may be useful in, for example, the reading of X-rays where large or obscure objects may need to be thinned for better viewing in the image.
This brief summary has been provided so that the nature of the invention may be understood quickly. A more complete understanding of the invention can be obtained by reference to the following detailed description of the preferred embodiments thereof in connection with the attached drawings.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1A depicts an example of a conventional binarization process of an input image.
FIG. 1B depicts examples of a structuring element.
FIG. 1C depicts an example of a conventional extension process.
FIG. 1D depicts an example of a conventional process for obtaining a processing image.
FIGS. 1E and 1F depict a conventional sequential erosion process.
FIG. 1G depicts an example of a conventional clipping process and conversion of a processing image to an output image.
FIG. 2 depicts one example computing environment in which the invention may be implemented.
FIG. 3 depicts an example of an internal architecture of a computer workstation.
FIG. 4 depicts an example of an internal architecture of a server.
FIG. 5 depicts an example of an internal architecture of a printer.
FIG. 6 is an example input image to be processed according to the invention.
FIG. 7 is an example of a structuring element (SE) used in processing the input image according to the invention.
FIG. 8 is one example of an extended image for processing according to the invention.
FIG. 9 is one example binarization process for a first type of extended image in the processing of the invention.
FIG. 10 is a second example binarization process for a second type of extended image in the processing of the invention.
FIG. 11 is a third example binarization process for a third type of extended image in the processing of the invention.
FIG. 12A depicts an example of a processing image, and an overlaid target image, for processing according to the invention.
FIGS. 12B to 12E depict an example processing of one pixel in the target image.
FIG. 13 is an example after processing of the target image according to the invention.
FIG. 14 is an example erosion (output) image after processing according to the invention.
FIGS. 15 and 16 are flowcharts depicting a processing flow for generating an erosion image according to the invention.



DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
FIG. 2 depicts an example of a computing environment in which the invention may be employed. Briefly, the invention is directed to performing image processing to generate and output an erosion image from an original input image. By way of example, various implementations of the invention may be inputting an original image from any one of a number of devices, such as a digital image generated by an x-ray machine, a tomogram, satellite image, digital photograph, or virtually any digital image source, and then applying the process of the invention to the input original image to obtain an erosion (thinned-out) image that is then output to a display device, a printer, etc. Thus, as seen in FIG. 2, the invention may be employed in an environment that includes personal computer workstation 10 or laptop computer 20 that may be connected to a network 11 which is preferably a world wide network such as the Internet, but may also be local area network (LAN). In this manner, computer workstation 10 or laptop 20 can communicate with any of various servers or other devices connected to the network. For example, computer workstation 10 may communicate with any of devices 12 to 14, which may be servers, x-ray machines, or any type of device which generates or stores digital images. Of course, devices 12 to 14 are not necessarily the only devices/servers that may be connected to the network and numerous additional devices/servers may also be included. Rather, devices/servers 12 to 14 are merely representative examples and are depicted in FIG. 2 merely for illustrative purposes.
Computer 10 may also be connected locally to printer 30, either via a local connection or via a local area network connection (not shown). Printer 30 may be any type of printing device that prints images. For example, printer 30 may be a laser or bubble-jet printer, and may also be a multi-function device which is capable of operating as both a printer and a facsimile device. As will be described in more detail below, printer 30 communicates with computer 10 to receive print data for printing an erosion (output) image. Of course, as will be described in more detail below, the erosion image may be output to a display screen of computer 10, or may be transmitted over the network to any one of devices 12 to 14.
FIG. 3 is a block diagram showing an example of the internal architecture of a computer workstation, such as workstation 10. In FIG. 3, workstation 10 is seen to include central processing unit (CPU) 210 such as a programmable microprocessor which is interfaced to computer bus 200. A graphics processing unit (CPU) 215 is also coupled to computer bus 2300, where the CPU controls a graphical display program for displaying graphics on a display device. In particular, GPU 215 may implement the graphics processing of the invention so as to control displaying an erosion image on a display device, which will be described in more detail below. Also coupled to computer bus 200 are keyboard interface 220 for interfacing to a keyboard, mouse interface 230 for interfacing to a mouse or other pointing device, floppy disk interface 240 for interfacing to a floppy disk, CD-ROM drive (not shown), flash drive, etc., display interface 250 for interfacing to a monitor or other display device, and network interface 260 for interfacing to a network, such as Internet 11. Interface 260 may be, for example, a 56K modem, a DSL modem, a cable modem, an Ethernet card that may or may not communicate with an external modem, a wireless interface (e.g., Bluetooth interface, infrared interface), etc.
Random access memory (RAM) 270 interfaces to computer bus 200 to provide CPU 210 with access to memory storage, thereby acting as the main run-time memory for CPU 210. In particular, when executing stored program instruction sequences, such as an erosion program of the invention that may be stored in fixed disk 280, a CD-ROM interfacing with workstation 10, etc., CPU 210 loads those instruction sequences from fixed disk 280 (or other memory media) into RAM 270 and executes those stored program instruction sequences out of RAM 270. It should also be noted that standard disk swapping techniques available under windowing operating systems allow segments of memory to be swapped to and from RAM 270 and fixed disk 280. Read-only memory (ROM) 290 stores invariant instruction sequences, such as start-up instruction sequences for CPU 210 or basic input/output operation system (BIOS) sequences for the operation of peripheral devices (not shown) attached to workstation 10.
Fixed disk 280 is one example of a computer-readable storage (memory) medium that stores program instruction sequences executable by CPU 210. The program instructions may constitute windows operating system 281, printer driver 282, web browser 283, other drivers 284, word processing program 285, and other programs 286. Among other programs 286, the erosion image generating program of the invention may be stored therein to be executed by workstation 10. Operating system 281 is preferably a windows operating system, although other types of operating systems may be used with the present invention. Printer driver 282 is utilized to prepare image data for printing on at least one image forming device, such as printer 30. Web browser application 283 is preferably a browser application such as Windows Internet Explorer®, Mozilla Firefox®, or SafariTM, although other web browser applications may be utilized instead. Other drivers 284 include drivers for each of the remaining interfaces which are coupled to computer bus 200. Word processing program 285 is a typical word processor program for creating documents and images, such as Microsoft® Word, or Corel® WordPerfect documents. Other programs 286 contains other programs necessary to operate workstation 20 and to run desired applications, such as the erosion image generating program of the invention.
FIG. 4 depicts a block diagram showing an overview of the internal architecture of a server, which may correspond to each of devices 12 to 14. In this regard, the internal architecture of these servers may be similar, and the description will be made merely for server 14. In FIG. 4, server 14 is seen to include a central processing unit (CPU) 310 such as a programmable microprocessor which is interfaced to computer bus 300. A graphics processing unit (GPU) 315 is also coupled to computer bus 300, where the GPU controls a graphical display program for displaying graphics on a display device. In particular, GPU 315 may implement the graphics processing of the invention so as to control display an erosion image on a display device, which will be described in more detail below. Also coupled to computer bus 300 is a network interface 360 for interfacing to a network, such as Internet 11. In addition, random access memory (RAM) 370, fixed disk 320, and read-only memory (ROM) 390 are also coupled to computer bus 300. RAM 370 interfaces to computer bus 300 to provide CPU 310 with access to memory storage, thereby acting as the main run-time memory for CPU 310. In particular, when executing stored program instruction sequences, CPU 310 loads those instruction sequences from fixed disk 320 (or other memory media) into RAM 370 and executes those stored program instruction sequences out of RAM 370. It should also be recognized that standard disk-swapping techniques allow segments of memory to be swapped to and from RAM 370 and fixed disk 320. ROM 390 stores invariant instruction sequences, such as start-up instruction sequences for CPU 310 or basic input/output operating system (BIOS) sequences for the operation of peripheral devices which may be attached to server 30 (not shown).
Fixed disk 320 is one example of a computer-readable medium that stores program instruction sequences executable by CPU 310. The program instruction sequences may include operating system 321 and network interface driver 322. Operating system 321 can be an operating system such as Windows XP (or later versions thereof, UNIX, or other such server operating systems. Network interface driver 322 is utilized to drive network interface 360 for interfacing server 14 to network (Internet) 11.
Server 14 also preferably includes FTP/HTTP client 323 to provide server 14 with the ability to retrieve and transmit data files via FTP and HTTP protocols over the network through network interface 360. In addition, FTP/HTTP server 324 can be accessed by an FTP/HTTP client in a workstation such as workstation 10. In this regard, FTP/HTTP server 324 is preferably a web server that can be accessed by web browser application 283 to retrieve and download web pages, which are preferably comprised of an HTML document. A user wanting to access a web site to have a web page downloaded enters a URL (Uniform Resource Locator), or other type of location information where a web page may be stored, in the web browser of workstation 10, whereby the web page (in the form of an HTML document) is received by workstation 10 for display in the web browser.
Server 14 may be coupled to an image sensing device that generates a digital image. For instance, server 14 may be coupled to an x-ray machine, MRI device, or any other type of image generating device that generates a digital image. The generated digital image may be input and stored in the server 14 for later erosion processing according to the invention. In this regard, server 14 may include the erosion processing program in fixed disk 320 and execute the program in same manner as described above with regard to computer workstation 10. Server 14 may also transmit the digital image over the network 11 to workstation 10 for workstation 10 to perform the erosion processing.
FIG. 5 depicts a block diagram showing an example of the internal architecture of a printer, such as printer 30. Printer 30 may receive print data from workstation 10 to be output by the printer. For example, an erosion image generated by computer 10 may be output by a printer driver in computer 10 to printer 30 for printer 30 to print out the erosion image. In FIG. 5, printer 30 is seen to contain a central processing unit (CPU) 410 such as a programmable microprocessor which is interfaced to printer bus 400. Also coupled to printer bus 400 are I/O ports 430 which is used to communicate with various input/output devices of printer 30 (not shown), and network interface 460 which is utilized to interface printer 30 to network 11.
Also coupled to printer bus 400 are EEPROM 440, for containing non-volatile program instructions, random access memory (RAM) 470, printer memory 401 and read-only memory (ROM) 490. RAM 470 interfaces to printer bus 400 to provide CPU 410 with access to memory storage, thereby acting as the main run-time memory for CPU 410. In particular, when executing stored program instruction sequences, CPU 410 loads those instruction sequences from printer memory 401 (or other memory media) into RAM 470 and executes those stored program instruction sequences out of RAM 470. ROM 490 stores invariant instruction sequences, such as start-up instruction sequences for CPU 410 or BIOS sequences for the operation of various peripheral devices of printer 30 (not shown).
Printer memory 401 is one example of a computer-readable medium that stores program instruction sequences executable by CPU 410 so as to constitute printer engine logic 451, I/O port drivers 453, other files 457, and e-mail program 459. Printer engine logic 451 is utilized to drive the printer engine 425 of printer 30 so as to print an image according to image data received by printer 30, preferably over network 11. I/O port drivers 453 are utilized to drive the input and output devices (not shown) connected through I/O ports 430. Other files 457 contain other files and/or programs for the operation of printer 30. Printer memory 401 also includes FTP/HTTP client 495 which provides the ability to retrieve files over the network through network interface 460.
Processing of an input image according to the invention will now be described in more detail with reference to FIGS. 6 to 14. Briefly, an input image is extended and binarized with a parallel binarization process, and a processing image is then obtained from the extended-binarized image, and a target image is set up. The target image is processed utilizing the processing image and a structuring element by processing each pixel in the target image in parallel. That is, each pixel in the target image is processed simultaneously to determine whether or not the value of the target pixel should be updated, taking into consideration pixels surrounding the target pixel. Once each target pixel has been processed and their values updated, an erosion (output) image is obtained and output. Thus, the invention provides an erosion image process that is significantly faster than conventional processes.
Referring now to FIG. 6, shown therein is an example input image 500 that is a 5×8 pixel image, with a color value of each pixel ranging from 0 to 7 being included therein. It is readily understood that the input image depicted in FIG. 6 may be merely a very small portion of an overall image. Many digital images may have a resolution of 300 dpi, 600 dpi, 1200 dpi, 2400 dpi or greater, and depending on the size of the image, a horizontal row or a vertical column of the input image may contain hundreds, thousands, or hundreds of thousands of pixels. For instance, an image that is one inch wide by one inch high, output at 300×300 dpi, would include 300 columns of pixels and 300 rows of pixels, or a total of 90,000 pixels. In contrast, an image that is 10 inches wide by 10 inches tall, and that is output at a resolution of 2400×2400 dpi, would include 24,000 columns of pixels and 24,000 rows of pixels, or a total of 576 million pixels to be processed. Thus, for simplicity, a very small input image is shown in FIG. 6 merely for illustrative purposes. However, as will become apparent, the process of the invention becomes even more advantageous for images with an even greater number of pixels to be processed. Moreover, it should be understood that, while the pixel values of digital images generally range from 0 to 256, 0 to 16,777,215, or any other range, again, merely for simplicity, the pixel values shown in FIG. 6 range from 0 to 7.
As seen in FIG. 6, input image 500 includes eight (8) columns of pixels along a horizontal (X) axis, and includes five (5) rows of pixels along a vertical (Y) axis. The width of the input image (number of columns) can be referred to as Win, while the height of the input image (number of rows) can be referred to as Hin. As is known in the art, digital images are generally set in a zero-based coordinate system, where each pixel of a digital image is generally assigned a coordinate value, and the origin of the input image is located at the top-left most pixel, identified as (0, 0). Each column and row of pixels is numbered for processing purposes and any given pixel may be identified by its coordinate values (x, y). Processing of the input image shown in FIG. 6 will be described below.
FIG. 7 depicts one example of a structuring element (SE) 510 that may be utilized in processing the input image of FIG. 6 to obtain an erosion image. As seen in FIG. 7, the structuring element may be a two-by-two pixel element. The width (number of columns) of the SE may be referred to as Wse, while the height (number of rows) of the SE may be referred to as Hse. The SE pixels (elements) are identified by their SE coordinate values. For instance, SE (0, 0), SE(0, 1), etc. Each pixel of the SE also includes a pixel value, and as seen in FIG. 7, two pixels of the SE (0, 0) and (1, 1) may be assigned a value of 1, and the remaining two pixels (1, 0) and (0, 1) may be assigned a value of zero (0). In addition, one pixel of the SE is set as its origin 511 (identified with an asterisk (*) for illustrative purposes), and in FIG. 7, the origin of the SE has been set to pixel (0, 0). For calculation purposes, as will be described in more detail below, the x coordinate value for the SE origin is referred to as Xmp, while the y coordinate value for the SE origin is referred to as Ymp. It can readily be recognized that many different variations of structuring elements could be employed instead of the two-by-two element shown in FIG. 7. For instance, a 3×3 SE, a 3×4 SE, or any other size SE could be used and the size of the SE employed is a matter of choice for the user based on the desired effect that the user wants for the output image. In addition, the origin of the SE does not need to be set to (0, 0), but could be set for virtually any pixel of the SE. Again, the location of the origin of the SE is a matter of user preference based on the desired output image. For exemplary purposes, the two-by-two pixel structuring element shown in FIG. 7 will be employed for the erosion processing being described herein.
Referring now to FIG. 8, one part of the invention is to perform extension and binarization of the input image. In the extension process, pixels are added to the input image based on the size (height and width) of the structuring element, as well as the location of the origin of the structuring element. Utilizing the SE of FIG. 7, the number of additional rows and columns of pixels to be added to the input image may be determined based on the following equations:

Hex=Hin+Hse−1  eq. 1)

Wex=Win+Wse−1  eq. 2)

where, Hex=height of extended image

    
    
        Wex=width of extended image
        Hin=height of input image
        Win=width of input image
        Hse=height of the structuring element
        Wse=width of the structuring element.

Based on the input image of FIG. 6, where Hin=5, Win=8, and structuring element 510 depicted in FIG. 7 in which Hse=2 and Wse=2, and the foregoing equations 1 and 2, it can be seen that Hex=6 and Wex=9. Thus, one additional row of pixels 520 are added to the input image and one additional column of pixels 521 are added to the input image. Based on the origin of the structuring element of FIG. 7 in which the origin is set at (0, 0), the additional row of pixels is determined to be placed along the top portion of the input image and the addition column of pixels is determined to be placed along the left side of the input image. The extended image is thus depicted in FIG. 8.

    
    


Referring now to FIGS. 9 to 11, a binarization process for binarizing the extended image will be described. In FIGS. 9 to 11, each pixel of the extended image is binarized in parallel. The difference between FIGS. 9 to 11 lies in the type of binarization processing to be applied to the extended pixels, and the type of process used is based on the user's preference. FIG. 9 depicts a first type of binarization process, referred to as a PadType=0 process, where all of the extended pixels are set to zero (0). FIG. 10 depicts a second type of binarization process, referred to as a PadType=1 process, where all of the extended pixels are set to a value of one (1). FIG. 11 depicts a third type of binarization process, referred to as a PadType=2 process, in which the extended pixels are binarized based on the binary value of a pixel in the input image nearest the extended pixel. Regardless of which process is utilized, the result is a extended-binarized image that will be processed further to obtain an erosion image. Each of the foregoing PadType processes will now be described in more detail, but it should be noted that the invention is not limited to any one of these processes and any other type of binarization process could be used.
In relation to FIG. 9, a PadType=0 process will be described. In the PadType=0 process, the following equation is utilized to determine how to binarize any given pixel. For any given pixel in the image, I(x, y), the pixel is binarized as follows depending on the following conditions. If x0≦x<Win+x0 and y0≦y<Hin+y0, then the binarized value for the pixel is B(x−x0, y−y0), where B refers to the pixel of the input image. Otherwise, the binarized value of the pixel is set to 0 (zero). In the foregoing, the values x0 and y0 are obtained from the following equations:

x0=Wse−Xmp−1, and  eq. 3)

y0=Hse−Ymp−1.  eq. 4)

As discussed above, for the SE shown in FIG. 7, Wse=2 and Hse=2. In addition, for the SE shown in FIG. 7, the x coordinate of the origin (Xmp) is 0 (zero) and the y coordinate for the origin (Ymp) is 0 (zero). Thus, utilizing the above formulas,

x0=(2−0−1)=1, and y0=(2−0−1)=1.

Thus, referring back to FIG. 9, in processing pixel I(0, 0), where x=0 and y=0, a test of the first condition reveals that x (=0) is not greater than or equal to x0 (=1), and therefore, the value of pixel (0, 0) is set to zero (0). The second part of the test for pixel (0,0) would also reveal that y (=0) is not greater than or equal to y0 (=1), thereby resulting in the value of pixel (0, 0) being set to 0. However, since the first part of the test for x was not satisfied, it can readily be understood that there is no need to conduct the second part of the test for y. Continuing across the top row of the left-hand image in FIG. 9, it can readily be seen that the first test condition for x will be satisfied, but the second test condition for y would not be satisfied since the y value for each pixel in the top row is 0 (which is not greater than or equal to y0=1). As a result, for PadType=0, each of the extended pixels along the top row in FIG. 9 would be binarized to a value of 0 for the image (I). A similar analysis applies for the left-most column of extended pixels. In particular, the condition for y will be satisfied, but the condition for x will not be satisfied since x=0 for each of these pixels will not be greater than or equal to x0 (=1). Accordingly, each of the extended pixels in the left-most column (where x=0) would also be binarized to a value of 0 in the PadType=0 processing.
Referring again to FIG. 9, it can readily be seen that the remaining pixels of the extended image would satisfy both test conditions for x and y and therefore, would be binarized according to B(x−x0, y−y0). By way of example, referring to pixel I(1, 1) of the extended image, which corresponds to the top-left most pixel of the original (non-extended) input image, the condition test for x reveals that x (=1) is greater than or equal to x0 (=1) and that x is also less than Win+x0 or (8+1=9). The condition test for y reveals that y (=1) is greater than or equal to y0 (=1) and that y is also less than Hin+y0 or (5+1=6). Thus, pixel I(1, 1) of the extended image would be binarized according to the value of the input (binary) image B, and particularly, for pixel (0, 0) of the input image B, based on (x−x0)=(1−1)=0, and (y−y0)=(1−1)=0. As a result, looking to pixel (0, 0) of the input B image, that pixel has a value of 6. Utilizing a threshold (T) of 4 for binarization, the binarized value of pixel B (0, 0)=1, and therefore, the binarized value of pixel I (1, 1)=1.
The foregoing process is performed concurrently (i.e., in parallel) for each pixel in the extended image (i.e., for all of pixels I(0, 0) to I(8, 5)). For brevity, the calculations for each of the remaining pixels is omitted here, but it can readily be seen from FIG. 9 that the following pixels result in a binarized value of 1: I(1, 1), I(3, 1), I(5, 1), I(3, 2), I(6, 2), I(8, 2), I(1,3), I(2, 3), I(3, 4), I(4, 4), I(7, 4), I(8, 4), I(4, 5), I(6, 5), I(7, 5). The resulting binary image for the PadType=0 processing, in which each pixel was processed (binarized) according to the foregoing method in parallel, is shown as the right-hand image in FIG. 9.
A similar process would be utilized if a PadType=1 process of FIG. 10, in which all of the extended pixels are to be set to 1, were employed. That is, the calculation of the extended image size would be the same as described above, the calculations for x0 and y0 would be the same, and the condition tests for x and y of I(x, y) would also be the same. One difference between the PadType=0 process and the PadType=1 process is that, when either of the two conditions for x and y are not satisfied, then the binarized value of the pixel is set to 1 rather than being set to 0 (zero) as in the PadType=0 process. Thus, as seen in the right-hand image of FIG. 10, which depicts the extended-binarized image for a PadType=1 process, pixels I(0, 0) to I(8, 0) as well as pixels I(0, 1) to I(0, 5) would be set to 1, while the remaining pixels would be binarized according to their input image value the same as for the PadType=0 process described above. Like the PadType=0 process, the binarization using the PadType=1 processed is performed in parallel for all pixels of the extended image.
A PadType=2 process will now be described with regard to FIG. 11. In the PadType=2 process, the extended pixels are binarized according to a pixel in the input image nearest the extended pixel. In the PadType=2 process, x0 and y0 are calculated using the same formulas described above and therefore, the values of x0 and y0 are both equal to 1. However, the following conditional tests are used to determine how to binarize any given pixel of the image I(x, y)

If x0≦x<Win+x0,y0≦y<Hin+y0, then B(x−x0,y−y0)  A)

If x<x0,y0≦y<Hin+y0, then B(0, y−y0)  B)

If x≦Win+x0,y0≦y<Hin+y0, then B(Win−1, y−y0)  C)

If x0≦x<Win+x0,y<y0, then B(x−x0,0)  D)

If x0≦x<Win+x0,y≧Hin+y0, then B(x−x0, Hin−1)  E)

If x<x0,y<y0, then B(0,0)  F)

If x<x0,y≧Hin+y0, then B(0, Hin−1)  G)

If x≧Win+x0,y<y0, then B(Win−1,0)  H)

If x≧Win+x0,y≧Hin+y0, then B(Win−1, Hin−1)  I)

For pixel I(0, 0), which is an extended pixel, it can readily be seen that condition F is met since x=0 and y=0, both of which are less than x0 and y0, respectively. Accordingly, the binarized value of pixel I(0, 0) is equal to B(0, 0) (i.e., the binarized value of pixel (0, 0) for the input image). Thus, by referring to pixel B(0, 0) of the input image, it can be seen that the input image value of 6 is binarized to 1 based on the threshold (T) value of 4. Thus, I(0, 0) is also binarized to a value of 1 based on the binarized value of the nearest pixel in the input image B.
For pixel I(1, 0), where x=1, y=0, it can be seen that condition D is met. Thus, pixel I(1, 0), which is also an extended pixel, is binarized to the value of B(x−x0, 0), or B(0, 0), which as described above, has a binary value of 1. Similarly, for pixel I(0, 1), which is also an extended pixel, it can be seen that condition B is met. Thus, pixel I(0, 1) is binarized to the value of B(0, y−y0), or B(0, 0), which as described above, has a binary value of 1. Each pixel in the image I is processed in parallel in like manner by determining which of the conditions A to I are met for the pixel, with the pixel being binarized according to the determined condition. The resulting extended-binarized image for the PadType=2 process is shown as the right-hand image in FIG. 11. An erosion process for generating an erosion image will now be described and the extended-binarized image shown in FIG. 11 will be utilized for generating the erosion image.
An initial step in generating an erosion image is to obtain a processing (b) image from the extended-binarized image. The processing image is an image in which pixels of interest are identified, where the pixels of interest are those pixels in the extended-binarized image having a binary value of 1. The pixel values of all pixels in the processing image are reset to zero (0), but the pixels of interest are identified therein. In FIG. 12A, the pixels of interest are shown, for visual purposes, with a circle, and it can readily be seen that the pixel pattern of the pixels of interest identified with a circle in FIG. 12A matches the pixel pattern of pixels having a value of 1 in FIG. 11. While the circles in FIG. 12A are utilized for visual purposes, those skilled in the art readily recognize that, in performing the mathematical calculations discussed below in practicing the invention, the pixels of interest are identified based on their zero-base coordinate values.
In the following discussion for generating an erosion image, it is to be noted that three different sets of coordinate values are included in the calculations. A first set of coordinate values is with reference to the processing (b) image shown in FIG. 12A having the pixels of interest identified. The processing image is referred to in the calculations as the “b” image and as shown in FIG. 12A, image b has nine (9) columns of pixels (numbered 0 to 8) and six (6) rows of pixels (numbered 0 to 5). Thus, in the following calculations, bCol=0 would refer to any pixel in image b having an x value of 0, bCol=1 would refer to any pixel in image b having an x value of 1, etc., while bRow=0 would refer to any pixel in image b having ay value of 0, bRow=1 would refer to any pixel in image b having a y value of 1, etc. Accordingly, a pixel identified in the calculations by (bCol, bRow)=(0, 0), would refer to pixel (0, 0) in the b image.
A second set of coordinate values used in the calculations refers to a target image (T). Shown as an overlay in FIG. 12A is the target image (identified by the large-dashed lines). The target image (T) is the same size as the input image and is initially set up with all pixels being blank. After processing, the target image will become the output image. Thus, for the target image, the extended pixels have been clipped and only the pixels within the input image range for the target image will be processed, thereby saving additional processing time by not requiring processing of the extended pixels, which is required in the conventional sequential process. In the calculations, TCol=0 would refer to any pixel in the target image having an x value of 0, etc., while TRow=0 would refer to any pixel in the target image having a y value of 0, etc. The target image, like image b, is a zero-base image and therefore, the top-left most pixel of the target image has coordinate values of T(0, 0). Therefore, it should be understood that, in FIG. 12A, the x and y axes and values depicted therein are for the b image. Nonetheless, by referring to the target image overlay in FIG. 12A, it can be seen that (bCol, bRow)=b(1, 1) corresponds to (TCol, TRow)=T(0, 0) since the extended pixels were added to the top and left of the input image.
A third set of coordinate values utilized in the calculations refer to the coordinates of the structuring element (SE). The SE has been discussed above, and for the present example, a 2×2 SE with its origin at SE(0, 0). In the calculations, seCol refers to the x values of any pixel in the SE, while seRow refers to the y value of any pixel in the SE. Therefore, (seCol, seRow)=(0, 0) refers to pixel (0, 0) of the SE.
In performing the erosion processing, the target image is processed in conjunction with the b image and the SE. Each pixel in the target image is processed in parallel utilizing the same process to be described below. In the processing, it is possible that an overlay of the SE onto one or more pixels surrounding the current target pixel may have an affect on the final value of the target pixel. Thus, the surrounding pixels need to be taken into consideration. Resolving this issue is unique to the invention. In the conventional sequential process described above, this process is not utilized since the values of each pixel is incremented according to the overlay of the SE at any pixel in the sequential processing, and then the value incremented again based on a subsequent overlay of an element of the SE when another pixel is processed in sequence. In the invention, however, since each target pixel is processed in parallel, a procedure is needed to take the surrounding pixels and the overlay of the SE onto those surrounding pixels into consideration and the inventors herein have discovered the following unique process to enable parallel processing of each pixel in the target image. In addition, as will become apparent from the following discussion, the extended pixels need not be processed as target pixels and can therefore be clipped from the target image. The conventional sequential process however, necessarily must process the extended pixels in sequence in order to obtain an accurate output image. Of course, at least some of the extended pixels may fall within a surrounding pixel area for a target pixel and therefore would be included as part of the target pixel value calculations, but a calculation of the value for the extended pixel itself need not be performed. Accordingly, the invention processes the target image while referring to the processing image b in the processing of the target image in order to take the extended pixels into consideration, if necessary.
Referring again to the drawings, a parallel erosion process will be described with regard to FIGS. 12A to 12E. In these figures, a process will be described for processing of target pixel in the target image (pixel T(0, 0)), but the process described below is applied in parallel to each target pixel in the target image.
As a first step in processing any target pixel, the surrounding pixel boundary area in the processing image is determined utilizing the following calculations:

xStart=TCol

xEnd=xStart+Wse−1

yStart=TRow

yEnd=yStart+Hse−1

where TCol and TRow are the x and y coordinates of the target pixel being processed. xStart identifies a starting column for the surrounding pixel area in the b image, xEnd identifies an ending column for the surrounding pixel area in the b image, yStart identifies a starting row for the surrounding pixel area in the b image, and yEnd identifies an ending row for the surrounding pixel area in the b image. It should be noted that part of the surrounding pixel area determined from these calculations encompasses the target pixel itself. Since the target pixel being processed is T(0, 0), TCol=0 and TRow=0, and therefore, in the b image, xStart=0 and yStart=0. xEnd=(0+2−1)=1 (since Wse=2) and yEnd=(0+2−1)=1 (since Hse=2). Accordingly, xStart=0, xEnd=1, yStart=0, and yEnd=1 defines the coordinate values of the surrounding pixel area in the processing (b) image to be taken into consideration for processing target pixel T(0,0). Therefore, as shown by the small-dashed box in the top-left corner of the b image in FIG. 12A, the surrounding pixel boundary area ranges from bCol=0 to bCol=1, and from bRow=0 to bRow=1.
The next step in the process is to mathematically overlay the SE onto each pixel in the surrounding pixel area of the b image to determine whether or not the value of the target pixel is to be updated. In this regard, the pixels in the surrounding pixel area are processed in a predetermined order. Preferably, the order is similar to the sequential processing in which each row is processed left to right, then the next row, etc. Of course, any order of processing could be employed and the left to right, top to bottom processing is merely one example. In processing each pixel in the surrounding pixel area, a determination is first made to see whether the surrounding pixel has a value of 1. That is, a determination is made whether or not the surrounding pixel was identified as a pixel of interest in the processing (b) image. If so, then a hit (value=1) is determined and the SE is mathematically overlaid with its origin located at the hit pixel and processing is performed to determine whether or not the value of the target pixel is to be updated. That is, calculations are performed to determine which pixel element of the SE overlays the target pixel when the origin of the SE is located at the current surrounding pixel. Then, once the overlaying SE element has been determined, if the SE element has a value of 1, a determination is made that the target pixel is to be updated, but if the SE element has a value of 0, a determination is made that the target pixel is not to be updated. As a visual, in FIG. 12A, it can be seen that, in the surrounding pixel area, the first pixel to be processed is pixel b(0, 0). It can be seen that pixel b(0, 0) has been identified as a pixel of interest and therefore, a hit (value=1) is found. Therefore, the SE is mathematically overlaid with its origin located at pixel b(0, 0) to see if the target pixel T(0, 0) needs to be updated. Referring to FIG. 12B, the SE is shown visually overlaid with its origin at b(0, 0). It can be seen that SE element (1, 1) is overlaid onto the target pixel T(0, 0). As will be described below, a mathematical calculation is performed that will result in pixel (seCol, seRow)=SE(1, 1) overlaying the target pixel. A determination is then made whether pixel SE(1, 1) has a value of 1, and by referring to the figures, it can be seen that pixel SE(1, 1) does have a value of 1. Thus, it is determined that the value of the target pixel T(0, 0) is to be updated by 1.
In processing of an erosion image, as will be discussed below, all pixels that have been updated to a predetermined value (N) are retained in the output image, while pixels that are not updated to the predetermined value (N) are not retained. Here, retaining a pixel means setting the binary value of the pixel to 1 in the output image, while not retaining a pixel means setting the binary value of the pixel to 0. The predetermined value (N) can be set to any value based on the user's preference for generating the erosion image, but in one example embodiment, N is set to be equal to the number of pixels in the SE having a value of 1. Therefore, in the present example being described, since the SE has two pixels with a value of 1 (pixels SE(0, 0) and SE(1, 1)), N is set to be equal to 2. Accordingly, once a value of a target pixel has been updated to a value of 2 (that is, when the target pixel has been updated twice by processing the surrounding pixels), it is not necessary to check for further updates of the target pixel. That is, further processing of the target pixel can be terminated once the value of the target pixel has been determined to be equal to N. Therefore, after processing of the first pixel b(0, 0) in the surrounding pixel area, a determination is made whether or not the updated value of the target pixel T(0, 0) is equal to N (here, =2). Since the current updated value of target pixel T(0, 0) is 1, the determination result is that the updated value is not equal to N. As a result, processing of the next surrounding pixel commences.
Referring back to 12A, the next pixel in the surrounding pixel area to be processed is pixel b(1, 0). The first step in processing pixel b(1, 0) is to determine whether or not the pixel was identified as a pixel of interest in the b image. As seen in FIG. 12A, pixel b(1, 0) was identified as a pixel of interest. Therefore, the SE is mathematically overlaid onto pixel b(1, 0) to determine whether or not the value of the target pixel T(0, 0) should be updated. The overlay of the SE with its origin located at pixel b(1, 0) is shown visually in FIG. 12C. In FIG. 12C, it can be seen that SE element SE(0, 1) overlays the target pixel T(0, 0) and this calculation is performed mathematically as will be described below. A determination is then made whether SE element SE(0, 1) has a value of 1 in order to determine whether or not to update the value of target pixel T(0, 0). As seen in FIG. 12C, since SE element SE(0, 1) has a value of 0 (zero), it is determined that the value of target pixel T(0, 0) is not to be updated. The determination is then again made whether the value of the target pixel T(0, 0) is equal to N, and since T(0, 0) has only be updated once, resulting in an updated value of 1, the result is negative. Accordingly, the next pixel in the surrounding pixel area is processed.
Referring back again to FIG. 12A, the next pixel in the surrounding pixel area to be processed is pixel b(0, 1). The first step in processing pixel b(0, 1) is to determine whether or not the pixel was identified as a pixel of interest in the b image. As seen in FIG. 12A, pixel b(0, 1) was identified as a pixel of interest. Therefore, the SE is mathematically overlaid with its origin located at pixel b(0, 1) to determine whether or not the value of the target pixel T(0, 0) should be updated. The overlay of the SE with its origin located at pixel b(0, 1) is shown visually in FIG. 12D. In FIG. 12D, it can be seen that SE element SE(1, 0) overlays the target pixel T(0, 0) and this calculation is performed mathematically as will be described below. A determination is then made whether SE element SE(1, 0) has a value of 1 in order to determine whether or not to update the value of target pixel T(0, 0). As seen in FIG. 12D, since SE element SE(1, 0) has a value of 0 (zero), it is determined that the value of target pixel T(0, 0) is not to be updated. The determination is then again made whether the value of the target pixel T(0, 0) is equal to N, and since T(0, 0) has only be updated once, resulting in an updated value of 1, the result is negative. Accordingly, the next pixel in the surrounding pixel area is processed.
Referring back again to FIG. 12A, the next pixel in the surrounding pixel area, which happens to be the last remaining pixel in the surrounding pixel area, to be processed is pixel b(1, 1). The first step in processing pixel b(1, 1) is to determine whether or not the pixel was identified as a pixel of interest in the b image. As seen in FIG. 12A, pixel b(1, 1) was identified as a pixel of interest. Therefore, the SE is mathematically overlaid with its origin located at pixel b(1, 1) to determine whether or not the value of the target pixel T(0, 0) should be updated. The overlay of the SE with its origin located at pixel b(1, 1) is shown visually in FIG. 12E. In FIG. 12E, it can be seen that SE element SE(0, 0) overlays the target pixel T(0, 0) and this calculation is performed mathematically as will be described below. A determination is then made whether SE element SE(0, 0) has a value of 1 in order to determine whether or not to update the value of target pixel T(0, 0). As seen in FIG. 12E, since SE element SE(0, 0) has a value of 1, it is determined that the value of target pixel T(0, 0) is to be updated. Thus, target pixel T(0, 0), has an updated value of 1, is updated a second time to a current value of 2. The determination is then again made whether the value of the target pixel T(0, 0) is equal to N, and since T(0, 0) has now been updated twice, resulting in an updated value of 2, and N has been set to be equal to 2, the result is positive. Accordingly, the processing of any remaining pixels in the surrounding pixel area is terminated and the updated value of the target pixel T(0, 0) is set to 2 in the target image. Of course, with this present example, processing of further pixels would be terminated nonetheless since pixel b(1, 1) is the last pixel in the surrounding pixel area. But in a case where additional surrounding pixels may remain to be processed in the surrounding pixel area, once the updated value of the target pixel reaches the value of N, processing of the remaining surrounding pixels is terminated, thereby saving processing time.
The following pseudo-code can be used to perform the foregoing surrounding pixel iteration process to determine if a hit is found in the surrounding pixel and to determine whether or not the target pixel value needs to be updated when the SE is overlaid on each of the pixels of interest in the surrounding pixel boundary.















int nCounter = 0;



int N = x; //number of 1 pixels in the SE array



for (bRow=yStart; bRow<=yEnd; bRow++)



{



  For (bCol=xStart; bCol<=xEnd; bCol++)



  {



    If ((bCol, bRow) == 1) // Hit - Found 1 in (I)



    {



      seCol = Xmp + ((TCol + X0) − bCol)



      seRow = Ymp + ((TRow + Y0) − bRow)



      If (SE(seCol, seRow) == 1) // Check in SE



      {



        nCounter++;



        if (nCounter == N)



        {



          return 1;



        }



      }



    }



  }



}



return 0;










In this code, a counter is initially set to 0 and a value N is set to be equal to the number of 1 pixels in the SE array. In the example described herein, the SE array contains two pixels with a value of 1 and therefore, N is set to 2. The surrounding pixel area for the target pixel T(TCol, Trow) is processed from bRow=yStart and bCol=xStart, or in the example, from (bCol, bRow)=(0, 0). The code first looks at surrounding pixel (bCol, bRow) to determine whether or not a hit (value=1) is found for that pixel. If not, then the code loops back to increment the value of bCol to move on to the next pixel in the surrounding pixel area. If a hit is found, then a determination is made as to which pixel element of the SE overlays the target pixel. Here, it should be noted that the discussion above indicated that the SE is overlaid on the target pixel. However, those skilled in the art readily understand that the foregoing description and depiction in the drawings is merely for illustrative purposes. The actual determination being made is which pixel element of the SE overlays the target pixel, taking into account the target pixel coordinate values, the b image coordinate values for the surrounding pixel element currently being processed, the know origin values for the SE (i.e., Xmp and Ymp) and the calculated values for x0 and y0. Specifically, the code seCol=Xmp+((Tcol+X0)−bCol) calculates which column of the SE overlays the target pixel, while the code seRow=Ymp+((Trow+Y0)−bRow) calculates which row of the SE overlays the target pixel. Together, (seCol, seRow) are the coordinate values for the SE pixel element overlaying the target pixel. Once the SE element overlaying the target pixel is determined, a determination is made whether the SE element has a value of 1. If so, the value of the target pixel is updated. If not, then the value of the target pixel is not updated. For the current iteration, the code then looks to see if the updated value of the target pixel is equal to N. If so, then processing ends, but if not, then processing returns for the next iteration of processing the surrounding pixels.
Utilizing the foregoing code, the example for target pixel T(0, 0) will be described, wherein, for the calculations, TCol=0 and TRow=0. As discussed above, xStart, xEnd, yStart and yEnd are calculated to determine which pixels (bCol, bRow) in the b image correspond to the surrounding pixel area. Based on the values calculated as discussed above where it was found that xStart=0, xEnd=1, yStart=0 and yEnd=1, the surrounding pixels are b(0, 0), b(1, 0), b(0, 1) and b(1, 1). x0 and y0 are also calculated using the above discussed equations, and it was found that x0=1 and y0=1. In addition, N is set to be equal to the number of SE pixels having a value of 1, and as described above for the present example, N is set to be equal to 2. Thus, knowing these values, the code can be used to determine whether or not a hit is found for each pixel in the surrounding pixel area, and if so, which element of the SE overlays the target pixel to determine whether or not to update the value of the target pixel.
In the first iteration, a counter (nCounter) for N is initially set to be equal to 0 (zero) and the value for N is set (N=x, where x is the number of 1 pixels in the SE array). Commencing the first iteration, (bCol, Row)=(0, 0). The code determines “If(bCol, bRow)==1”, that a hit is found. Looking to pixel b(0, 0) in FIG. 12A, it can be seen that a hit is found. Thus, the code then performs calculations for seCol and seRow to determine which element of the SE will overlay the target pixel T(0, 0). To calculate seCol, the code uses the equation: seCol=Xmp+((TCol+X0)−bCol). Plugging in the numbers from above results in seCol=0+((0+1)−0)=0+(1)=1. To calculate seRow, the code uses the equation: seRow=Ymp+((TRow+Y0)−bRow). Plugging in the numbers from above results in seRow=0+((0+1)−0)=1+(1)=1. Therefore, SE element SE(1, 1) is determined to overlay the target pixel (which is confirmed by the visual depiction of FIG. 12B). The code then looks to the determined SE element (SE(1, 1)) to see if it has a value of 1. If so, the code returns a 1 to update the value of the target pixel. In the instant first iteration, it can be seen that pixel element SE(1, 1) has a value of 1 and therefore, the target pixel is updated. The code then increments the counter (nCounter++) to indicate that the target pixel has been updated one time. A test is then performed (if (nCounter==N)) to determine whether the counter is equal to N (i.e., whether the target pixel has been updated N times). In the present iteration, nCounter is equal to 1, while N is equal to 2, and therefore, the code continues processing the next surrounding pixel by looping back to increment the bCol by 1. Thus, the next pixel to be processed is (bCol, bRow)=b(1, 0).
In the second iteration for (bCol, Row)=(1, 0), the code again determines “If(bCol, bRow)==1”, that a hit is found. Looking to pixel b(1, 0) in FIG. 12A, it can be seen that a hit is found. Thus, the code again performs calculations for seCol and seRow to determine which element of the SE will overlay the target pixel T(0, 0). To calculate seCol, the code again uses the equation: seCol=Xmp+((TCol+X0)−bCol). Plugging in the numbers from above results in seCol=0+((0+1)−1)=0+(1)−1=0. To calculate seRow, the code again uses the equation: seRow=Ymp+((TRow+Y0)−bRow). Plugging in the numbers from above results in seRow=0+((0+1)−0)=1. Therefore, SE element SE(0, 1) is determined to overlay the target pixel (which is confirmed by the visual depiction of FIG. 12C). The code looks to the determined SE element (SE(0, 1)) to see if it has a value of 1. If so, the code returns a 1 to update the value of the target pixel. In the instant second iteration, it can be seen that pixel element SE(0, 1) does not have a value of 1 and therefore, the target pixel is not updated. The code does not increment the counter (nCounter++) and therefore, the counter remains unchanged with a value of 1. A test is then performed (if (nCounter==N)) to determine whether the counter is equal to N (i.e., whether the target pixel has been updated N times). In the present iteration, nCounter is still equal to 1, while N is equal to 2, and therefore, the code continues processing the next surrounding pixel by looping back to reset bCol to be equal to xStart since bCol has reached xEnd, and to increment the bRow by 1. Thus, the next pixel to be processed is (bCol, bRow)=b(0, 1).
In the third iteration for (bCol, Row)=(0, 1), the code again determines “If(bCol, bRow)==1”, that a hit is found. Looking to pixel b(0, 1) in FIG. 12A, it can be seen that a hit is found. Thus, the code again performs calculations for seCol and seRow to determine which element of the SE will overlay the target pixel T(0, 0). To calculate seCol, the code again uses the equation: seCol=Xmp+((TCol+X0)−bCol). Plugging in the numbers from above results in seCol=0+((0+1)−0)=0+(1)−0=1. To calculate seRow, the code again uses the equation: seRow=Ymp+((TRow+Y0)−bRow). Plugging in the numbers from above results in seRow=0+((0+1)−1)=0. Therefore, SE element SE(1, 0) is determined to overlay the target pixel (which is confirmed by the visual depiction of FIG. 12D). The code looks to the determined SE element (SE(1, 0)) to see if it has a value of 1. If so, the code returns a 1 to update the value of the target pixel. In the instant third iteration, it can be seen that pixel element SE(1, 0) does not have a value of 1 and therefore, the target pixel is not updated. The code does not increment the counter (nCounter++) and therefore, the counter remains unchanged with a value of 1. A test is then performed (if (nCounter==N)) to determine whether the counter is equal to N (i.e., whether the target pixel has been updated N times). In the present iteration, nCounter is still equal to 1, while N is equal to 2, and therefore, the code continues processing the next surrounding pixel by looping back to increment bCol by 1. Thus, the next pixel to be processed is (bCol, bRow)=b(1, 1).
In the fourth iteration for (bCol, Row)=(1, 1), the code again determines “If(bCol, bRow)==1”, that a hit is found. Looking to pixel b(1, 1) in FIG. 12A, it can be seen that a hit is found. Thus, the code again performs calculations for seCol and seRow to determine which element of the SE will overlay the target pixel T(0, 0). To calculate seCol, the code uses the equation: seCol=Xmp+((TCol+X0)−bCol). Plugging in the numbers from above results in seCol=0+((0+1)−1)=0+(1)−1=0. To calculate seRow, the code again uses the equation: seRow=Ymp+((TRow+Y0)−bRow). Plugging in the numbers from above results in seRow=0+((0+1)−1)=1+(1)−1=0. Therefore, SE element SE(0, 0) is determined to overlay the target pixel (which is confirmed by the visual depiction of FIG. 12E). The code then looks to the determined SE element (SE(0, 0)) to see if it has a value of 1. If so, the code returns a 1 to update the value of the target pixel. In the instant fourth iteration, it can be seen that pixel element SE(0, 0) has a value of 1 and therefore, the target pixel is updated. The code then increments the counter (nCounter++) to indicate that the target pixel has been updated again, so that the value of the counter is now equal to 2 (based on 2 updates of the target pixel). A test is then performed (if (nCounter==N)) to determine whether the counter is equal to N (i.e., whether the target pixel has been updated N times). In the present iteration, nCounter is equal to 2, while N is equal to 2, and therefore, the code terminates processing of any remaining surrounding pixels. Of course, in the present example, even if a second update had not occurred, the processing would have been terminated since all of the surrounding pixels have been processed. Therefore, once a pixel in the target image has been updated to have a value of at least 2, additional iterations to update the value of the target pixel further would be unnecessary. While further iterations to process all of the surrounding pixels may be part of the calculations, depending on the size and shape of the SE, the invention can achieve its goal with a minimal number of iterations and not all iterations are necessary, thereby saving additional processing time.
The foregoing process has been described for one target pixel element in the target image. The invention, however, performs the same process on each target pixel in the target image concurrently (i.e., in parallel). Therefore, the target image that results from the parallel processing may be along the lines of that shown in FIG. 13. As stated above, since only pixels having a value of 2 or greater are retained for the erosion image, all pixels having a value of 2 or greater are reset to a binary value of 1 for the output image, while pixels having a value less than 2 (e.g., 0 or 1) are reset to a binary value of 0 for the output image. The output (erosion) image for the present example may be as seen in FIG. 14 and the image is output to an output device (e.g., a display device, printer, etc.).
The invention can be embodied in a computer program that may be stored on a computer readable storage medium, such as a CD-ROM, a hard disk, flash drive, or any other type of storage medium. The computer program can be executed by a computer to practice the invention. Specifically, when executed by the computer, the program transforms an input image into an erosion image that can be output to a display device, such as a computer monitor, etc. For instance, the invention may employed in a medical imaging device that generates an image of a patient (e.g., an X-Ray image or an MRI image), where the original image of the patient is binarized and the binarized image may be altered using the erosion process of the invention. The invention may also be implemented in electronic fingerprint detection, noise reduction devices, airport security screening devices that scan items and generate an electronic image on a screen for a security agent.
FIGS. 15 and 16 are flowcharts depicting the processing flow for generating an erosion image according the invention. In FIG. 15, a first step (1501) is to input various processing parameters to the erosion program to achieve the desired erosion effect. That is, the user inputs parameters for the structuring element to be used for processing the erosion image, such as the width of the structuring element (Wse), height of the structuring element (Hse), location of the origin within the structuring element (Xmp, and Ymp), and the number of pixels in the SE having a value of 1 (N), along with the type of extension and binarization processes to be performed on the input image (e.g., PadType=0, PadType=1, PadType=2, etc.). These parameters are utilized by the program to calculate various values used in the processing as described above, such as x0 and y0. Thus, based on the user's preferred output, the various parameters for processing the image are input.
In commencing processing, an original image to be processed is input (1502). Extension and binarization of the original image is then performed (step 1503) and the extension and binarization are dependent upon the set parameters. Once the original image has been extended and binarized, a processing image is obtained from the extended-binarized image (step 1504). As described above, the processing image is the b image that includes pixels identified as pixels of interest from the extended-binarized image. A target image (T) is also set up (step 1505), where, as described above, the target image T is the same size as the original image, having omitted (or clipped) the pixels added during extension, and each pixel element of the target pixel is initially blank. Then, each pixel in the target image is processed in parallel (step 1506) to determine whether or not the value of the target pixel is to be updated. This process will be described in more detail with regard to FIG. 16. Once all of the target pixels in the target image T have been processed, the resultant image can be output as the erosion image (step 1507).
Referring now to FIG. 16, the processing of each target pixel will be described. As noted above, the process of FIG. 16 is performed in parallel (i.e., concurrently) for each pixel in the target image. Thus, the process steps being described in FIG. 16 are for processing of one target pixel. As discussed above, the processing of the target pixel utilizes the processing (b) image, the target image and the structuring element. Thus, three sets of coordinate values are referred to in the calculations: one for the processing image (bCol, bRow), one for the target image (TCol, TRow) and one for the structuring element (seCol, seRow). In the first step (1601), the coordinate values (TCol, TRow) for the target pixel being processed are obtained. The corresponding coordinates (bCol, bRow) for the pixel in the processing image corresponding to the target pixel are also obtained. For the target pixel, a surrounding pixel area in the processing image is calculated (step 1602). That is, as discussed above, xStart, xEnd, yStart and yEnd are calculated for the target pixel. Each pixel in the surrounding pixel area is then processed in a predetermined order. As discussed above, the predetermined order may be from left to right for each column in a first row, then from left to right for each column in a second row, etc. In step 1603, the counter (nCounter) is initialized to a value of 0 (zero), and the value of N is set to a value (x) based on the number of pixels having a value of 1 in the SE. With the predetermined order in mind, in step 1604, the first pixel that would be processed would be in the first column of the first row. Thus, in the first iteration, bCol would be set to xStart and bRow would be set to yStart (step 1604).
A determination is made in step 1605 whether or not a hit (value=1) is found for the current surrounding pixel. That is, a determination is made whether the surrounding pixel was identified as a pixel of interest in the processing image. If not (No in step 1605), then the processing proceeds to the next pixel in the predetermined order. If the current column is not the last column (i.e., not=xEnd in step S1611), then the surrounding pixel in the same row, next column would be processed (i.e., increment column in step 1612). Processing returns to step 1605 for the next pixel to determine whether the next pixel results in a hit. As long as no hits are found in the surrounding pixels, the processing in steps 1605 and 1611 to 1614 repeats to keep incrementing the column number, and row number to process the next surrounding pixel. However, whenever a hit is found for one of the surrounding pixels, the process proceeds from step S1605 to step 1606.
In step 1606, where it was determined in step 1605 that the current surrounding pixel resulted in a hit (value=1), a calculation is performed to determine which pixel element of the structuring element overlays the target pixel (step 1606). That is, as described above, calculations are performed to determine seCol, seRow. Once seCol and seRow have been calculated, a determination is made whether that particular pixel element of the SE (seCol, seRow) has a value of 1 (step 1607). If so, then a determination is made that the target pixel value is to be updated by 1 (step 1608). Whenever the target pixel is updated, the counter (nCounter) is incremented by 1 (step 1609). A determination is then made whether the value of nCounter, after having been incremented in step 1609, is now equal to N (step 1610). If not, then processing returns to step 1611 to process the next surrounding pixel. If, it is determined in step 1607 that the structuring element pixel (seCol, seRow) calculated in step 1606 does not have a value of 1, then it is determined that the target pixel is not to be updated and processing returns to step 1611 to process the next pixel in the surrounding pixel area. If, in step 1610, the target pixel has been updated a number of times so that nCounter is equal to N, then the processing of any further surrounding pixels ends (step 1615). Likewise, if the value of nCounter does not reach the value of N, and all of the surrounding pixels have been processed (where both bCol and bRow are found to be equal to xEnd and yEnd at the same time), then all of the surrounding pixels have been processed and the processing of the target pixel ends (step 1615).
The invention has been described with particular illustrative embodiments. It is to be understood that the invention is not limited to the above-described embodiments and that various changes and modifications may be made by those of ordinary skill in the art without departing from the spirit and scope of the invention.

## Claims

1. A digital image processing method implemented in a computer for generating an erosion image from a corresponding original digital image having a plurality of pixels, the method comprising:
inputting the original digital image;
generating an extended binary image by adding pixels to a boundary of the original image based on a structuring element and binarizing, utilizing a threshold value, each of the plurality of pixels of the original digital image and the pixels added to the boundary, wherein in the binarization process, each pixel is binarized in parallel;
obtaining a processing image (b) from the extended binary image, wherein each pixel in the extended binary image having a value of 1 is identified as a pixel of interest in the processing image (b);
obtaining a target image (T) from the extended binarized image, the target image being a same size as the original input image;
generating an erosion image utilizing the processing image (b) and the target image (T), the erosion image being obtained by processing each target pixel in the target image in parallel by performing the following steps on the target pixel:
a target pixel coordinate determination step of determining coordinate values for the target pixel in the target image (T);
a surrounding pixel area determination step of determining a surrounding pixel area in the processing image (b) surrounding a processing image pixel corresponding to the target pixel, the determination being made based on the coordinate values (TCol, TRow) for the target pixel and a size (height and width) of a structuring element;
a surrounding pixel processing step of performing processing on each pixel in the surrounding pixel area in a predetermined order to determine whether or not to update the value of the target pixel, wherein the processing on each pixel in the surrounding pixel area comprises the steps of:
a pixel of interest determination step of determining whether or not a current pixel of the surrounding pixel area being processed has been identified as a pixel of interest in the processing image;
in a case where it is determined that the current pixel has not been identified as a pixel of interest, determining that the target pixel is not to be updated based on processing of the current pixel in the surrounding pixel area, and commencing processing of a next surrounding pixel in the predetermined order, thereby returning to the pixel of interest determination step for the next surrounding pixel;
in a case where it is determined that the current surrounding pixel has been identified as a pixel of interest, performing the steps of:
a structuring element pixel determination step of determining which pixel element in the structuring element overlays the target pixel when an origin of the structuring element is located at the current surrounding pixel;
a pixel value obtaining step of obtaining a pixel value for the structuring element pixel element determined in the structuring element pixel determination step as overlaying the target pixel;
a target pixel update determination step of determining whether or not to update the value of the target pixel based on the obtained pixel value for the structuring element pixel element determined in the structuring element pixel determination step, wherein, if the obtained pixel value is a first value, a determination is made not to update the target pixel and processing commences for a next surrounding pixel in the predetermined order, thereby returning to the pixel of interest determination step for the next surrounding pixel, and if the obtained pixel value is a second value, a determination is made to update the value of the target pixel;
updating the value of the target pixel if the target pixel update determination step determines to update the value of the target pixel;
a target pixel value determination step of determining whether or not the updated value of the target pixel is equal to a predetermined value (N);
in a case where the target pixel value determination step determines that the updated value of the target pixel is equal to the predetermined value (N), terminating processing of remaining pixels in the surrounding pixel area and setting the value of the target pixel as the predetermined value (N);
in a case where the target pixel value determination step determines that the updated value of the target pixel is less than the predetermined value (N) and all surrounding pixels have been processed, setting the value of the target pixel in the target image based on the number of updates performed in the updating step;
in a case where the target pixel value determination step determines that the updated value of the target pixel is less than the predetermined value (N) and additional surrounding pixels remain to be processed, returning to the pixel of interest determination step for a next pixel of the surrounding pixels to be processed in the predetermined order;

obtaining an output image by, after all target pixels in the target image have been processed according to the foregoing steps, thereby resulting in an updated target image, setting a value of pixels in the updated target image having the predetermined value (N) to a first binary value and setting pixels in the updated target image having an updated value less than the predetermined value (N) to a second binary value; and
outputting the obtained output image.

2. The method according to claim 1, wherein the first binary value is 1 and the second binary value is 0.

3. The method according to claim 1, wherein in the target image (T), the pixels added during the extension have been clipped.

4. The method according to claim 1, wherein the first value of the structuring element pixel is 0, and the second value of the structuring element pixel is a 1, and wherein the predetermined value (N) is set based on the number of pixels in the structuring element having a value of 1.

5. The method according to claim 1, wherein, in determining the surrounding pixel area, a starting column (xStart) of the surrounding pixel area is a same column number as the target pixel (TCol), a starting row (yStart) of the surrounding pixel area is a same row number as the target pixel (TRow), an ending column (xEnd) of the surrounding pixel area is equal to the starting column (xStart) plus the width of the structuring element (Wse) minus 1, and the ending row (yEnd) of the surrounding pixel area is equal to the starting row (yStart) plus the height of the structuring element (Hse) minus 1.

6. The method according to claim 1, wherein the pixel element overlaying the target pixel is defined by structuring element coordinates (seCol, seRow), where seCol equals the structuring element column and seRow equals the structuring element row.

7. The method according to claim 6, wherein the pixel element overlaying the target pixel is determined from the following equations:


seCol=Xmp+((TCol+X0)−bCol)



seRow=Ymp+((TRow+Y0)−bRow),


where Xmp=structuring element origin x coordinate,
Ymp=structuring element origin y coordinate,
Tcol=target pixel column,
Trow=target pixel row,
bCol=current surrounding pixel column in the processing image,
bRow=current surrounding pixel row in the processing image,
x0=Wse−Xmp−1, where Wse=width of the structuring element, and
y0=HseYmp−1.

8. A computer-readable storage medium on which is stored a computer program that, when executed by a computer, performs a digital image processing method implemented in a computer for generating an erosion image from a corresponding original digital image having a plurality of pixels, the method comprising:
inputting the original digital image;
generating an extended binary image by adding pixels to a boundary of the original image based on a structuring element and binarizing, utilizing a threshold value, each of the plurality of pixels of the original digital image and the pixels added to the boundary, wherein in the binarization process, each pixel is binarized in parallel;
obtaining a processing image (b) from the extended binary image, wherein each pixel in the extended binary image having a value of 1 is identified as a pixel of interest in the processing image (b);
obtaining a target image (T) from the extended binarized image, the target image being a same size as the original input image;
generating an erosion image utilizing the processing image (b) and the target image (T), the erosion image being obtained by processing each target pixel in the target image in parallel by performing the following steps on the target pixel:
a target pixel coordinate determination step of determining coordinate values for the target pixel in the target image (T);
a surrounding pixel area determination step of determining a surrounding pixel area in the processing image (b) surrounding a processing image pixel corresponding to the target pixel, the determination being made based on the coordinate values (TCol, TRow) for the target pixel and a size (height and width) of a structuring element;
a surrounding pixel processing step of performing processing on each pixel in the surrounding pixel area in a predetermined order to determine whether or not to update the value of the target pixel, wherein the processing on each pixel in the surrounding pixel area comprises the steps of:
a pixel of interest determination step of determining whether or not a current pixel of the surrounding pixel area being processed has been identified as a pixel of interest in the processing image;
in a case where it is determined that the current pixel has not been identified as a pixel of interest, determining that the target pixel is not to be updated based on processing of the current pixel in the surrounding pixel area, and commencing processing of a next surrounding pixel in the predetermined order, thereby returning to the pixel of interest determination step for the next surrounding pixel;
in a case where it is determined that the current surrounding pixel has been identified as a pixel of interest, performing the steps of:
a structuring element pixel determination step of determining which pixel element in the structuring element overlays the target pixel when an origin of the structuring element is located at the current surrounding pixel;
a pixel value obtaining step of obtaining a pixel value for the structuring element pixel element determined in the structuring element pixel determination step as overlaying the target pixel;
a target pixel update determination step of determining whether or not to update the value of the target pixel based on the obtained pixel value for the structuring element pixel element determined in the structuring element pixel determination step, wherein, if the obtained pixel value is a first value, a determination is made not to update the target pixel and processing commences for a next surrounding pixel in the predetermined order, thereby returning to the pixel of interest determination step for the next surrounding pixel, and if the obtained pixel value is a second value, a determination is made to update the value of the target pixel;
updating the value of the target pixel if the target pixel update determination step determines to update the value of the target pixel;
a target pixel value determination step of determining whether or not the updated value of the target pixel is equal to a predetermined value (N);
in a case where the target pixel value determination step determines that the updated value of the target pixel is equal to the predetermined value (N), terminating processing of remaining pixels in the surrounding pixel area and setting the value of the target pixel as the predetermined value (N);
in a case where the target pixel value determination step determines that the updated value of the target pixel is less than the predetermined value (N) and all surrounding pixels have been processed, setting the value of the target pixel in the target image based on the number of updates performed in the updating step;
in a case where the target pixel value determination step determines that the updated value of the target pixel is less than the predetermined value (N) and additional surrounding pixels remain to be processed, returning to the pixel of interest determination step for a next pixel of the surrounding pixels to be processed in the predetermined order;

obtaining an output image by, after all target pixels in the target image have been processed according to the foregoing steps, thereby resulting in an updated target image, setting a value of pixels in the updated target image having the predetermined value (N) to a first binary value and setting pixels in the updated target image having an updated value less than the predetermined value (N) to a second binary value; and
outputting the obtained output image.

9. An information processing apparatus, comprising:
a processor that executes a computer program; and
a memory medium that stores a computer program that, when executed by the processor, implements a digital image processing method implemented in a computer for generating an erosion image from a corresponding original digital image having a plurality of pixels, the method comprising:
inputting the original digital image;
generating an extended binary image by adding pixels to a boundary of the original image based on a structuring element and binarizing, utilizing a threshold value, each of the plurality of pixels of the original digital image and the pixels added to the boundary, wherein in the binarization process, each pixel is binarized in parallel;
obtaining a processing image (b) from the extended binary image, wherein each pixel in the extended binary image having a value of 1 is identified as a pixel of interest in the processing image (b);
obtaining a target image (T) from the extended binarized image, the target image being a same size as the original input image;
generating an erosion image utilizing the processing image (b) and the target image (T), the erosion image being obtained by processing each target pixel in the target image in parallel by performing the following steps on the target pixel:
a target pixel coordinate determination step of determining coordinate values for the target pixel in the target image (T);
a surrounding pixel area determination step of determining a surrounding pixel area in the processing image (b) surrounding a processing image pixel corresponding to the target pixel, the determination being made based on the coordinate values (TCol, TRow) for the target pixel and a size (height and width) of a structuring element;
a surrounding pixel processing step of performing processing on each pixel in the surrounding pixel area in a predetermined order to determine whether or not to update the value of the target pixel, wherein the processing on each pixel in the surrounding pixel area comprises the steps of:
a pixel of interest determination step of determining whether or not a current pixel of the surrounding pixel area being processed has been identified as a pixel of interest in the processing image;
in a case where it is determined that the current pixel has not been identified as a pixel of interest, determining that the target pixel is not to be updated based on processing of the current pixel in the surrounding pixel area, and commencing processing of a next surrounding pixel in the predetermined order, thereby returning to the pixel of interest determination step for the next surrounding pixel;
in a case where it is determined that the current surrounding pixel has been identified as a pixel of interest, performing the steps of:
a structuring element pixel determination step of determining which pixel element in the structuring element overlays the target pixel when an origin of the structuring element is located at the current surrounding pixel;
a pixel value obtaining step of obtaining a pixel value for the structuring element pixel element determined in the structuring element pixel determination step as overlaying the target pixel;
a target pixel update determination step of determining whether or not to update the value of the target pixel based on the obtained pixel value for the structuring element pixel element determined in the structuring element pixel determination step, wherein, if the obtained pixel value is a first value, a determination is made not to update the target pixel and processing commences for a next surrounding pixel in the predetermined order, thereby returning to the pixel of interest determination step for the next surrounding pixel, and if the obtained pixel value is a second value, a determination is made to update the value of the target pixel;
updating the value of the target pixel if the target pixel update determination step determines to update the value of the target pixel;
a target pixel value determination step of determining whether or not the updated value of the target pixel is equal to a predetermined value (N);
in a case where the target pixel value determination step determines that the updated value of the target pixel is equal to the predetermined value (N), terminating processing of remaining pixels in the surrounding pixel area and setting the value of the target pixel as the predetermined value (N);
in a case where the target pixel value determination step determines that the updated value of the target pixel is less than the predetermined value (N) and all surrounding pixels have been processed, setting the value of the target pixel in the target image based on the number of updates performed in the updating step;
in a case where the target pixel value determination step determines that the updated value of the target pixel is less than the predetermined value (N) and additional surrounding pixels remain to be processed, returning to the pixel of interest determination step for a next pixel of the surrounding pixels to be processed in the predetermined order;

obtaining an output image by, after all target pixels in the target image have been processed according to the foregoing steps, thereby resulting in an updated target image, setting a value of pixels in the updated target image having the predetermined value (N) to a first binary value and setting pixels in the updated target image having an updated value less than the predetermined value (N) to a second binary value; and
outputting the obtained output image.