Light source determination method, apparatus, electronic equipment and storage medium

By generating a pseudo-hyperspectral image cube and applying a hyperspectral image analysis algorithm, the problem of low light source selection efficiency is solved, and the effect of quickly determining the target light source is achieved.

CN114719966BActive Publication Date: 2026-03-06FU TAI HUA IND SHENZHEN +1
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-22
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

In existing technologies, determining the light source of a prominent defect requires analyzing image data from different light sources separately, which is time-consuming and inefficient.

Method used

By acquiring multiple grayscale images of an object carrying the target defect, a pseudo-hyperspectral image cube is generated. Hyperspectral image analysis algorithms are then used to determine the spectral wavelength and defect information of the target defect, generating a spectral feature curve, thereby identifying the target light source.

Benefits of technology

It can quickly identify the target light source from multiple light sources, improving the efficiency of light source selection and simplifying the light source selection process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114719966B_ABST
    Figure CN114719966B_ABST
Patent Text Reader

Abstract

This application relates to image processing technology, and provides a method, apparatus, electronic device, and storage medium for determining a light source. The method includes: acquiring multiple grayscale images of an object carrying a target defect, wherein different grayscale images correspond to different light sources; generating a pseudo-hyperspectral image cube based on the multiple grayscale images; determining defect information and spectral wavelength corresponding to the target defect from the pseudo-hyperspectral image cube; generating a spectral feature curve based on the defect information and the spectral wavelength; and determining the target light source from the spectral feature curve using a hyperspectral image analysis algorithm. This application can improve the efficiency of light source selection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to a method, apparatus, electronic device and storage medium for determining a light source. Background Technology

[0002] Currently, automatic optical inspection technology can be used to detect whether an object has defects. However, in practice, it has been found that before detecting a certain defect in an object, it is necessary to analyze the image data collected from different light sources separately and conduct a large number of experiments to determine the light source that should highlight the defect, which takes a long time.

[0003] Therefore, how to select the light source is a technical problem that urgently needs to be solved. Summary of the Invention

[0004] In view of the above, it is necessary to provide a light source determination method, apparatus, electronic device, and storage medium that can improve the efficiency of light source selection.

[0005] A first aspect of this application provides a method for determining a light source, the method comprising:

[0006] Multiple grayscale images of an object carrying a target defect are acquired, wherein different grayscale images correspond to different light sources;

[0007] Based on the multiple grayscale images, a pseudo-hyperspectral image cube is generated;

[0008] From the pseudo-hyperspectral image cube, determine the defect information and spectral wavelength corresponding to the target defect;

[0009] Based on the defect information and the spectral wavelength, a spectral characteristic curve is generated;

[0010] The target light source is determined from the spectral feature curves based on the hyperspectral image analysis algorithm.

[0011] In one possible implementation, the width of the spectral image cube is the width of the grayscale image, the length of the spectral image cube is the length of the grayscale image, and the height of the spectral image cube is the range of spectral wavelengths of the light sources corresponding to the plurality of grayscale images.

[0012] In one possible implementation, acquiring multiple grayscale images of the object carrying the target defect includes:

[0013] Acquire multiple images of the object carrying the target defect under different light sources;

[0014] According to the grayscale conversion algorithm, the multiple images are converted to grayscale to obtain multiple grayscale images.

[0015] In one possible implementation, the grayscale conversion algorithm includes any one of the following: floating-point algorithm, integer algorithm, shift algorithm, average algorithm, and green-only algorithm.

[0016] In one possible implementation, after generating a pseudo-hyperspectral image cube based on the plurality of grayscale images, the light source determination method further includes:

[0017] Hyperspectral image analysis is performed on the pseudo-hyperspectral image cube according to a preset analysis algorithm to obtain analysis data;

[0018] The analyzed data is saved to the database.

[0019] In one possible implementation, the preset analysis algorithm includes either a band selection algorithm or an orthogonal subspace projection algorithm.

[0020] In one possible implementation, after determining the target light source from the spectral feature curve according to the hyperspectral image analysis algorithm, the light source determination method further includes:

[0021] Acquire a detection image of a preset object under the target light source;

[0022] The detected image is subjected to automatic optical inspection to obtain a detection result, which is used to determine whether the preset object has the target defect or does not have the target defect.

[0023] A second aspect of this application provides a light source determining device, the light source determining device comprising:

[0024] The acquisition module is used to acquire multiple grayscale images of an object carrying the target defect, wherein different grayscale images correspond to different light sources;

[0025] The generation module is used to generate a pseudo-hyperspectral image cube based on the multiple grayscale images;

[0026] The determination module is used to determine the defect information and spectral wavelength corresponding to the target defect from the pseudo-hyperspectral image cube;

[0027] The generation module is further configured to generate a spectral feature curve based on the defect information and the spectral wavelength;

[0028] The determining module is further configured to determine the target light source from the spectral feature curve based on a hyperspectral image analysis algorithm.

[0029] A third aspect of this application provides an electronic device including a processor and a memory, wherein the processor is configured to implement the light source determination method by executing a computer program stored in the memory.

[0030] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the light source determination method.

[0031] Based on the above technical solution, this application can form a pseudo-hyperspectral image cube from multiple grayscale images of an object carrying a target defect. This allows the analysis algorithms associated with hyperspectral images to be used to analyze these grayscale images from different light sources and further determine the target light source. This not only enables the rapid determination of the target light source from multiple light sources but also improves the efficiency of light source selection. Attached Figure Description

[0032] Figure 1 This is a flowchart of a preferred embodiment of a light source determination method disclosed in this application.

[0033] Figure 2 This is a functional block diagram of a preferred embodiment of a light source determining device disclosed in this application.

[0034] Figure 3 This is a schematic diagram of the structure of an electronic device that implements the light source determination method of this application. Detailed Implementation

[0035] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0036] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.

[0037] The light source determination method of this application embodiment is applied in electronic devices, and can also be applied in a hardware environment consisting of an electronic device and a server connected to the electronic device via a network, executed jointly by the server and the electronic device. The network includes, but is not limited to, a wide area network (WAN), a metropolitan area network (MAN), or a local area network (LAN).

[0038] In this context, a server can refer to a computer system that provides services to other devices (such as electronic devices) on a network. A personal computer that can provide File Transfer Protocol (FTP) services can also be called a server. In a narrower sense, a server specifically refers to certain high-performance computers that can provide services over a network. Compared to ordinary personal computers, these computers have higher requirements for stability, security, and performance, and therefore differ in hardware such as CPU, chipset, memory, disk system, and network infrastructure.

[0039] The electronic device is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), and embedded devices. The electronic device may also include network devices and / or user devices. The network devices include, but are not limited to, single network devices, server groups composed of multiple network devices, or clouds based on cloud computing, which consist of a large number of hosts or network devices. Cloud computing is a type of distributed computing, consisting of a super virtual computer composed of a group of loosely coupled computers. The user devices include, but are not limited to, any electronic product that allows human-computer interaction via a keyboard, mouse, remote control, touchpad, or voice control device, such as personal computers, tablets, smartphones, and personal digital assistants (PDAs).

[0040] Please see Figure 1 , Figure 1 This is a flowchart of a preferred embodiment of a light source determination method disclosed in this application. The order of the steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements. The device executing the light source determination method can be an electronic device.

[0041] S11. Acquire multiple grayscale images of an object carrying the target defect, wherein different grayscale images correspond to different light sources.

[0042] Specifically, acquiring multiple grayscale images of an object carrying the target defect includes:

[0043] Acquire multiple images of the object carrying the target defect under different light sources;

[0044] According to the grayscale conversion algorithm, the multiple images are converted to grayscale to obtain multiple grayscale images.

[0045] The grayscale conversion algorithm includes any one of the following: floating-point algorithm, integer algorithm, shift algorithm, average algorithm, and green-only algorithm.

[0046] The target defect may include, but is not limited to, scratches, dents, and stains on an object.

[0047] The grayscale image can refer to an image represented by grayscale, which can also be considered as brightness. Grayscale can refer to the color depth in a black and white image, and its range is generally 0-255, with white being 255 and black being 0.

[0048] The light source may include, but is not limited to, light sources with different light intensities, light sources of different colors, and other special light sources.

[0049] In this optional implementation, a grayscale image (also known as a gray-scale map) is created by dividing the range of white and black into several levels according to a logarithmic relationship. Grayscale is divided into 256 levels. An image represented using grayscale is called a grayscale image. Any color is composed of the three primary colors: red, green, and blue. If the original color of a point is RGB(R,G,B), then the original color can be converted to grayscale using methods such as floating-point arithmetic, integer arithmetic, shift arithmetic, averaging arithmetic, and a green-only arithmetic. Specifically, the floating-point arithmetic can be: Gray = R*0.3 + G*0.59 + B*0.11; the integer arithmetic can be: Gray = (R*30 + G*59 + B*11) / 100; the shift arithmetic can be: Gray = (R*28 + G*151 + B*77) >> 8; the averaging arithmetic can be: Gray = (R + G + B) / 3; and the green-only arithmetic formula is: Gray = G. After obtaining Gray using any of the above methods, replace R, G, and B in the original RGB(R,G,B) with Gray to form a new color RGB(Gray,Gray,Gray), thus obtaining a grayscale image.

[0050] S12. Generate a pseudo-hyperspectral image cube based on the multiple grayscale images.

[0051] Wherein, the width of the spectral image cube is the width of the grayscale image, the length of the spectral image cube is the length of the grayscale image, and the height of the spectral image cube is the range of spectral wavelengths of the light sources corresponding to the plurality of grayscale images.

[0052] In this embodiment, the multiple grayscale images are two-dimensional (including the length and width of the image), and different light sources correspond to different spectral wavelengths. Using the spectral wavelength as the value of the third dimension, the multiple grayscale images are mapped into the three-dimensional dimension to obtain the pseudo-hyperspectral image cube.

[0053] As an optional implementation, after generating a pseudo-hyperspectral image cube based on the plurality of grayscale images, the light source determination method further includes:

[0054] Hyperspectral image analysis is performed on the pseudo-hyperspectral image cube according to a preset analysis algorithm to obtain analysis data;

[0055] The analyzed data is saved to the database.

[0056] The preset analysis algorithm includes either a band selection algorithm or an orthogonal subspace projection algorithm. The band selection algorithm selects a subset of bands that play a major role from all bands of the hyperspectral image, which not only significantly reduces the data dimensionality of the hyperspectral image but also preserves useful information relatively completely. The orthogonal subspace projection algorithm is a linear transformation that maps a vector space to itself.

[0057] In this optional implementation, the pseudo-hyperspectral image cube can be subjected to hyperspectral image analysis according to a preset analysis algorithm to obtain analysis data. In other words, more image information can be obtained from the perspective of hyperspectral images, which can be used for various subsequent analyses.

[0058] S13. Determine the defect information and spectral wavelength corresponding to the target defect from the pseudo-hyperspectral image cube.

[0059] The defect information can be pixel data of the area where the target defect is located.

[0060] In this embodiment of the application, the pixels of the target defect in each grayscale image region are determined as the defect information. Since the target defect of the object is known and fixed in each grayscale image region, the spectral wavelength corresponding to the target defect in each grayscale image region in the pseudo-hyperspectral image cube can be found.

[0061] S14. Generate a spectral characteristic curve based on the defect information and the spectral wavelength.

[0062] In this embodiment of the application, the spectral wavelengths corresponding to multiple light sources and the defect information can be fitted to generate a spectral feature curve. In a two-dimensional dimension, the horizontal axis of the spectral feature curve is the spectral wavelength, and the vertical axis is the defect information.

[0063] S15. Determine the target light source from the spectral feature curves based on the hyperspectral image analysis algorithm.

[0064] In this embodiment of the application, based on the spectral characteristics of the pixel data of the defect information, hyperspectral image analysis methods, such as band selection method and orthogonal subspace projection (OSP) algorithm, can be applied to determine the spectral wavelength that can highlight the defect. For example, a target band can be selected. The spectral wavelength data of the target defect in the target band differs the most from the spectral wavelength data of the background (the part of the object other than the target defect) in the target band. The light source corresponding to the spectral wavelength of the target band is the target light source.

[0065] As an optional implementation, after determining the target light source from the spectral feature curve according to the hyperspectral image analysis algorithm, the light source determination method further includes:

[0066] Acquire a detection image of a preset object under the target light source;

[0067] The detected image is subjected to automatic optical inspection to obtain a detection result, which is used to determine whether the preset object has the target defect or does not have the target defect.

[0068] Automated Optical Inspection (AOI) is a technology used to detect defects in objects, primarily for monitoring production processes. It typically includes detailed defect classification and component placement offset information.

[0069] exist Figure 1 In the described method, this application can form a pseudo-hyperspectral image cube from multiple grayscale images of an object carrying a target defect. This allows the analysis algorithms associated with hyperspectral images to be used to analyze these grayscale images from different light sources and further determine the target light source. This not only enables the rapid determination of the target light source from multiple light sources but also improves the efficiency of light source selection.

[0070] Please see Figure 2 , Figure 2 This is a functional block diagram of a preferred embodiment of a light source determining device disclosed in this application.

[0071] In some embodiments, the light source determining device operates in an electronic device. The light source determining device may include multiple functional modules composed of program code segments. The program code of each program segment in the light source determining device may be stored in a memory and executed by at least one processor to perform... Figure 1 Some or all of the steps in the described method for determining the light source.

[0072] In this embodiment, the light source determining device can be divided into multiple functional modules according to the functions it performs. The functional modules may include: an acquisition module 201, a generation module 202, and a determining module 203. The term "module" in this application refers to a series of computer program segments that can be executed by at least one processor and perform a fixed function, and which are stored in memory.

[0073] The acquisition module 201 is used to acquire multiple grayscale images of an object carrying a target defect, wherein different grayscale images correspond to different light sources.

[0074] The generation module 202 is used to generate a pseudo-hyperspectral image cube based on the plurality of grayscale images.

[0075] Wherein, the width of the spectral image cube is the width of the grayscale image, the length of the spectral image cube is the length of the grayscale image, and the height of the spectral image cube is the range of spectral wavelengths of the light sources corresponding to the plurality of grayscale images.

[0076] In this embodiment, the multiple grayscale images are two-dimensional (including the length and width of the image), and different light sources correspond to different spectral wavelengths. Using the spectral wavelength as the value of the third dimension, the multiple grayscale images are mapped into the three-dimensional dimension to obtain the pseudo-hyperspectral image cube.

[0077] The determination module 203 is used to determine the defect information and spectral wavelength corresponding to the target defect from the pseudo-hyperspectral image cube.

[0078] The defect information can be pixel data of the area where the target defect is located.

[0079] In this embodiment of the application, the pixels of the target defect in each grayscale image region are determined as the defect information. Since the target defect of the object is known and fixed in each grayscale image region, the spectral wavelength corresponding to the target defect in each grayscale image region in the pseudo-hyperspectral image cube can be found.

[0080] The generation module 202 is further configured to generate a spectral characteristic curve based on the defect information and the spectral wavelength.

[0081] In this embodiment of the application, the spectral wavelengths corresponding to multiple light sources and the defect information can be fitted to generate a spectral feature curve. In a two-dimensional dimension, the horizontal axis of the spectral feature curve is the spectral wavelength, and the vertical axis is the defect information.

[0082] The determining module 203 is further configured to determine the target light source from the spectral feature curve based on a hyperspectral image analysis algorithm.

[0083] In this embodiment, based on the spectral characteristics of the pixel data of the defect information, hyperspectral image analysis methods, such as band selection method and orthogonal subspace projection (OSP) algorithms, can be applied to determine the spectral wavelength that can highlight the defect, and the light source corresponding to the spectral wavelength is the target light source.

[0084] As an optional implementation, the acquisition module 201 acquires multiple grayscale images of the object carrying the target defect in the following specific manner:

[0085] Acquire multiple images of the object carrying the target defect under different light sources;

[0086] According to the grayscale conversion algorithm, the multiple images are converted to grayscale to obtain multiple grayscale images.

[0087] The grayscale conversion algorithm includes any one of the following: floating-point algorithm, integer algorithm, shift algorithm, average algorithm, and green-only algorithm.

[0088] The target defect may include, but is not limited to, scratches, dents, and stains on an object.

[0089] The grayscale image can refer to an image represented by grayscale, which can also be considered as brightness. Grayscale can refer to the color depth in a black and white image, and its range is generally 0-255, with white being 255 and black being 0.

[0090] The light source may include, but is not limited to, light sources with different light intensities, light sources of different colors, and other special light sources.

[0091] In this optional implementation, a grayscale image (also known as a gray-scale map) is created by dividing the range of white and black into several levels according to a logarithmic relationship. Grayscale is divided into 256 levels. An image represented using grayscale is called a grayscale image. Any color is composed of the three primary colors: red, green, and blue. If the original color of a point is RGB(R,G,B), then the original color can be converted to grayscale using methods such as floating-point arithmetic, integer arithmetic, shift arithmetic, averaging arithmetic, and a green-only arithmetic. Specifically, the floating-point arithmetic can be: Gray = R*0.3 + G*0.59 + B*0.11; the integer arithmetic can be: Gray = (R*30 + G*59 + B*11) / 100; the shift arithmetic can be: Gray = (R*28 + G*151 + B*77) >> 8; the averaging arithmetic can be: Gray = (R + G + B) / 3; and the green-only arithmetic formula is: Gray = G. After obtaining Gray using any of the above methods, replace R, G, and B in the original RGB(R,G,B) with Gray to form a new color RGB(Gray,Gray,Gray), thus obtaining a grayscale image.

[0092] As an optional implementation, the light source determining device may further include:

[0093] The analysis module is used to perform hyperspectral image analysis on the pseudo-hyperspectral image cube according to a preset analysis algorithm after the generation module 202 generates a pseudo-hyperspectral image cube based on the multiple grayscale images, and obtain analysis data.

[0094] The storage module is used to save the analyzed data to the database.

[0095] The preset analysis algorithm includes either a band selection algorithm or an orthogonal subspace projection algorithm. The band selection algorithm selects a subset of bands that play a major role from all bands of the hyperspectral image, which not only significantly reduces the data dimensionality of the hyperspectral image but also preserves useful information relatively completely. The orthogonal subspace projection algorithm is a linear transformation that maps a vector space to itself.

[0096] In this optional implementation, the pseudo-hyperspectral image cube can be subjected to hyperspectral image analysis according to a preset analysis algorithm to obtain analysis data. In other words, more image information can be obtained from the perspective of hyperspectral images, which can be used for various subsequent analyses.

[0097] As an optional implementation, the acquisition module 201 is further used to acquire a detection image of a preset object under the target light source after the determination module 203 determines the target light source from the spectral feature curve according to the hyperspectral image analysis algorithm;

[0098] The light source determining device may further include:

[0099] The detection module is used to perform automatic optical detection on the detection image to obtain detection results, which are used to determine whether the preset object has the target defect or does not have the target defect.

[0100] Automated Optical Inspection (AOI) is a technology used to detect defects in objects, primarily for monitoring production processes. It typically includes detailed defect classification and component placement offset information.

[0101] exist Figure 2 In the described light source determination device, this application can form a pseudo-hyperspectral image cube from multiple grayscale images of an object carrying a target defect, thereby enabling the analysis of these grayscale images of different light sources using analysis algorithms related to hyperspectral images, and further determining the target light source. This not only enables the rapid determination of the target light source from multiple light sources, but also improves the efficiency of light source selection.

[0102] like Figure 3 As shown, Figure 3 This is a schematic diagram of the structure of an electronic device that implements the light source determination method of this application. The electronic device 3 includes a memory 31, at least one processor 32, a computer program 33 stored in the memory 31 and executable on the at least one processor 32, and at least one communication bus 34.

[0103] Those skilled in the art will understand that Figure 3 The schematic diagram shown is merely an example of the electronic device 3 and does not constitute a limitation on the electronic device 3. It may include more or fewer components than shown, or combine certain components, or different components. For example, the electronic device 3 may also include input / output devices, network access devices, etc.

[0104] The electronic device 3 also includes, but is not limited to, any electronic product that can interact with a user via a keyboard, mouse, remote control, touchpad, or voice control device, such as a personal computer, tablet computer, smartphone, personal digital assistant (PDA), game console, interactive network television (IPTV), smart wearable device, etc. The network on which the electronic device 3 is located includes, but is not limited to, the Internet, wide area network, metropolitan area network, local area network, virtual private network (VPN), etc.

[0105] The at least one processor 32 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, transistor logic devices, discrete hardware components, etc. The processor 32 may be a microprocessor or any conventional processor. The processor 32 is the control center of the electronic device 3, connecting various parts of the electronic device 3 via various interfaces and lines.

[0106] The memory 31 can be used to store the computer program 33 and / or modules / units. The processor 32 implements various functions of the electronic device 3 by running or executing the computer program and / or modules / units stored in the memory 31 and calling the data stored in the memory 31. The memory 31 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device 3, etc. In addition, the memory 31 may include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, etc.

[0107] Combination Figure 1 The memory 31 in the electronic device 3 stores multiple instructions to implement a light source determination method, and the processor 32 can execute the multiple instructions to achieve the following:

[0108] Multiple grayscale images of an object carrying a target defect are acquired, wherein different grayscale images correspond to different light sources;

[0109] Based on the multiple grayscale images, a pseudo-hyperspectral image cube is generated;

[0110] From the pseudo-hyperspectral image cube, determine the defect information and spectral wavelength corresponding to the target defect;

[0111] Based on the defect information and the spectral wavelength, a spectral characteristic curve is generated;

[0112] The target light source is determined from the spectral feature curves based on the hyperspectral image analysis algorithm.

[0113] As an optional implementation, the width of the spectral image cube is the width of the grayscale image, the length of the spectral image cube is the length of the grayscale image, and the height of the spectral image cube is the range of spectral wavelengths of the light sources corresponding to the plurality of grayscale images.

[0114] As an optional implementation, acquiring multiple grayscale images of the object carrying the target defect includes:

[0115] Acquire multiple images of the object carrying the target defect under different light sources;

[0116] According to the grayscale conversion algorithm, the multiple images are converted to grayscale to obtain multiple grayscale images.

[0117] As an optional implementation, the grayscale conversion algorithm includes any one of the following: floating-point algorithm, integer algorithm, shift algorithm, average algorithm, and green-only algorithm.

[0118] As an optional implementation, after generating the pseudo-hyperspectral image cube based on the plurality of grayscale images, the processor 32 can execute the plurality of instructions to achieve the following:

[0119] Hyperspectral image analysis is performed on the pseudo-hyperspectral image cube according to a preset analysis algorithm to obtain analysis data;

[0120] The analyzed data is saved to the database.

[0121] As an optional implementation, the preset analysis algorithm includes either a band selection algorithm or an orthogonal subspace projection algorithm.

[0122] As an optional implementation, after determining the target light source from the spectral feature curve according to the hyperspectral image analysis algorithm, the processor 32 can execute the plurality of instructions to achieve the following:

[0123] Acquire a detection image of a preset object under the target light source;

[0124] The detected image is subjected to automatic optical inspection to obtain a detection result, which is used to determine whether the preset object has the target defect or does not have the target defect.

[0125] Specifically, the processor 32's implementation method for the above instructions can be found in [reference needed]. Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.

[0126] exist Figure 3 In the described electronic device 3, this application can form a pseudo-hyperspectral image cube from multiple grayscale images of an object carrying a target defect, thereby enabling the analysis of these grayscale images of different light sources using analysis algorithms related to hyperspectral images, and further determining the target light source. This not only enables the rapid determination of the target light source from multiple light sources, but also improves the efficiency of light source selection.

[0127] If the modules / units integrated in the electronic device 3 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program code can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).

[0128] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.

[0129] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0130] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.

[0131] It will be apparent to those skilled in the art that this application is not limited to the details of the exemplary embodiments described above, and that this application can be implemented in other specific forms without departing from the spirit or essential characteristics of this application. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of this application is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within this application. No reference numerals in the claims should be construed as limiting the scope of the claims. Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in this application may also be implemented by a single unit or device through software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any particular order.

[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.

Claims

1. A light source determination method, characterized by, The light source determination method comprises: acquiring a plurality of gray scale images of an object carrying a target defect, wherein different gray scale images correspond to different light sources; generating a pseudo-hyperspectral image cube according to the plurality of gray scale images, wherein the width of the pseudo-hyperspectral image cube is the width of the plurality of gray scale images, the length of the pseudo-hyperspectral image cube is the length of the plurality of gray scale images, and the height of the pseudo-hyperspectral image cube is the range of spectral wavelengths of the light sources corresponding to the plurality of gray scale images; determining defect information corresponding to the target defect and a spectral wavelength from the pseudo-hyperspectral image cube, comprising: determining pixel data of a region of the target defect on each gray scale image as the defect information, and searching for a spectral wavelength corresponding to the pixel region of the target defect in the gray scale images in the pseudo-hyperspectral image cube; generating a spectral feature curve according to the defect information and the spectral wavelength; determining a target light source from the spectral feature curve according to a hyperspectral image analysis algorithm.

2. The light source determination method according to claim 1, wherein The acquiring a plurality of gray scale images of an object carrying a target defect comprises: acquiring a plurality of images of the object carrying the target defect under different light sources; performing gray scale conversion on the plurality of images according to a gray scale conversion algorithm to obtain a plurality of gray scale images.

3. The light source determination method according to claim 2, wherein The gray scale conversion algorithm comprises any one of a floating point algorithm, an integer algorithm, a shift algorithm, an average value algorithm, and a green color only algorithm.

4. The light source determination method according to claim 1, wherein After the generating a pseudo-hyperspectral image cube according to the plurality of gray scale images, the light source determination method further comprises: performing hyperspectral image analysis on the pseudo-hyperspectral image cube according to a preset analysis algorithm to obtain analysis data; saving the analysis data into a database.

5. The light source determination method according to claim 4, wherein The preset analysis algorithm comprises any one of a wave band selection algorithm and an orthogonal subspace projection algorithm.

6. The light source determination method according to any one of claims 1 to 5, characterized in that, After the determining a target light source from the spectral feature curve according to a hyperspectral image analysis algorithm, the light source determination method further comprises: acquiring a detection image of a preset object under the target light source; performing automatic optical detection on the detection image to obtain a detection result, wherein the detection result is used to determine whether the preset object has the target defect or not.

7. A light source determining device, characterized in that, The light source determination device comprises: an acquisition module, configured to acquire a plurality of gray scale images of an object carrying a target defect, wherein different gray scale images correspond to different light sources; a generation module, configured to generate a pseudo-hyperspectral image cube according to the plurality of gray scale images, wherein the width of the pseudo-hyperspectral image cube is the width of the plurality of gray scale images, the length of the pseudo-hyperspectral image cube is the length of the plurality of gray scale images, and the height of the pseudo-hyperspectral image cube is the range of spectral wavelengths of the light sources corresponding to the plurality of gray scale images; a determination module, configured to determine defect information corresponding to the target defect and a spectral wavelength from the pseudo-hyperspectral image cube, comprising: determining pixel data of a region of the target defect on each gray scale image as the defect information, and searching for a spectral wavelength corresponding to the pixel region of the target defect in the gray scale images in the pseudo-hyperspectral image cube; The generating module is further configured to generate a spectral feature curve according to the defect information and the spectral wavelength. The determining module is further configured to determine a target light source from the spectral feature curve according to a hyperspectral image analysis algorithm.

8. An electronic device, comprising: The electronic device includes a processor and a memory, and the processor is configured to execute a computer program stored in the memory to implement the light source determination method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores at least one instruction, and the at least one instruction is executed by the processor to implement the light source determination method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Light source detection apparatus and method as well as image processing method

    CN101282489A

  • Backlight regulation method, adjustment device and display device

    CN105632413A

  • Target detection method and system based on space-spectrum combination local preserving projection algorithm

    CN110263777A