Image processing apparatus, image processing method, and recording medium
The range inference model and edge detection algorithm built through machine learning solve the problem of edge misdetection when extracting print images from photographic images, achieving higher extraction precision and accuracy.
Patent Information
- Application Number
- CN202410212626.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-02-28
- Filing Date
- 2024-02-27
- Publication Date
- 2024-08-30
AI Technical Summary
When extracting the image corresponding to the printed matter from the photographic image, the existing technology has problems of edge error detection and insufficient detection accuracy, making it difficult to accurately extract the image of the printed matter.
The range inference model built by machine learning is used, combined with the edge detection algorithm, to detect and correct by setting multiple ranges to ensure the precision and accuracy of the extracted images.
It effectively suppresses edge misdetection, improves the accuracy and precision of image extraction, and can correctly extract printed images from photographic images.
Smart Images

Figure CN118573779A
Abstract
Description
Technical Field
[0001] One embodiment of the present invention relates to an image processing device for extracting an image corresponding to a printed matter from a photographic image. Background Art
[0002] Sometimes, an image of a predetermined object is extracted from a photographic image, the extracted image is converted into data and stored, and then the converted image is used. As a method of extracting an image of an extraction object from a photographic image, an edge detection method is generally used.
[0003] As an example of using the above-mentioned image extraction method, there is a case where a printed matter having a printed image is printed, for example, a photocopy is photographed and a photocopy image is extracted from the photographed image (for example, refer to Patent Document 1).
[0004] In the technology of Patent Document 1, an edge detection method is applied when extracting an image that is assumed to have faded, that is, an area where a photocopy image exists, from a photocopied photographic image. Then, a binary image of the photographic image is generated, edges that are in contact with the edge of the binary image are removed, and the remaining edges are taken as objects to extract the area where the photocopy image exists from the photographic image.
[0005] Patent Document 1: Japanese Patent Application Publication No. 2007-074579 Summary of the invention
[0006] Technical issues to be solved by the invention
[0007] When extracting an image corresponding to a printed matter from a photographic image, it is preferable to extract the image of the extraction object more accurately and to extract the image more efficiently. To this end, when extracting the image corresponding to the printed matter, it is necessary to take measures such as suppressing the false detection of the edge of the image. In addition, an edge detection method with improved detection accuracy compared with the previous method is required.
[0008] An object of one embodiment of the present invention is to solve the problems of the prior art and to provide an image processing device, an image processing method, a program, and a recording medium for more appropriately extracting an image corresponding to a printed matter from a photographic image.
[0009] In order to achieve the above-mentioned purpose, the image processing device of the present invention extracts an image corresponding to a printed matter from a photographic image, and is characterized in that the image processing device has a processor, and the processor performs an inference processing, which is to apply a range inference model constructed through machine learning related to the printed matter to the photographic image, thereby inferring a first range in the photographic image that includes the printed matter.
[0010] Furthermore, in the inference processing, the processor may apply a range inference model constructed by machine learning related to the appearance of printed materials to the photographic image, thereby inferring the first range.
[0011] Furthermore, the appearance may be at least one of the size and shape of the printed matter and the characteristics of the printed surface of the printed matter.
[0012] Furthermore, the processor may perform: a setting process of setting a second range in the photographic image that includes the first range and is wider than the first range based on the first range; and a detection process of detecting a specific area of the image corresponding to the printed matter within the second range.
[0013] Furthermore, the processor may superimpose a graphic representing a specific area of the image corresponding to the printed matter detected by the detection process on the photographic image.
[0014] The processor may overlay the graphics onto the instant preview image as a photographic image.
[0015] Furthermore, the processor may perform extraction processing of extracting an image corresponding to the printed matter from the photographic image based on the user's operation.
[0016] Furthermore, the image corresponding to the printed matter may be specified by a specific area or graphic of the image corresponding to the printed matter.
[0017] Furthermore, in the detection process, the processor may perform a first detection process, a determination process, and a second detection process. In the first detection process, an edge detection algorithm may be applied to a photographic image to detect a first edge in the photographic image. In the determination process, an object range may be set with the first edge as one end and a position separated from the first edge by a preset number of pixels as the other end, and a plurality of second points in the object range may be determined based on information on the colors of the first point and the second point described below, corresponding to a plurality of first points arranged along the first edge on one end side of the object range. In the second detection process, the second edge may be detected based on a plurality of second points. Furthermore, in the above configuration, the processor may perform an extraction process of extracting an image corresponding to a printed matter from the photographic image based on the detected second edge.
[0018] Furthermore, in the determination process, the processor may perform the following processing on the multiple first points respectively: while offsetting the object point within the object range from the first point to the other end by one pixel each time, the color difference between the pixel of the first point and the pixel of the object point is calculated; and among the object points where the color difference becomes greater than a threshold, the object point where the color difference is the largest is determined as the second point.
[0019] Furthermore, in the determination process, the processor may determine a plurality of first points on the first edge.
[0020] Furthermore, when a plurality of first edges are detected in the first detection process, the processor may execute the identification process and the second detection process for each of the plurality of first edges.
[0021] Furthermore, when the print surface of the printed matter includes a print area where the printed image is printed and a frame area located around the print area, the preset number of pixels may be smaller than the number of pixels corresponding to the width and length of the frame area.
[0022] Furthermore, the processor further executes a display process for displaying the photographic image on the screen. When executing the display process, the processor may cause a graphic representing the second edge detected by the second detection process to be superimposed on the photographic image.
[0023] Furthermore, in the case where a dark area exists in a position adjacent to a printed matter in a photographic image, the processor may detect a boundary located on the opposite side of the printed matter in the image of the dark area as a first edge in the first detection process. Furthermore, in the above case, in the determination process, the processor may determine a plurality of second points corresponding to a plurality of first points located on the first edge within an object range of the image including the dark area. Furthermore, in the above case, the processor may detect a second edge based on a plurality of second points in the second detection process. Furthermore, in the above case, the processor may extract an image corresponding to the printed matter from the photographic image in which the dark area is removed based on the detected second edge in the extraction process.
[0024] Furthermore, the printed matter may be a medium having a printed image printed on a printing surface.
[0025] Furthermore, an image processing method involved in one embodiment of the present invention extracts an image corresponding to a printed matter from a photographic image, and is characterized in that the image processing method includes the following steps: a processor applies a range inference model constructed through machine learning related to the printed matter to the photographic image, thereby inferring a first range in the photographic image that includes the printed matter.
[0026] Furthermore, the above-mentioned image processing method may include the following steps: the processor sets a second range in the photographic image that includes the first range and is wider than the first range based on the first range; and the processor detects a specific area of the image corresponding to the printed matter within the second range.
[0027] Furthermore, in the above-mentioned image processing method, in the step of detecting a specific area of an image corresponding to a printed matter, the processor may apply an edge detection algorithm to the photographic image to detect a first edge within the photographic image. Furthermore, the processor may set an object range having the first edge as one end and a position spaced a preset number of pixels from the first edge as the other end. Furthermore, the processor determines a plurality of second points in the object range based on information on the colors of the first point and the second point described below, corresponding to a plurality of first points arranged along the first edge on one end side of the object range. In this case, the above-mentioned image processing method includes the following steps: the processor detects the second edge based on the plurality of second points; and the processor extracts the image corresponding to the printed matter from the photographic image based on the detected second edge.
[0028] Furthermore, a program according to an embodiment of the present invention is a program for causing a computer to implement the steps included in the above-mentioned image processing method.
[0029] Furthermore, a recording medium according to an embodiment of the present invention is a computer-readable recording medium, and is a recording medium having a program recorded thereon for causing a computer to execute the steps included in the above-described image processing method.
[0030] Effects of the Invention
[0031] According to one embodiment of the present invention, an image corresponding to a printed matter can be accurately extracted from a photographic image. Also, according to one embodiment of the present invention, an image corresponding to a printed matter can be efficiently extracted from a photographic image. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 This is a diagram showing an example of a printed matter.
[0033] Figure 2 This is a diagram showing an image processing system including an image processing device according to an embodiment of the present invention.
[0034] Figure 3 A diagram showing a photographic image and an image corresponding to a printed product.
[0035] Figure 4 This is a diagram showing a hardware configuration of an image processing device according to an embodiment of the present invention.
[0036] Figure 5A This is a diagram (part 1) showing the process of extracting an image corresponding to a printed matter from a photographic image.
[0037] Figure 5B This is a diagram (part 2) showing the process of extracting an image corresponding to a printed matter from a photographic image.
[0038] Figure 5CThis is a diagram (part 3) showing the process of extracting an image corresponding to a printed matter from a photographic image.
[0039] Figure 5D This is a diagram (part 4) showing the process of extracting an image corresponding to a printed matter from a photographic image.
[0040] Figure 6 This is a diagram for explaining the functions of the image processing device according to one embodiment of the present invention.
[0041] Figure 7 This is the first explanatory diagram regarding the order of the detection process.
[0042] Figure 8 This is the second explanatory diagram regarding the order of the detection process.
[0043] Fig. 9 This is the third explanatory diagram regarding the detection processing sequence.
[0044] Fig.10 This is the fourth explanatory diagram regarding the order of the detection process.
[0045] Fig.11 It is a diagram showing the flow of image processing according to one embodiment of the present invention.
[0046] Fig.12 It is a diagram showing the flow of detection processing.
[0047] Description of Reference Numerals
[0048] 10-image processing device, 12-user terminal, 12A-processor, 12B-memory, 12C-communication interface, 12D-input device, 12E-output device, 12F-photographic device, 12G-storage device, 21-photographic control unit, 22-inference unit, 23-setting unit, 24-detection unit, 25-display control unit, 26-extraction unit, 27-correction unit, 28-saving unit, 50-printer, 52-control device, F-photosensitive film, GP-print image, K-dark area, GL-instant preview image, M-print area, OJ-graphics, P-print, R-frame area. DETAILED DESCRIPTION
[0049] A specific embodiment of the present invention is described. In addition, for the convenience of description, the following description is sometimes made from the perspective of GUI (Graphic User Interface). However, the basic data processing technology (communication / transmission technology, data acquisition technology, data recording technology, data processing / analysis technology, image processing technology and visualization technology, etc.) used to realize the content is a well-known technology, so the description thereof is omitted.
[0050] Furthermore, in this specification, the concept of "device" includes a single device that performs a specific function, and also includes a combination of multiple devices that exist independently of each other and cooperate (coordinate) to perform a specific function.
[0051] Furthermore, in this specification, the “user” refers to a user of the image processing apparatus of the present invention, and specifically, for example, a person who uses the function of the image processing apparatus of the present invention to obtain a printed matter image GP described later.
[0052] Furthermore, in this specification, "personnel" refers to the subject that performs a specific action, including individuals, groups, legal persons such as enterprises, and collectives, and can also include computers and devices that constitute artificial intelligence (AI). Regarding artificial intelligence, hardware resources and software resources are used to implement intelligent functions such as reasoning, prediction, and judgment. The algorithm of artificial intelligence is arbitrary, such as expert system, case-based reasoning (CBR), Bayesian network, or inclusive structure.
[0053] <<Overview of the specific implementation method of this embodiment>>
[0054] One embodiment of the present invention (hereinafter referred to as this embodiment) relates to an image processing device, an image processing method, a program, and a recording medium. When described in more detail, this embodiment is to obtain a Figure 1 A technology for extracting an image corresponding to the printed matter from a photographic image obtained by taking a photograph of the printed matter P shown in FIG.
[0055] The printed matter P is a photosensitive film F on which a printed image is printed. The printing in this embodiment is, for example, printing by an instant photography method. Specifically, the photosensitive film F is exposed to form a latent image, and the developer tank provided at the end of the film is destroyed to spread the developer in the tank on the surface of the film, thereby forming an image that visualizes the latent image. In addition, the printing method is not limited to the instant photography method, and may also be an inkjet method, a sublimation type thermal transfer method, or an electronic photography method using a toner.
[0056] The photosensitive film F is an example of a medium having a printed image printed on a printing surface of one surface, and is also a dedicated film for the printer 50 described later, which is called an instant color film. The photosensitive film F has a rectangular shape and has a certain thickness. There are multiple types of photosensitive films F, and each type of film has different shapes, dimensions, sizes, and printing surface characteristics. The printing surface characteristics refer to the visual characteristics of the printing surface, such as the color (base color), design, pattern, and pattern of the frame area R.
[0057] In this embodiment, only one type of photosensitive film F may be used. Furthermore, the outer shape of the photosensitive film F is not limited to a rectangle, and may be a circle, an ellipse, a quadrilateral other than a rectangle, or a polygon other than a quadrilateral.
[0058] like Figure 1 As shown in FIG. 1 , the print surface of the printed product P is composed of a print area M where the image to be printed is printed and a frame area R surrounding the print area M. The print area M is located in the center of the print surface and is a square or rectangular area. Figure 1 As shown, the frame area R is a quadrilateral region with a predetermined width. The width of the frame area R is the distance between the outer edge of the photosensitive film F and the end position of the printing area M. The end position of the printing area M is the boundary position between the printing area M and the frame area R.
[0059] Printed material P, for example, Figure 2 The printer 50 contains an unused photosensitive film F, and prints an image (formal image) on an image forming area of the photosensitive film F by operating an exposure head and a conveying mechanism (not shown) provided in the printer.
[0060] The printer 50 is not limited to a device owned by the user, and may be a store-installed printer that can be used in a store or the like.
[0061] like Figure 2 As shown, the printer 50 is connected to the control device 52 in a wireless or wired manner, and performs printing work under the control of the control device 52. Specifically, the control device 52 sends a printing request including an image of a printing object (hereinafter referred to as a printed image) to the printer 50. When the printer 50 receives the printing request, it prints the printed image related to the printing request onto the photosensitive film F. The printed image can be an image taken by a digital camera or the like, or an illustration image or a CG (Computer Graphic) image created by image creation software or the like. In addition, the printed image can be a text image.
[0062] In addition, the control device 52 may be built into the printer 50. In this case, an auxiliary storage device such as a memory card or a photographing device such as a digital camera is connected to the printer 50, and the control device 52 reads an image from the device or equipment connected to the printer 50. The read image can be printed as a printed image by the printer 50 through the photosensitive film F. In addition, the control device 52 may be mounted on the photographing device. In addition, the control device 52 may be the user terminal 12 constituting the image processing device involved in this embodiment.
[0063] The user who obtains the printed matter P photographs the printed matter P using a digital camera or a camera mounted on a smart device, etc., in order to obtain an image (more specifically, digital image data) corresponding to the printed matter P. The image corresponding to the printed matter P is an image of a region where the printed matter P exists in the photographic image obtained by photographing the printed matter P, and is hereinafter referred to as "printed matter image GP" for convenience of explanation.
[0064] like Figure 3 As shown in FIG. 1 , objects and background around the printed matter P (hereinafter also referred to as a peripheral image) are reflected in the photographic image. Figure 3 As shown, in this embodiment, the printed matter image GP can be obtained by avoiding the reflection of the surrounding image. In other words, according to this embodiment, the printed matter image GP can be obtained (captured) by detecting the edge of the printed matter P in the photographic image and extracting the image within the edge. The obtained image of the printed matter P is saved as image data and then used for various purposes by the user.
[0065] <<Configuration of an Image Processing Device According to an Embodiment of the Present Invention>>
[0066] An example configuration of an image processing device (hereinafter referred to as image processing device 10) according to the present embodiment will be described. The image processing device 10 is used by a user to extract a printed matter image GP from which peripheral images are removed from a photographic image obtained by photographing the printed matter P.
[0067] The image processing device 10 is composed of a computer having a processor, for example, an information processing terminal (hereinafter referred to as a user terminal 12) owned by a user. Specific examples of the user terminal 12 include a PC (Personal Computer), a smartphone, a tablet terminal, and a digital camera having a data processing function. Hereinafter, the user terminal 12 is described by taking a case where a smart device such as a smartphone and a tablet terminal as an example.
[0068] like Figure 4As shown, the user terminal 12 includes a processor 12A, a memory 12B, a communication interface 12C, etc. The processor 12A is composed of, for example, a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), a DSP (Digital Signal Processor), or a TPU (Tensor Processing Unit). The memory 12B is composed of, for example, a semiconductor memory such as a ROM (Read Only Memory) and a RAM (Random Access Memory). The communication interface 12C is composed of, for example, a network interface card or a communication interface board.
[0069] And, if Figure 4 As shown, the user terminal 12 further includes an input device 12D, an output device 12E, and a storage device 12G. The input device 12D is composed of a touch panel and a cursor button, etc., and receives the user's input operation. The user's input operation includes a capture operation performed when the user obtains a printed image GP (capture). The output device 12E includes a display as a display device.
[0070] In addition, the input device 12D includes a photographic device 12F such as a terminal built-in camera. The photographic device 12F has a photographic lens and an image sensor (imaging element), etc., receives light from a subject within the photographic angle of view, converts the received light image into an electrical signal, and digitizes the electrical signal to generate image data.
[0071] In this embodiment, the photographing device 12F is used to photograph the printed matter P. Specifically, when the photographing device 12F is activated and the printed matter P is placed within the photographing angle of view, the photographing device 12F photographs the printed matter P and its surroundings. As a result, the photographed image of the printed matter P, more specifically, the live preview image GL is displayed on the screen of the display. The live preview image GL is a photographed image generated based on an output signal from the image sensor of the photographing device 12F, and is a real-time image based on the photographing device 12F during the photographing.
[0072] Furthermore, while the live preview image GL is displayed, when the user performs the above-mentioned capture operation, the user terminal 12 captures the printed matter image GP through the photographing device 12F. Here, capturing the printed matter image GP means extracting the area where the printed matter P exists in the photographic image, and acquiring the image of the area as the printed matter image GP by taking an image.
[0073] The storage device 12G stores various information required for acquiring the printed matter image GP. The processor 12A can freely access various information stored in the storage device 12G. The information stored in the storage device 12G includes a range estimation model described later.
[0074] In addition, the storage device 12G may be built-in or external to the user terminal 12, or may be composed of NAS (Network Attached Storage), etc. Alternatively, the storage device 12G may be an external device capable of communicating with the Internet or a mobile network through the user terminal 12, such as an online storage device.
[0075] The memory 12B stores an image processing program (hereinafter referred to as the image processing program) for acquiring the printed matter image GP. The image processing program is an application program for causing the processor 12A to implement each process (each step) in the image processing flow described later. The image processing program can be obtained by reading from a computer-readable recording medium or by downloading via a communication network such as the Internet or an intranet.
[0076] Furthermore, the image processing apparatus 10 may be configured by cooperation between a service computer of ASP (Application Service Provider), SaaS (Software as a Service), PaaS (Platform as a Service), or IaaS (Infrastructure as a Service) and the user terminal 12. In this case, when the user inputs necessary information through the user terminal 12, the server computer executes a series of processes related to obtaining the printed matter image GP based on the input information. As a result, the user can obtain the printed matter image GP.
[0077] <<Sequence for acquiring printed matter images>>
[0078] Regarding the order of acquiring (capturing) the printed matter image GP, Figures 5A to 5D , while explaining.
[0079] When acquiring the printed matter image GP, first, the printed matter P to be the target is created by the printer 50. Then, Figure 5A As shown, the printed matter P is photographed by the photographing device 12F of the user terminal 12. As a result, the photographed image of the printed matter P, specifically, the live preview image GL, is displayed on the screen of the display of the user terminal 12.
[0080] While the live preview image GL is displayed, a range (hereinafter referred to as a first range) including the printed matter P is estimated in the live preview image GL. The first range is set as a range surrounding the printed matter P, for example, Figure 5B In the case of , the rectangular range indicated by the dotted line is set as the first range. The directions of the long side and the short side of the first range are defined by the two axes (coordinate axes) of the display screen of the instant preview image GL. Specifically, the long side of the first range is parallel to one coordinate axis, and the short side of the first range is parallel to the other coordinate axis.
[0081] like Figure 5B As shown, the first range is in contact with the outer edge of the printed product P. More specifically, the angle of the printed product P is set to be located on the contour line of the first range.
[0082] In addition, the shape of the first range is not limited to a rectangle, and may be, for example, a quadrilateral other than a rectangle, a polygon other than a quadrilateral, a circle, or an ellipse.
[0083] Then, based on the first range, a range (hereinafter referred to as the second range) for detecting the printed matter P is set in the live preview image GL. The second range is a range that is larger than the first range and has an outer edge at a position separated from the outer edge of the first range by a predetermined distance to the outside. That is, the second range is a range that is wider than the first range and includes the first range inside. In this way, the second range is set so that the printed matter image GP is included in the range with a high probability. As a result, when detecting the edge of the printed matter image GP, it becomes possible to more reliably detect the edge of the printed matter image GP in the second range.
[0084] The second range has a shape corresponding to the first range. Figure 5B In the case of , the rectangular range represented by the dot-dash line is set as the second range. The long side and short side of the second range are the same as those of the first range, and are defined by defining two axes (coordinate axes) of the display screen of the live preview image GL. Specifically, the long side of the second range is parallel to one coordinate axis, and the short side of the second range is parallel to the other coordinate axis.
[0085] The shape of the second range is not limited to a rectangle, and may be, for example, a quadrilateral other than a rectangle, a polygon other than a quadrilateral, a circle, or an ellipse. Furthermore, the interval between the contour line of the first range and the contour line of the second range can be arbitrarily determined.
[0086] Then, the detection process is applied to the second range, and the first edge of the image of the printed matter P is detected in the second range. The first edge is a normal edge detected by a known edge detection technique. The original first edge corresponds to a specific area of the printed matter image GP in the photographic image, specifically, an image corresponding to the outer edge of the printed matter image GP.
[0087] On the other hand, the instant preview image in GL, such as Figure 5B As shown, a dark area K may exist at a position adjacent to a part of the outer edge of the printed product P due to the position of the light source during shooting, etc. The dark area K is an area with significantly lower brightness than the frame area R of the printed product P in the live preview image GL, specifically, an area where the shadow of the printed product P appears. In addition, a gray scale of brightness is formed in the dark area K, and for example, the closer to the outer edge of the printed product P, the darker it becomes.
[0088] When there is a dark area K, the boundary of the dark area K is sometimes detected as the first edge. In particular, when a printed matter P having a certain thickness is photographed as in the present embodiment, a shadow is likely to occur around the printed matter P, and the boundary of the dark area K may be detected as the first edge. Here, the boundary of the dark area K refers to the boundary between the image of the dark area K and the image of the area outside the dark area K. The area outside the dark area K refers to the table or floor on which the printed matter P is placed, that is, the part corresponding to the background of the printed matter P.
[0089] Therefore, in this embodiment, a process is performed to avoid the situation where the boundary of the dark area K is erroneously detected as the edge of the printed matter image GP. Specifically, when the dark area K exists at a position adjacent to the printed matter P, the second edge is detected at a position closer to the printed matter P than the first edge. The second edge is not the dark area K, but an edge equivalent to the outer edge of the real printed matter P, which is equivalent to the boundary between the printed matter P and the dark area K (in other words, a specific area of the printed matter image GP).
[0090] Then, when the first edge and the second edge are detected, when the edge of the printed matter image GP is determined by the second edge, as shown in FIG. Figure 5C As shown, a graphic OJ indicating the edge is superimposed on the live preview image GL. The graphic OJ is a frame surrounding the image of the printed matter P, and is specifically a line image located at the first edge or the second edge. By displaying the graphic OJ, the user can confirm the position, size, shape, etc. of the printed matter P in the live preview image GL.
[0091] In addition, the display method of the graphic OJ (e.g., display color, presence or absence of highlight display such as blinking, and display time) can be freely set. Furthermore, the type of graphic OJ is not limited to a frame-shaped graphic surrounding the image of the printed matter P, and may be an indicator such as a cursor, or an L-shaped mark or mark indicating the corner of the image of the printed matter P.
[0092] Then, when the user performs a capture operation and the capture operation is accepted, the capture operation is used as a trigger to extract and capture the printed matter image GP from the photographic image at that time. Here, the printed matter image GP to be extracted is defined by the edge (first edge or second edge) of the printed matter image GP or the pattern OJ, and is specifically surrounded by the edge represented by the pattern OJ.
[0093] In addition, the capture of the printed matter image GP is not limited to the case where it is performed based on the capture operation of the user, and it can be automatically performed at the point in time when the edge of the printed matter image GP is detected.
[0094] The captured printed matter image GP is appropriately geometrically transformed. More specifically, when the printed surface of the printed matter P is not facing the front relative to the photographing direction at the time of capture, the captured printed matter image GP is subjected to trapezoidal correction. Figure 5D As shown, a printed matter image GP can be obtained when the printing surface faces the front side.
[0095] <<Function of the image processing device according to one embodiment of the present invention>>
[0096] The structure of the image processing device 10 according to this embodiment will be described again from a functional perspective. Figure 6 As shown, the image processing device 10 has a photography control unit 21, an inference unit 22, a setting unit 23, a detection unit 24, a display control unit 25, an extraction unit 26, a correction unit 27, and a storage unit 28. These functional units are implemented by the cooperation of the hardware devices possessed by the user terminal 12 constituting the image processing device 10 and various programs (software) including the aforementioned image processing program. In addition, some functions can be implemented by artificial intelligence (AI). The following describes each functional unit.
[0097] (Photography Control Department)
[0098] The photography control unit 21 executes photography processing to obtain a photographic image by controlling the photography device 12F of the user terminal 12. When the photography processing is executed, if the printed matter P is arranged within the photography angle of view, the photography control unit 21 obtains a photographic image of the printed matter P and its surroundings, specifically, a live preview image GL, by executing the photography processing.
[0099] (Inference)
[0100] The inference unit 22 performs inference processing to infer a first range including the printed matter P in the live preview image GL (photographic image) acquired by the photography control unit 21. In the inference processing, the first range is inferred by applying a range inference model to the live preview image GL (photographic image). The range inference model is constructed by performing machine learning on the printed matter P, more specifically, by performing machine learning on the appearance of the printed matter P.
[0101] The appearance of the printed product P used in the machine learning is at least one of the size and shape of the printed product P and the features of the printed surface of the printed product P. The machine learning is implemented using images of a plurality of printed products P having various appearances as learning data. Based on the appearance of the printed product P shown in the live preview image GL, the printed product P is identified according to the range inference model constructed by the machine learning, and the position, shape and size of the printed product P in the live preview image GL are inferred.
[0102] As described above, in the present embodiment, the range estimation model constructed by machine learning is used, thereby being able to appropriately and accurately estimate the first range as the range where the printed matter P exists in the live preview image.
[0103] In addition, the type of machine learning is not limited, and it can be any of teacher-supervised learning, unsupervised learning, and reinforcement learning. In addition, there is no particular limitation on the algorithm of machine learning, and well-known algorithms such as error back propagation method and gradient descent method can be used.
[0104] Furthermore, the range inference model constructed by machine learning is an arbitrary mathematical model, and specific examples thereof include neural networks, convolutional neural networks, recurrent neural networks, attention, transformers, generative adversarial networks, deep learning neural networks, etc. In addition, for example, as a range inference model, a Boltzmann machine, matrix decomposition, decomposition machine, Amway decomposition machine, field-aware decomposition machine, field-aware neural decomposition machine, support vector machine, Bayesian network, decision tree, or random forest, etc., can be used.
[0105] Furthermore, machine learning may be implemented by the image processing device 10. In this case, the range inference model is stored in the storage device 12G or the like, and the inference unit 22 may read the range inference model from the storage device 12G or the like when performing the inference process. Alternatively, machine learning may be implemented by an external device (not shown) different from the image processing device 10. In this case, the inference unit 22 is provided with the range inference model by the device that implements machine learning, thereby being able to perform the inference process using the same model.
[0106] (Settings)
[0107] The setting unit 23 performs setting processing based on the first range estimated by the estimation unit 22. In the setting processing, based on the first range, a second range that includes the first range and is wider than the first range is set in the live preview image GL. In this way, in the setting processing, the second range is set so that the printed matter image GP is included in the range with a high probability. That is, in this embodiment, the second range can be set so that the edge of the printed matter image GP can be detected more reliably in the detection processing described later.
[0108] (Detection Department)
[0109] The detection unit 24 performs detection processing on the live preview image GL acquired by the photographing processing. In the detection processing, in the live preview image GL, a specific area, that is, an edge, is detected in the second range set by the setting processing. When the entire printed matter P is reflected in the live preview image GL, each side of the rectangle formed by the outer edge of the printed matter P, that is, four sides, is detected as an edge.
[0110] Furthermore, in the detection process of the present embodiment, the detection unit 24 detects the second edge as the edge of the region where the dark region K exists in the printed matter image GP, and detects the first edge as the edge of the region where the dark region K does not exist. The specific sequence of the detection process will be described in detail in the following items.
[0111] (Display control unit)
[0112] The display control unit 25 performs display processing by controlling the display (display device) of the user terminal 12. In the display processing, the screen of the display displays the live preview image GL obtained by the photographing processing. The display processing is performed simultaneously with the photographing processing during the execution of the photographing processing. That is, during the photographing of the printed matter P, the live preview image GL including the printed matter P is displayed on the screen.
[0113] Furthermore, when executing the display process, the display control unit 25 superimposes the edge-indicating graphic OJ detected by the above-mentioned detection process on the live preview image GL (reference Figure 5C ). At this time, when the second edge is detected by the detection process, the detected graphic OJ representing the second edge is superimposed on the live preview image GL.
[0114] (Extraction Department)
[0115] When the user performs a capture operation (an example of an operation), the extraction unit 26 performs an extraction process based on the operation. In the extraction operation, an image defined by the edge detected by the detection unit 24 (in other words, the edge represented by the above-mentioned graph OJ) is extracted and captured from the photographic image at the time when the capture operation is performed, that is, the printed matter image GP. In the extraction process when the detection unit 24 detects the second edge, the printed matter image GP is extracted from the photographic image based on the detected second edge.
[0116] (Calibration Department)
[0117] The correction unit 27 performs correction processing on the printed matter image GP extracted by the extraction unit 26 . In the correction processing, for example, keystone correction is performed to correct the printed matter image GP to an image when the printed matter P is viewed from the front.
[0118] In addition, regarding the trapezoidal correction, since a well-known image processing technology related to the trapezoidal correction can be used, the description of the specific procedure is omitted.
[0119] (Preservation Department)
[0120] The storage unit 28 executes storage processing to store the printed matter image GP extracted by the extraction unit 26 in the storage device 12G etc. In the storage processing when the correction unit 27 performs trapezoidal correction on the printed matter image GP, the printed matter image GP after the trapezoidal correction is stored.
[0121] <<About the order of detection processing>>
[0122] Regarding the above detection process, Figures 7-10 The sequence is explained below. Figure 8 and 9 This is a partially enlarged view of the live preview image GL, and specifically, is an image showing an enlarged view of the periphery of the edge of the printed product P adjacent to the dark area K.
[0123] In the detection process, the first detection process, the determination process and the second detection process are sequentially performed. In the first detection process, an edge detection algorithm is applied to the photographic image to detect a first edge in the live preview image GL within the second range. The first edge is detected by applying a known edge detection algorithm.
[0124] Specifically, in the first detection process, first, the color information of each pixel in the second range is determined from the outer edge of the second range to the inner side, specifically, the grayscale value, concentration, brightness, or color space coordinate value of each pixel. Then, when the color information between two adjacent pixels changes significantly, that is, when the color difference between the pixels becomes greater than a threshold, for example, the pixel closer to the inner side is specified as a pixel on the first edge. The first edge is detected by sequentially detecting such pixels.
[0125] In the first detection process, in the live preview image GL, the edge of the printed matter image GP, that is, the image of the outer edge of the printed matter P is originally detected as the first edge. In addition, in the first detection process, a plurality of edges surrounding the printed matter image GP are detected, specifically, Figure 7 As shown, four first edges ( Figure 7 In the figure, it is marked as symbol E1).
[0126] On the other hand, the instant preview image in GL, such as Figure 7 As shown in FIG. 1 , a dark area K such as an image of a shadow of the printed matter P may exist at a position adjacent to a part of the outer edge of the printed matter P. In this case, in the first detection process, the boundary of the dark area K, that is, the boundary on the side opposite to the printed matter P in the image of the dark area K is detected as the first edge. This first edge is not the original edge of the printed matter image GP, and it is necessary to detect the correct edge of the printed matter image GP. Therefore, in the present embodiment, the detection unit 24 performs the determination process and the second detection process after performing the first detection process.
[0127] Furthermore, in the present embodiment, a plurality of first edges are detected in the first detection process, and the determination process and the second detection process are executed for each of the plurality of first edges. To explain in more detail, in the first detection process, since four first edges are detected corresponding to the four sides of the rectangle formed by the outer edge of the printed matter P, the determination process and the second detection process are repeatedly executed four times.
[0128] In the determination process, first, the target range is set in the second range. The target range is a range with the first edge as one end and a position spaced a preset number of pixels from the first edge as the other end. When the first edge extends in a straight line or a substantially straight line, one end and the other end of the target range are two ends of the target range in a direction orthogonal to the first edge. And, the other end of the target range is an end located on the printed matter image GP side when viewed from one end (i.e., the first edge) of the target range.
[0129] And, if Figure 8 As shown, the object range (in Figure 8 The width of the target range is determined by the number of pixels from one end to the other end of the target range, and the number of pixels (hereinafter, the number of pixels m: m is a natural number) is preset. More specifically, regarding the target range set for the area where the dark area K exists, as shown in FIG. Figure 8 As shown, the number of pixels m is set so that the dark area K is included in the target range.
[0130] Furthermore, the number of pixels m becomes smaller than the number of pixels corresponding to the width and length of the frame area R of the printed matter P. With this setting, for example, it is possible to avoid detecting the boundary between the frame area R and the print area M of the printed matter P as the second edge. In other words, the second edge is detected outside the boundary between the frame area R and the print area M.
[0131] Furthermore, the number of pixels m can be set arbitrarily as long as it is a value smaller than the number of pixels corresponding to the width and length of the frame area R. For example, it can be determined according to the distance (interval) between the photographing device 12F and the printed matter P when photographing the printed matter P. For example, the number of pixels m can be set to about 15 pixels. Furthermore, when the distance between the photographing device 12F and the printed matter P changes, the number of pixels m can be dynamically changed in conjunction with the change.
[0132] When the target range is set, a plurality of first points arranged along the first edge are then set at one end of the target range. Fig. 9 As shown, multiple first points are determined on the first edge (in Fig. 9 in the figure, marked with a black dot).
[0133] In addition, the plurality of first points are not limited to being set on the first edge, and may be set at positions closer to the other end of the target range than the first edge.
[0134] Furthermore, the number of first points to be set and the interval (pitch) between two adjacent first points are not particularly limited, and are preferably values suitable for detecting the second edge.
[0135] Then, if Fig. 9 As shown, a plurality of second points in the target range are determined corresponding to the plurality of first points that are set (in Fig. 9 In the figure, the first point is indicated by a white dot. At this time, the second point is determined based on the information of the first point corresponding to the second point and the color of each point. The color information refers to the grayscale value, concentration, brightness or coordinate value of the pixel at the position of each of the first point and the second point in the color space, and in this embodiment, it is the grayscale value of the three colors RGB (Red Green Blue). In addition, the grayscale value is not limited to the value expressed in the RGB color space, for example, it can be a coordinate value expressed in the HSV (Hue, Saturation Chroma, Value Brightness) space.
[0136] When explaining the order of determining the plurality of second points, calculation processing and point determination processing are performed on each of the plurality of first points. In the calculation processing, an object point within the object range is set, and the color difference between the pixel of the first point and the pixel of the object point is calculated while shifting the object point from one first point to the other end of the object range in a direction orthogonal to the first edge by one pixel at a time. Fig.10 When describing this, the color difference between the pixel #2 to the pixel #m and the pixel #1 corresponding to the first point is calculated.
[0137] In the point determination process, it is determined whether there is a target point whose color difference obtained by the calculation process is greater than or equal to a threshold value. Then, among the target points whose color difference is greater than or equal to the threshold value, the target point whose color difference is the largest is determined as the second point.
[0138] exist Fig.10 In the case where the object point is a pixel of #k (k is a natural number greater than or equal to 2), and when the object point is a pixel of #k+1, the color difference becomes greater than the threshold value. In this case, the color difference calculated for the pixel of #k+1 becomes the largest, and the point (object point) located at the pixel of #k+1 is determined as the second point.
[0139] In addition, the above threshold value can be set to an appropriate value for determining the second point.
[0140] In the above sequence, as an example of a method for determining the second point, a method for generating a maximum image (MaxImage) can be cited. When explaining the sequence for generating the maximum image (MaxImage), first, bilateral filtering is applied to the RGB image constituting the instant preview image GL. The RGB image to which the bilateral filtering is applied is converted into a grayscale image. Furthermore, the RGB image to which the bilateral filtering is applied is divided into component images of an R image, a G image, and a B image. Furthermore, the RGB image to which the bilateral filtering is applied is converted into an image in the HSV space, and channels of hue and saturation are extracted from the converted image, and the image of each channel is separated.
[0141] As described above, with respect to the RGB image, six single-channel images are obtained, namely, a grayscale image (Gray), a saturation image (Saturation), a hue image (Hue), an R image (Red), a G image (Green), and a B image (Blue). Then, median blur, Gaussian blur, and Canny (precision) filtering are applied to each of the six single-channel images. Then, from the grayscale values of the pixels at each position in each single-channel image, the maximum grayscale value in the six channel images is specified for the pixels at each position by the following formula (1), and this value is set as the grayscale value of the pixels at each position.
[0142] [Mathematical formula 1]
[0143] MaxImage[i][j]=Max(Gray[i][j], Saturation[i][j], Hue[i][j], Red[i][j], Green[i][j], Green[i][j], Blue[i][j]) Formula (1)
[0145] Then, the grayscale value of the pixel at each position is set by the above method to generate a maximum image (MaxImage). Then, using the generated maximum image (MaxImage), for each of the plurality of first points on the first edge, a point where the grayscale value of the maximum image (MaxImage) becomes the maximum is found on a virtual line passing through the first point and orthogonal to the first edge. The point (pixel) thus found is determined as the second point.
[0146] The determination process is performed in the above order. Then, in the determination process when the dark area K is included in the object range, multiple second points corresponding to multiple first points are determined in the object range. Specifically, multiple second points are determined along the boundary of the dark area K included in the object range.
[0147] After the determination process is executed, the second detection process is executed. In the second detection process, the second edge is detected based on the determined plurality of second points. Specifically, the OpenCV fitLine (straight line fitting function) algorithm is applied to determine a line passing through the plurality of second points, and the determined line is detected as the second edge.
[0148] By performing the detection process in the above-described order, when the image of the dark area K is adjacent to the printed matter image GP, the second edge located at the boundary of the two images can be detected. As a result, the edge of the printed matter image GP is correctly detected. As a result, in the subsequent extraction process, the printed matter image GP without the image of the dark area K can be extracted and captured from the photographic image based on the detected second edge.
[0149] <<Operation Example of Image Processing Device According to One Embodiment of the Present Invention>>
[0150] Next, as an example of the operation of the image processing device 10 in this embodiment, an image processing flow using the image processing device 10 is described. In the image processing flow described below, the image processing method of the present invention is used. That is, each step in the image processing flow described below is equivalent to a constituent element of the image processing method of the present invention.
[0151] The following process is merely an example, and part of the steps in the process may be deleted, or a new step may be added to the process, or the execution order of two steps in the process may be replaced without departing from the gist of the present embodiment.
[0152] Each step in the image processing flow according to the present embodiment is performed by the processor 12A included in the user terminal 12 constituting the image processing device 10. Fig.11 Then, in each step in the image processing flow, the processor 12A executes processing corresponding to each step from among the data processing specified in the image processing program.
[0153] When the image processing flow is implemented, the user creates a printed product P through the printer 50. Then, the user starts the image processing program by operating the user terminal 12. Thus, the image processing flow starts.
[0154] In the image processing flow, first, the processor 12A executes a photographic process of acquiring a photographic image by controlling the photographic device 12F of the user terminal 12 (S001). At this point in time, the printed matter P is arranged within the photographic angle of view of the photographic device 12F. Therefore, in the photographic process, the printed matter P and its surroundings are photographed, and a live preview image GL as a photographic image is acquired.
[0155] While the photographing process is being executed, the processor 12A repeatedly executes the estimation process ( S002 ), the setting process ( S003 ), the detection process ( S004 ), and the display process ( S005 ).
[0156] In the estimation process, the first range (reference number) including the printed matter P in the live preview image GL is estimated by applying the above-mentioned range estimation model to the live preview image GL (photographic image). Figure 5B ). That is, in the image processing flow, by using the learning results of the machine learning on the printed product P, the range where the printed product P exists in the live preview image can be accurately inferred.
[0157] In the setting process, based on the first range estimated by the estimation process, a second range (see FIG. 1 ) that includes the first range and is wider than the first range is set in the live preview image GL. Figure 5B ). The set second range roughly and reliably includes the entire printed matter image GP.
[0158] In the detection process, the edge of the printed matter image GP is detected in the second range. When the entire printed matter P is shown in the live preview image GL, each side of the rectangle formed by the outer edge of the printed matter P, that is, each of the four sides is detected as an edge.
[0159] Detection and processing based on Fig.12In detail, the first detection process (S021) is performed in the detection process. In the first detection process, a known edge detection algorithm is applied to the live preview image GL (photographic image). As a result, the first edge is detected within the second range set by the setting process. In particular, when the entire printed matter image GP is included in the second range, four first edges are detected corresponding to the four sides formed by the outer edge of the printed matter P.
[0160] After the first detection process is executed, the determination process (S022) and the second detection process (S023) are executed. The determination process is executed by the above-mentioned method. Specifically, in the second range, the setting range is set with the first edge as a reference, and a plurality of first points are set on one end side of the setting range, for example, on the first edge. Then, in the setting range, a plurality of second points corresponding to the plurality of first points are determined. Each of the plurality of second points is determined based on the color difference between the corresponding first point and the second point.
[0161] In the second detection process, the second edge is detected based on the plurality of second points determined by the determination process. Thus, even if a dark area K such as a shadow exists at a position adjacent to the printed matter P and the boundary of the dark area K is detected as the first edge, the second edge as the edge of the original printed matter image GP can be detected.
[0162] Then, the identification process and the second detection process are executed for each of the plurality of first edges detected by the first detection process ( S024 ).
[0163] In addition, in the printed matter image GP, the second edge is not detected with respect to the first edge located in the region where the dark region K does not exist. In this case, the first edge becomes the edge of the printed matter image GP.
[0164] Returning to the description of the image processing flow, in the display process, the live preview image GL is displayed on the screen of the user terminal 12. In addition, in the display process, a graphic OJ indicating the edge (specifically, the second edge or the first edge) of the printed matter image GP detected in the detection process is superimposed on the live preview image GL for display. Thus, the user can easily confirm the position, shape, and size of the printed matter image GP by observing the graphic OJ on the screen. In addition, the user can understand the edge of the printed matter image GP detected in the live preview image GL through the display of the graphic OJ.
[0165] Then, when the user performs a capture operation through the user terminal 12 while the graph OJ is displayed on the screen (S006), the processor 12A receives the capture operation and performs extraction processing (S007). In the extraction processing, the printed matter image GP defined by the edge represented by the graph OJ is extracted from the photographic image at the time when the capture operation is performed.
[0166] Then, the processor 12A performs a correction process in which a trapezoidal correction is appropriately performed on the extracted printed matter image GP (S008). In addition, when the extracted printed matter image GP is an image when the printed matter P is viewed from the front, in other words, when the edge of the printed matter image GP is an accurate rectangle, the execution of the correction process can be omitted.
[0167] Then, the processor 12A stores the extracted printed matter image GP or the printed matter image GP subjected to keystone correction in a storage device or the like ( S009 ).
[0168] The series of steps S001 to S009 described above are repeatedly executed until the end of the photographing (S010). Then, when the photographing is ended, the image processing flow is completed.
[0169] <<Other implementation methods>>
[0170] Although the present invention has been described in detail above, the above embodiment is only an example for easy understanding of the present invention and does not limit the present invention. That is, the present invention can be changed or improved from the embodiment described below as long as it does not deviate from its purpose. And, the present invention includes its equivalent. In addition, in an embodiment of the present invention, the above embodiment can be combined with one or more of the following variations.
[0171] (Method for determining point 2)
[0172] In the above embodiment, as one of the methods for detecting the second edge, a method for detecting the second edge by creating a maximum image (MaxImage) to determine a plurality of second points (grayscale points) is described. However, this is not limited thereto, and the second edge may be detected by a common edge detection method, such as a Sobel filter or a Canny method or other well-known edge detection methods.
[0173] (About dark areas)
[0174] In the above embodiment, in the photographic image of the printed matter P, when there is an image of a shadow as a dark area K adjacent to the outer edge of the printed matter P, the printed matter image GP is extracted as an image from which the shadow is removed. Therefore, in the above embodiment, the second edge is detected at a position inside the first edge, and the detected second edge is regarded as the boundary between the image of the shadow and the printed matter image GP. However, the dark area K is not limited to the shadow, and may be an area darker than the original brightness of the frame area R of the printed matter P (specifically, the background color of the printed surface of the photosensitive film F). For example, the area that fades at the outer edge of the printed matter P may be set as the dark area K.
[0175] (About edge detection range)
[0176] In the above embodiment, in the live preview image GL as a photographic image, the first range included in the printed matter is estimated, a second range wider than the first range and including the first range is set, and the edge of the printed matter image GP is detected in the second range. However, this is not limiting, and the edge of the printed matter image GP may be detected in the first range.
[0177] (About processor types)
[0178] The processor included in the image processing device of the present invention includes various processors. The various processors include, for example, a general-purpose processor, namely, a CPU that executes software (program) to function as various processing units.
[0179] In addition, various processors include FPGA (Field Programmable Gate Array) and other processors whose circuit structure can be changed after manufacturing, namely PLD (Programmable Logic Device).
[0180] Furthermore, various processors include processors having a circuit structure specially designed to execute specific processing, such as ASIC (Application Specific Integrated Circuit), that is, dedicated circuits.
[0181] Furthermore, one processing unit of the image processing device of the present invention may be constituted by one of the various processors described above, or may be constituted by a combination of two or more processors of the same or different types, such as a combination of multiple FPGAs or a combination of an FPGA and a CPU.
[0182] Furthermore, the plurality of functional units included in the image processing apparatus of the present invention may be constituted by one of various processors, or two or more of the plurality of functional units may be constituted by one processor.
[0183] Furthermore, as in the above-described embodiment, a combination of one or more CPUs and software may constitute one processor, and the processor may function as a plurality of functional units.
[0184] For example, a processor that realizes the functions of the entire system including multiple functional units in the image processing device of the present invention through one IC (Integrated Circuit) chip, such as SoC (System On Chip) or the like, may be used. Furthermore, the hardware structure of the various processors described above may be a circuit (Circuitry) that combines circuit elements such as semiconductor elements.
Claims
1. An image processing device for extracting an image corresponding to a printed matter from a photographic image, wherein: The image processing device includes a processor. The processor performs an inference process of applying a range inference model constructed by machine learning related to the printed matter to the photographic image, thereby inferring a first range in the photographic image that includes the printed matter.
2. The image processing device according to claim 1, wherein: In the inference processing, the processor applies the range inference model constructed by the machine learning related to the appearance of the printed matter to the photographic image, thereby inferring the first range.
3. The image processing device according to claim 2, wherein: The appearance is at least one of the size and shape of the printed matter and the characteristics of the printed surface of the printed matter.
4. The image processing device according to any one of claims 1 to 3, wherein: The processor performs the following processing: a setting process of setting, based on the first range, a second range in the photographic image that includes the first range and is wider than the first range; and The detection process detects a specific area of the image corresponding to the printed matter within the second range.
5. The image processing device according to claim 4, wherein: The processor causes a graphic representing the specific area of the image corresponding to the printed matter detected by the detection process to be superimposed on the photographic image.
6. The image processing device according to claim 5, wherein: The processor causes the graphic to be superimposed on a live preview image serving as the photographic image.
7. The image processing device according to claim 5, wherein: The processor executes extraction processing of extracting an image corresponding to the printed matter from the photographic image based on a user operation.
8. The image processing device according to claim 7, wherein: The image corresponding to the printed matter is specified by the specific area or the graphic of the image corresponding to the printed matter.
9. The image processing apparatus according to claim 4, wherein: In the detection process, the processor performs the following processes: a first detection process of applying an edge detection algorithm to the photographic image to detect a first edge in the photographic image; Determine processing, setting the first edge as one end and the position spaced a preset number of pixels from the first edge as the other end of the object range, and corresponding to the plurality of first points arranged along the first edge on the one end side of the object range, determine a plurality of second points in the object range based on information on the colors of the first points and the following second points; and The second detection process detects a second edge based on the plurality of second points. The processor executes extraction processing for extracting an image corresponding to the printed matter from the photographic image based on the detected second edge.
10. The image processing device according to claim 9, wherein: In the determination process, the processor performs the following processes on each of the plurality of first points: while shifting the object point within the object range from the first point toward the other end by one pixel at a time, calculating the color difference between the pixel at the first point and the pixel at the object point; and Among the target points at which the color difference is equal to or greater than a threshold value, the target point at which the color difference is the largest is determined as the second point.
11. The image processing apparatus according to claim 9, wherein: In the determination process, the processor determines a plurality of the first points on the first edge.
12. The image processing apparatus according to claim 9, wherein: When a plurality of the first edges are detected in the first detection process, the processor executes the identification process and the second detection process for each of the plurality of first edges.
13. The image processing apparatus according to claim 9, wherein: When the printing surface of the printed product includes a printing area where a printed image is printed and a frame area located around the printing area, the preset number of pixels is smaller than the number of pixels corresponding to the width and length of the frame area.
14. The image processing apparatus according to claim 9, wherein: The processor further executes a display process for displaying the photographic image on a screen. When executing the display processing, the processor causes a graphic representing the second edge detected by the second detection processing to be superimposed on the photographic image.
15. The image processing apparatus according to claim 9, wherein: In the case where a dark area exists in the photographic image at a position adjacent to the printed matter, the processor performs the following processing: In the first detection process, in the image of the dark area, a boundary located on the side opposite to the printed matter is detected as the first edge; In the determination process, a plurality of the second points are determined corresponding to a plurality of the first points located on the first edge within the object range of the image including the dark area; In the second detection process, the second edge is detected based on the plurality of second points; and In the extraction process, an image corresponding to the printed matter from which the dark area is removed is extracted from the photographic image based on the detected second edge.
16. The image processing apparatus according to claim 9, wherein: The printed matter is a medium with a printed image printed on the printing surface.
17. An image processing method for extracting an image corresponding to a printed matter from a photographic image, wherein: The image processing method includes the following steps: a processor applies a range inference model constructed by machine learning related to the printed matter to the photographic image, thereby inferring a first range in the photographic image that includes the printed matter.
18. The image processing method according to claim 17, comprising the following steps: The processor sets, based on the first range, a second range in the photographic image that includes the first range and is wider than the first range; and The processor detects a specific area of the image corresponding to the printed matter within the second range.
19. The image processing method according to claim 18, wherein: The step of detecting the specific area of the image corresponding to the printed matter includes the following steps: the processor detecting a first edge in the photographic image by applying an edge detection algorithm to the photographic image, The processor sets an object range having the first edge as one end and a position spaced a preset number of pixels from the first edge as the other end, and determines a plurality of second points in the object range based on information on the colors of the first point and the following second point, corresponding to a plurality of first points arranged along the first edge on the one end side in the object range. The processor detects a second edge based on the plurality of second points; and The processor extracts an image corresponding to the printed matter from the photographic image based on the detected second edge.
20. A recording medium, which is a computer-readable recording medium, wherein: The recording medium records a program for causing a computer to implement the steps included in the image processing method according to any one of claims 17 to 19.
