Image dirty identification method, system, readable medium and electronic device
By extracting the brightness and saturation parameters of endoscopic images and combining them with HSV color space and edge shape matching, dirty areas can be identified and labeled, solving the problem of image quality being affected by dirt on the endoscope lens and improving the accuracy and efficiency of diagnosis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ANKON MEDICAL TECH (SHANGHAI) CO LTD
- Filing Date
- 2023-07-31
- Publication Date
- 2026-05-01
AI Technical Summary
When an endoscope is used inside the body, the lens is easily contaminated with dirt, which affects image quality and may obscure or confuse lesions, making diagnosis difficult.
By extracting the brightness and saturation parameters of the image, the candidate area and the dirty area are determined. The dirty area is filtered out using the HSV color space, and bubbles or mucus are identified by edge extraction and shape matching.
Accurately identify and label dirty areas in endoscopic images to improve imaging quality, increase image reading efficiency, and avoid misjudgment.
Smart Images

Figure CN116977641B_ABST
Abstract
Description
Methods, systems, readable media, and electronic devices for image dirt recognition Technical Field
[0001] This application belongs to the field of computer technology, and specifically relates to a method, system, readable medium, and electronic device for identifying dirt in images. Background Technology
[0002] Capsule endoscopy, due to its painless, non-invasive nature and high diagnostic accuracy, is now widely used in the diagnosis of digestive system diseases. It primarily utilizes its own image acquisition device to capture images of the internal structure of the digestive system and other organisms, then transmits the numerous images to an external platform for final diagnosis.
[0003] However, endoscopes such as capsule endoscopes operate within the body, which is a complex process, and their lenses often become contaminated with dirt. This dirt affects the quality of the images captured by the endoscope and may obstruct or obscure lesions, hindering the identification of these lesions. Therefore, identifying contaminated areas in images created by endoscope dirt is a pressing technical problem that needs to be solved.
[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] The purpose of this application is to provide a method, system, medium, and electronic device for identifying dirt in images, which at least to some extent overcomes the technical problem in the related art of how to identify dirty areas in images caused by dirt in the endoscope.
[0006] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0007] According to one aspect of the embodiments of this application, a method for identifying dirt in an image is provided, the method comprising:
[0008] Acquire the image to be recognized;
[0009] Extract the first parameter and the second parameter of the image to be identified; wherein, the first parameter is brightness and the second parameter is saturation, or, the first parameter is saturation and the second parameter is brightness;
[0010] The region in the image to be identified where the first parameter is within a first preset range is determined as the candidate region;
[0011] The area in the candidate region where the second parameter is within a second preset range is defined as the dirty area, and the dirty area is used to represent the area in the image to be identified formed due to dirt on the endoscope;
[0012] Wherein, when the first parameter is brightness and the second parameter is saturation, the first preset range is a brightness range greater than the first preset brightness, and the second preset range is a saturation range less than the first preset saturation; when the first parameter is saturation and the second parameter is brightness, the first preset range is a saturation range less than the second preset saturation, and the second preset range is a brightness range greater than the second preset brightness.
[0013] According to one aspect of an embodiment of this application, a dirt recognition system for an image is provided. The system includes:
[0014] The image acquisition device is configured to acquire the image to be recognized;
[0015] A parameter extraction device is configured to extract a first parameter and a second parameter from the image to be identified; wherein the first parameter is brightness and the second parameter is saturation, or the first parameter is saturation and the second parameter is brightness;
[0016] The candidate region determination device is configured to determine the region in the image to be identified where the first parameter is within a first preset range as the candidate region;
[0017] A dirty area determination device is configured to determine a dirty area as a region in the candidate region where the second parameter is within a second preset range, the dirty area being used to represent a region in the image to be identified formed due to dirt on the endoscope;
[0018] Wherein, when the first parameter is brightness and the second parameter is saturation, the first preset range is a brightness range greater than the first preset brightness, and the second preset range is a saturation range less than the first preset saturation; when the first parameter is saturation and the second parameter is brightness, the first preset range is a saturation range less than the second preset saturation, and the second preset range is a brightness range greater than the second preset brightness.
[0019] In some embodiments of this application, based on the above technical solutions, the candidate area determination device includes:
[0020] The candidate region determination unit is configured to determine the smallest bounding rectangle of the region in the image to be identified where the first parameter is within a first preset range as the candidate region.
[0021] The image dirt recognition system also includes:
[0022] The target candidate region determination unit is configured to obtain the target candidate region with the largest area among the candidate regions;
[0023] The intersection-union ratio (IU) calculation unit is configured to calculate the IU ratio of the target candidate region to each other candidate region.
[0024] The candidate region discarding unit is configured to discard candidate regions whose intersection-union ratio with the target candidate region is greater than a first preset threshold.
[0025] In some embodiments of this application, based on the above technical solutions, the image dirt recognition system further includes:
[0026] An edge extraction unit is configured to extract the edges of the dirty area to obtain the edge shape of the dirty area;
[0027] An edge matching unit is configured to perform matching detection between the edge shape of the dirty area and the edge shape of the bubble sample in a preset database to obtain the shape matching degree between the edge shape of the dirty area and the edge shape of the bubble sample in the preset database.
[0028] The bubble region determination unit is configured to determine a dirty region with a shape matching degree greater than a preset matching degree as a bubble region, wherein the bubble region is used to represent the region in the image to be identified formed by bubbles on the endoscope.
[0029] In some embodiments of this application, based on the above technical solutions, the edge extraction unit includes:
[0030] A smoothing filter subunit is configured to perform smoothing filter processing on an image that includes the dirty area;
[0031] The gradient magnitude and direction calculation subunit is configured to calculate the image gradient magnitude and direction based on the smoothed image.
[0032] The edge intensity calculation subunit is configured to take pixels whose second derivative of the gradient magnitude in the gradient direction is zero as edge points and calculate the edge intensity of the edge points;
[0033] A strong edge point determination subunit is configured to mark a point as a strong edge point if the edge strength of the edge point is greater than a first threshold.
[0034] The weak edge point determination subunit is configured to mark the point as a weak edge point if the edge strength of the edge point is greater than a second threshold and less than a first threshold.
[0035] An edge shape determination subunit is configured to use the edge shape formed by the strong edge points and the weak edge points as the edge shape of the dirty area.
[0036] In some embodiments of this application, based on the above technical solutions, the first parameter is brightness and the second parameter is saturation; the candidate area determination device includes:
[0037] The first unit for obtaining the maximum and minimum values is configured to obtain the maximum and minimum values of the first parameter in the actual range of the pixel points in the candidate region;
[0038] The first unit for obtaining the difference is configured to calculate the difference between the maximum value and the minimum value;
[0039] The candidate region acquisition unit is configured to identify candidate regions whose difference is less than a second preset threshold and whose first parameter is within a first preset range as candidate regions.
[0040] In some embodiments of this application, based on the above technical solutions, the first parameter is saturation and the second parameter is brightness; the dirty area determination device includes:
[0041] The second unit for obtaining the maximum and minimum values is configured to obtain the maximum and minimum values of the second parameter of the pixels in the candidate region within the actual range of values.
[0042] The second difference acquisition unit is configured to calculate the difference between the maximum value and the minimum value;
[0043] The dirty area acquisition unit is configured to identify candidate areas whose difference is less than a second preset threshold and whose second parameter is within the second preset range as dirty areas.
[0044] In some embodiments of this application, based on the above technical solutions, the image dirt recognition system further includes:
[0045] The ratio determination unit is configured to calculate the ratio of the number of image pixels in the dirty area to the number of image pixels in the image to be identified;
[0046] The dirty area screening unit is configured to screen out dirty areas whose ratio is greater than a preset ratio.
[0047] In some embodiments of this application, based on the above technical solutions, when the first parameter is brightness and the second parameter is saturation, the second preset range is a saturation range that is greater than the third preset saturation and less than the first preset saturation.
[0048] When the first parameter is saturation and the second parameter is brightness, the first preset range is a saturation range that is greater than the fourth preset saturation and less than the second preset saturation.
[0049] According to one aspect of the embodiments of this application, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the image dirt recognition method as described in the above technical solutions.
[0050] According to one aspect of the embodiments of this application, an electronic device is provided, the electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform a dirt recognition method for an image as described above by executing the executable instructions.
[0051] According to one aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the image dirt recognition method as described in the above technical solutions.
[0052] In the technical solution provided in this application embodiment, a first parameter and a second parameter are extracted from the image to be identified; wherein, the first parameter is brightness and the second parameter is saturation, or the first parameter is saturation and the second parameter is brightness; the region in the image to be identified where the first parameter is within a first preset range is determined as a candidate region; the region in the candidate region where the second parameter is within a second preset range is determined as a dirty region; thereby, regions in the image to be identified where the saturation is less than a preset saturation and the brightness is greater than a preset brightness can be extracted and determined as dirty regions. It is known that regions in the image to be identified where the saturation is less than the preset saturation and the brightness is greater than the preset brightness are areas that are close to white, and the dirt on the endoscope is more likely to be white mucus, bubbles, etc. Therefore, determining regions where the saturation is less than the preset saturation and the brightness is greater than the preset brightness as dirty regions can accurately identify dirty regions formed by dirt on the endoscope.
[0053] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0054] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0055] Figure 1 schematically illustrates an exemplary device architecture block diagram applying the technical solution of this application.
[0056] Figure 2 schematically illustrates a flowchart of the steps of a dirt identification method for images according to certain embodiments of this application.
[0057] Figure 3 schematically illustrates a flowchart of the steps after determining the region in the image to be identified where the first parameter is within a first preset range as the candidate region in a certain embodiment of this application.
[0058] Figure 4 schematically illustrates a flowchart of the steps in a certain embodiment of this application to determine the region in the image to be identified where the first parameter is within a first preset range as the candidate region.
[0059] Figure 5 schematically illustrates a flowchart of the steps in a certain embodiment of this application to determine a dirty area as a region in the candidate region where the second parameter is within a second preset range.
[0060] Figure 6 schematically illustrates a flowchart of the steps after determining the area in the candidate area where the second parameter is within a second preset range as a dirty area in a certain embodiment of this application.
[0061] Figure 7 schematically illustrates a flowchart of the steps for edge extraction of a dirty area to obtain the edge shape of the dirty area in a certain embodiment of this application.
[0062] Figure 8 schematically illustrates a flowchart of the steps after determining the area in the candidate area where the second parameter is within a second preset range as a dirty area in a certain embodiment of this application.
[0063] Figure 9 schematically shows a block diagram of an image dirt recognition system provided in an embodiment of this application.
[0064] Figure 10 schematically illustrates a computer system architecture block diagram for implementing an electronic device according to an embodiment of this application. Detailed Implementation
[0065] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0066] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.
[0067] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0068] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0069] The system involved in the embodiments of this application can be a distributed system formed by connecting a client and multiple nodes (any form of computing device in the network, such as a server or user terminal) through network communication.
[0070] The following detailed description, in conjunction with specific embodiments, provides a method for identifying dirt in images, as well as the corresponding system, medium, electronic equipment, etc.
[0071] Figure 1 schematically illustrates an exemplary device architecture block diagram applying the technical solution of this application.
[0072] As shown in Figure 1, the device architecture 100 may include a terminal device 110, a network 120, and a server 130. The terminal device 110 may include various electronic devices such as smartphones, tablets, laptops, and desktop computers. The server 130 may be a standalone physical server, a server cluster or distributed device composed of multiple physical servers, or a cloud server providing cloud computing services. The network 120 may be a communication medium of various connection types capable of providing a communication link between the terminal device 110 and the server 130, such as a wired communication link or a wireless communication link.
[0073] Depending on the implementation requirements, the device architecture in this application embodiment can have any number of terminal devices, networks, and servers. For example, server 130 can be a server group composed of multiple server devices. In addition, the technical solutions provided in this application embodiment can be applied to terminal device 110, or to server 130, or can be implemented jointly by terminal device 110 and server 130. This application does not impose any special limitations on this.
[0074] For example, server 130 can execute the image dirt recognition method provided in this application, extracting a first parameter and a second parameter of the image to be recognized; wherein the first parameter is brightness and the second parameter is saturation, or the first parameter is saturation and the second parameter is brightness; the region in the image to be recognized where the first parameter is within a first preset range is determined as a candidate region; the region in the candidate region where the second parameter is within a second preset range is determined as a dirty region; thereby, regions in the image to be recognized where the saturation is less than a preset saturation and the brightness is greater than a preset brightness can be extracted and determined as dirty regions. It is known that regions in the image to be recognized where the saturation is less than the preset saturation and the brightness is greater than the preset brightness are areas that are close to white, and dirt on the endoscope is more likely to be white mucus, bubbles, etc. Therefore, determining regions where the saturation is less than the preset saturation and the brightness is greater than the preset brightness as dirty regions can accurately identify dirty regions formed by dirt on the endoscope.
[0075] Under normal circumstances, a small amount of mucus exists in the human digestive system. However, the amount of mucus increases significantly in cases of disease. Furthermore, as the endoscope moves, mucus may come into contact with and adhere to the endoscope's outer shell within the digestive tract. When mucus adheres to the transparent front shell of the endoscope, it continuously affects the imaging results and can lead to misdiagnosis. Therefore, the ability to quickly identify which parts of endoscopic images are mucus is crucial for improving image interpretation efficiency and identifying lesions.
[0076] Therefore, accurately identifying the dirty areas formed by dirt on the endoscope can help to deal with the dirt on the endoscope, thereby improving the imaging effect of the endoscope. Marking the identified dirty areas can improve the efficiency of image reading and avoid misdiagnosis of the condition.
[0077] The image dirt recognition method provided in this application will be described in detail below with reference to specific embodiments.
[0078] Figure 2 schematically illustrates a flowchart of the image dirt recognition method according to certain embodiments of this application. The entity executing this image dirt recognition method can be a terminal device or a server, etc., and this application does not impose any limitations on this. Terminal devices include, but are not limited to, mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc. Embodiments of this invention can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving.
[0079] As shown in Figure 2, the dirt recognition method for this image can mainly include the following steps S210 to S240.
[0080] S210. Obtain the image to be recognized.
[0081] Specifically, the image to be identified can be captured by an endoscope, such as a capsule endoscope or a miniature endoscope. Capsule endoscopes include capsule gastroscopes and capsule colonoscopes, which primarily use their own image acquisition devices to capture images of the digestive system's interior, then transmit the large number of captured images to an external platform to provide a basis for final image interpretation and diagnosis.
[0082] It's understandable that, taking capsule endoscopy as an example, as it moves, mucus may come into contact with and adhere to the capsule's outer shell within the digestive tract. When this mucus adheres to the transparent front shell of the capsule endoscopy, it continuously affects the imaging effect and can lead to misdiagnosis. Therefore, it's beneficial to first acquire the image to be identified using the capsule endoscopy. This allows for accurate identification of areas of contamination caused by dirt on the endoscope, facilitating appropriate treatment of the contamination and improving the imaging effect. Furthermore, marking the identified contaminated areas enhances image reading efficiency and helps avoid misdiagnosis.
[0083] S220. Extract the first parameter and the second parameter of the image to be recognized; wherein the first parameter is brightness and the second parameter is saturation, or the first parameter is saturation and the second parameter is brightness.
[0084] Wherein, when the first parameter is brightness and the second parameter is saturation, the first preset range is a brightness range greater than the first preset brightness, and the second preset range is a saturation range less than the first preset saturation; when the first parameter is saturation and the second parameter is brightness, the first preset range is a saturation range less than the second preset saturation, and the second preset range is a brightness range greater than the second preset brightness.
[0085] In some embodiments, prior to step S220, the method may further include:
[0086] Convert the image to be recognized from the RGB color space to the HSV color space.
[0087] Specifically, the HSV color space can include three color channels, namely the hue H channel, the saturation S channel, and the brightness V channel. Thus, the saturation parameter and the brightness parameter of the image to be recognized can be obtained. Therefore, by using one of the brightness parameter and the saturation parameter in the HSV color space to identify the candidate area, and then using the other parameter of the brightness parameter and the saturation parameter in the HSV color space to screen out the dirty area from the candidate area, the area with saturation less than the preset saturation and brightness greater than the preset brightness is determined as the dirty area, and the dirty area formed due to the dirt on the endoscope can be accurately identified.
[0088] In some embodiments, when the first parameter is brightness and the second parameter is saturation, the second preset range is a saturation range greater than the third preset saturation and less than the first preset saturation.
[0089] In some embodiments, when the first parameter is saturation and the second parameter is brightness, the first preset range is a saturation range greater than the fourth preset saturation and less than the second preset saturation.
[0090] In a specific embodiment, the saturation range S∈(Smin, Smax) can be adopted, and the area where the saturation Smin < S < Smax is selected as the candidate area. Combining the above embodiments, the third preset saturation and the fourth preset saturation correspond to Smin, and the first preset saturation and the second preset saturation correspond to Smax. It should be understood that when the saturation S of a certain area in the image to be recognized is equal to Smin, this area does not belong to the candidate area; when the saturation S of another area in the image to be recognized is equal to Smax, this area also does not belong to the candidate area. Among them, the reference value of Smin can be 0, 2, 4, 8, 10, etc. The reference value of Smax can be 25, 30, 35, 40, 45, etc. And, the brightness range V > Vmax can be adopted, and the area with brightness greater than Vmax is selected as the dirty area, while the area with brightness less than or equal to Vmax is not the dirty area. The order of selecting areas using the saturation S channel and the brightness V channel as described above can be swapped, and the effect of identifying the dirty area can be achieved. Among them, 200 ≤ Vmax ≤ 230, and the reference value of Vmax can be 200, 205, 210, 215, 220, 225, 300, etc. Combining the above embodiments, the first preset brightness and the second preset brightness correspond to Vmax.
[0091] It's understandable that dirt in the digestive system is often mucus, which is generally white and therefore brighter than other areas in the image. Furthermore, white has a fixed grayscale range in the saturation (S) channel. Since mucus is typically white, when it adheres to the lens, the area containing the mucus appears very bright in the image, allowing for filtering using the brightness (V) channel. Also, because the mucus is white, the mucus area has a fixed grayscale range in the saturation (S) channel. Therefore, identifying areas with saturation below a preset saturation level and brightness above a preset brightness level as dirt areas allows for accurate identification of dirt areas caused by contamination on the endoscope.
[0092] S230. The region in the image to be identified where the first parameter is within the first preset range is determined as the candidate region.
[0093] Specifically, the candidate area can be an image area suspected of being dirty. This allows for the initial screening of potentially dirty image areas, resulting in candidate areas. Further identification of dirty areas can then narrow down the target for recognition, thereby improving the final recognition accuracy.
[0094] In some specific embodiments, when there are multiple regions in the image to be identified that have a first parameter within a first preset range, these multiple regions are determined as multiple candidate regions, and a corresponding candidate region label is set for each candidate region, thereby avoiding missing possible distribution areas of mucus in the image to be identified.
[0095] Based on the above embodiments, step S230, which determines the region in the image to be identified where the first parameter is within the first preset range as the candidate region, may further include the following steps:
[0096] The smallest bounding rectangle of the region in the image to be identified where the first parameter is within the first preset range is determined as the candidate region.
[0097] Therefore, the minimum bounding rectangle of the region in the image to be identified where the first parameter is within the first preset range is determined as the candidate region. Compared with directly determining the region in the image to be identified where the first parameter is within the first preset range as the candidate region, the candidate region can be a more regular shape, which is beneficial to significantly reduce the amount of calculation in subsequent steps that use the candidate region and can reduce the system consumption of the image dirt recognition method of this application.
[0098] Figure 3 schematically illustrates a flowchart of the steps after determining the region in the image to be identified where the first parameter is within a first preset range as the candidate region in a certain embodiment of this application. As shown in Figure 3, based on the above embodiment, after determining the region in the image to be identified where the first parameter is within a first preset range as the candidate region in step S230, the following steps S310 to S330 may be further included.
[0099] S310. Obtain the target candidate region with the largest area among the candidate regions.
[0100] S320. Calculate the intersection-union ratio of the target candidate region with all other candidate regions.
[0101] S330. Discard candidate regions whose intersection-union ratio with the target candidate region is greater than the first preset threshold.
[0102] Therefore, discarding candidate regions whose intersection-union ratio (IU) with the target candidate region is greater than a first preset threshold can remove candidate regions with large overlap, thereby reducing the number of candidate regions to be processed. Simultaneously, since the IU of the discarded candidate region with the target candidate region is greater than the first preset threshold, meaning the overlap area between the discarded candidate region and the target candidate region is large, discarding this candidate region avoids losing excessive dirty information. Thus, it avoids repeated calculations on overlapping candidate regions while preventing the loss of a large amount of dirty information, thereby improving the accuracy of dirty region identification.
[0103] In a specific implementation, the Intersection over Union (IOU) ratio can be used. IOU is the ratio of the area of the intersection region to the area of the union region between the target candidate region and any other candidate region. Non-maximum suppression (NMS) algorithms can be used to remove overlapping candidate regions. Specifically, the following steps can be performed: A: Sort all identified candidate regions according to their area; B: Obtain a first preset threshold; C: Select the candidate region with the largest area as the target candidate region; D: Perform NMS calculations on the areas of the remaining candidate regions and the area of the target candidate region. That is, if the IOU value between any candidate region and the target candidate region is greater than the IOU threshold, delete that candidate region. Then, for the remaining candidate regions other than the selected target candidate region, repeat steps C and D until it is determined whether each remaining candidate region needs to be deleted.
[0104] It is understandable that determining the smallest bounding rectangle of the region in the image to be identified where the first parameter is within the first preset range as the candidate region may result in many candidate regions overlapping. By identifying and removing overlapping regions through steps S310 to S330, the redundancy of the identified candidate regions can be eliminated, and the computational complexity of image recognition can be reduced, thereby improving the accuracy of dirt identification.
[0105] Specifically, the first preset threshold can be set according to the needs of the specific application of the scheme. For example, the first preset threshold can be 0.5, 0.55 or 0.6, etc.
[0106] Figure 4 schematically illustrates a flowchart of the steps in a certain embodiment of this application for determining the region in the image to be identified where the first parameter is within a first preset range as a candidate region. As shown in Figure 4, based on the above embodiment, the first parameter is brightness and the second parameter is saturation; step S230, determining the region in the image to be identified where the first parameter is within a first preset range as a candidate region, may further include the following steps S410 to S430.
[0107] S410. Obtain the maximum and minimum values of the first parameter of the pixels in the candidate region within the actual range of values;
[0108] S420. Calculate the difference between the maximum and minimum values;
[0109] S430. The regions where the difference is less than the second preset threshold and the first parameter is within the first preset range are identified as candidate regions.
[0110] It's understandable that the dirt is likely a white, sticky substance. This sticky substance adheres to the lens, forming lens smudges in the image, so the dirty areas are generally brighter in the image. Furthermore, since the sticky substances usually mix, their brightness values generally don't change much. Therefore, by setting a first preset range as a brightness range greater than a preset brightness, and then setting a threshold for the difference between the maximum and minimum values within the actual value range of the image region determined as a candidate area, multiple candidate areas can be found using a method that searches for the most stable extreme value region in the image. This makes the obtained candidate areas and even the subsequently obtained dirty areas more accurate.
[0111] In this embodiment, the value range of the second preset threshold can be 20 to 40, for example, 30. In some other embodiments, the second preset threshold can also be 20, 25, 35, 40, etc.
[0112] S240. The area in the candidate region where the second parameter is within the second preset range is determined as the dirty area. The dirty area is used to represent the area in the image to be identified formed due to dirt on the endoscope.
[0113] Therefore, by using the second parameter within a second preset range, the selected area can be further filtered to determine the dirty area on the image to be identified.
[0114] Figure 5 schematically illustrates a flowchart of the steps in a certain embodiment of this application for determining a dirty area in the candidate area where the second parameter is within a second preset range. As shown in Figure 5, based on the above embodiment, the first parameter is saturation and the second parameter is brightness; step S240, which determines the dirty area in the candidate area where the second parameter is within a second preset range, may further include the following steps S510 to S530.
[0115] S510. Obtain the maximum and minimum values of the second parameter of the pixels in the candidate region within the actual range of values.
[0116] S520. Calculate the difference between the maximum and minimum values.
[0117] S530. The candidate areas whose difference is less than the second preset threshold and whose second parameter is within the second preset range are identified as dirty areas.
[0118] It's understandable that the dirt is likely a white, sticky substance. This sticky substance adheres to the lens, forming lens smudges in the image, so dirty areas are generally brighter in the image. Furthermore, since the sticky substances usually mix, their brightness values generally don't change much. Therefore, by setting a second preset range as a brightness range greater than a preset brightness range, and then setting a threshold for the difference between the maximum and minimum values within the actual value range of the candidate areas identified as dirty areas, multiple dirty areas can be found using a method that searches for the most stable extreme value regions in the image, resulting in more accurate identification of the dirty areas.
[0119] In some specific embodiments, the second preset range can be a brightness range greater than the grayscale value of 200, and the second preset threshold is, for example, 30. That is, the candidate area with brightness greater than the grayscale value of 200 and the difference between the maximum and minimum values in the actual range of brightness parameters is less than 30, i.e., the candidate area with brightness greater than the grayscale value of 200 and the grayscale value change threshold is less than 30, is determined as a dirty area.
[0120] In some embodiments, the extracted dirty areas can be represented using a binary image method. For example, the pixel values of the dirty areas can be set to a first value, such as 1; and the pixel values of the background areas can be set to a second value, such as 0. The background area is the region in the image to be identified excluding the dirty areas. This reduces the amount of data in the image processing, thereby improving image processing efficiency and reducing system power consumption.
[0121] Figure 6 schematically illustrates a flowchart of the steps after determining the area in the candidate region where the second parameter is within the second preset range as a dirty area in a certain embodiment of this application. As shown in Figure 6, based on the above embodiment, after determining the area in the candidate region where the second parameter is within the second preset range as a dirty area in step S240, the following steps S610 to S630 may be further included.
[0122] S610. Extract the edges of the dirty area to obtain the edge shape of the dirty area.
[0123] S620. Match the edge shape of the dirty area with the edge shape of the bubble sample in the preset database to obtain the shape matching degree between the edge shape of the dirty area and the edge shape of the bubble sample in the preset database.
[0124] S630. Dirty areas with a shape matching degree greater than a preset matching degree are identified as bubble areas. Bubble areas are used to represent areas in the image to be identified formed by bubbles on the endoscope.
[0125] Match detection is the process of finding similar features between different images. It can identify identical parts in different images and determine the matching degree by comparing the similarity of features. In some embodiments, shape matching degree is obtained, for example, by comparing the shape features of edges, and the preset matching degree range is, for example, 80% to 95%.
[0126] Therefore, by extracting the edge shape of the dirty area, the edge shape of the dirty area is obtained, and the edge shape of the dirty area is matched and detected with the edge shape of the bubble sample in the preset database, thereby further identifying the bubble area in the dirty area.
[0127] In some implementations, the area outside the air bubble region within the contaminated area can be defined as the mucus region, thereby obtaining the mucus region efficiently and quickly with minimal computation. The mucus region is used to represent the area in the image to be identified formed by mucus on the endoscope.
[0128] Alternatively, in some implementations, the edge shape of the dirty area can be matched with the edge shape of the mucus sample in a preset database to obtain the shape matching degree between the edge shape of the dirty area and the edge shape of the mucus sample in the preset database; then, the dirty area with the shape matching degree greater than the preset matching degree is determined as the mucus area, and the mucus area is used to represent the area in the image to be identified formed by the mucus on the endoscope.
[0129] In some implementations, when the mucus is close to each other but not connected, the areas containing multiple mucus may be identified as a candidate area. Furthermore, the areas containing multiple mucus within a candidate area may be identified as a dirty area. In this case, the location of each mucus area can be determined by matching the edge shape of the dirty area with the edge shape of the mucus samples in a preset database. A corresponding label can be set for each mucus area to prevent omissions, thus achieving accurate identification of the area containing each mucus.
[0130] In some implementations, when it is determined that there are more than a preset number of bubble regions on the image to be identified, or when it is determined that there are bubble regions on the image to be identified that have a preset area, the endoscope capturing the image to be identified can be controlled to rotate or make rapid back-and-forth displacement movements.
[0131] It's understandable that contaminants can be categorized into highly viscous mucus and less viscous air bubbles. For identified contaminated areas, further differentiation is needed to determine whether they are areas containing highly viscous mucus or areas containing less viscous air bubbles. Since air bubbles have very low adhesion to the capsule shell, if the contaminated area is identified as an air bubble, it can be cleaned by controlling the capsule's up-and-down, left-and-right, or rotating movements within the gastric fluid. This keeps the endoscope lens clean, resulting in clearer, unobstructed images and improved endoscopic detection. Conversely, if the contaminated area is identified as highly viscous mucus, the mucus can be removed by controlling the capsule endoscope's up-and-down or rotating movements within the gastric fluid, or other methods can be used to treat the mucus on the capsule, such as removing the capsule endoscope, lubricating it, and then reinserting it.
[0132] Figure 7 schematically illustrates a flowchart of the steps for edge extraction of a dirty area to obtain the edge shape of the dirty area in a certain embodiment of this application. As shown in Figure 7, based on the above embodiment, step S610, which involves edge extraction of the dirty area to obtain the edge shape of the dirty area, may further include the following steps S710 to S760.
[0133] S710. Perform smoothing filtering on the image that includes dirty areas.
[0134] S720. Calculate the magnitude and direction of the image gradient based on the smoothed image.
[0135] S730. Identify pixels where the second derivative of the gradient magnitude in the gradient direction is zero as edge points, and calculate the edge intensity of the edge points;
[0136] S740. If the edge strength of an edge point is greater than the first threshold, then mark the point as a strong edge point;
[0137] S750. If the edge strength of an edge point is greater than the second threshold and less than the first threshold, then mark the point as a weak edge point;
[0138] S760. Use the edge shape formed by strong edge points and weak edge points as the edge shape of the dirty area.
[0139] Specifically, algorithms such as Canny, Sobel, Roberts, and watershed can be used to extract the edges of dirty areas.
[0140] In some implementations, an image smoothing Gaussian function can be used to smooth the image, including dirty areas:
[0141]
[0142] Here, σ represents the mean square error of the Gaussian noise, and G(x,y) represents the value of the Gaussian function at coordinates (x,y). Coordinates (x,y) refer to the coordinates of each pixel in an image.
[0143] In some implementations, after calculating the image gradient magnitude and direction based on the smoothed image, pixels where the second derivative of the gradient magnitude in the gradient direction is zero are designated as edge points.
[0144]
[0145] Here, α represents the gradient direction, and l represents the image. Thus, the corresponding edge points are obtained.
[0146] Then, the edge strength of the edge point is calculated using the following formula:
[0147]
[0148] Among them, l G Used to represent the gradient increase of an image.
[0149] Then, the edge strength of an edge point is used to represent the probability that the edge point is located on the edge of a dirty area. Therefore, a certain edge strength can be selected as a first threshold. If the edge strength of an edge point is greater than the first threshold, the point is marked as a strong edge point; if the edge strength of an edge point is less than or equal to the first threshold, the point is marked as a weak edge point. Alternatively, another edge strength can be selected as a second threshold. If the edge strength of an edge point is greater than the second threshold and less than the first threshold, the point is marked as a weak edge point, resulting in strong and weak edge points. Furthermore, isolated points are suppressed, and the edge shape formed by strong and weak edge points is used as the edge shape of the dirty area. Specifically, isolated points are suppressed only when at least one of the neighbors of a weak edge point is a strong edge point, i.e., when a strong boundary connects to a weak boundary; otherwise, they are discarded.
[0150] The Canny algorithm extracts the most complete edges with good continuity, exhibiting strong noise resistance and making it easier to detect truly weak edges. In addition, the Sobel algorithm, Roberts algorithm, and watershed algorithm can also be used.
[0151] Figure 8 schematically illustrates a flowchart of the steps after determining the area in the candidate region where the second parameter is within the second preset range as a dirty area in a certain embodiment of this application. As shown in Figure 8, based on the above embodiment, after determining the area in the candidate region where the second parameter is within the second preset range as a dirty area in step S240, the following steps S810 to S820 may be further included.
[0152] S810. Calculate the ratio of the number of image pixels in the dirty area to the number of image pixels in the image to be identified.
[0153] S820. Filter out dirty areas with a ratio greater than a preset ratio.
[0154] Therefore, it is possible to filter out contaminated areas with a ratio greater than a preset ratio, retain these areas, and remove those with a ratio less than the preset ratio. This allows for the exclusion of small contaminated areas. It can be understood that contaminated areas with a small pixel ratio to the image to be identified have a small or even negligible impact on endoscopic imaging. The method of this embodiment can reduce the number of contaminated areas to be processed, thereby reducing computational workload while ensuring accurate identification of contaminated areas.
[0155] In some embodiments, the area of the contaminated region can also be calculated, and contaminated regions with an area larger than a preset area can be filtered out. It is understood that small contaminated regions have little or even negligible impact on endoscopic imaging. Therefore, the number of contaminated regions to be processed can be reduced, thereby reducing the computational workload while ensuring accurate identification of contaminated regions.
[0156] In specific embodiments, a threshold can be set for dirty areas, requiring the area of the dirty area to be greater than a preset area. For example, a preset area of 10,000 pixels can be calculated using a reference value of area_threshold = 100 and an area of 100 x 100 = 10,000 pixels. 10,000 pixels can, for example, occupy approximately 4% of the image area. That is, in embodiments that filter out dirty areas with a ratio greater than a preset ratio, the ratio can be set to 4% accordingly. In some embodiments, the preset area and preset ratio can also be set to other values, and this application does not limit them.
[0157] It should be noted that although the steps of the method in this application are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0158] The following describes a system embodiment of this application, which can be used to execute the image dirt recognition method described in the above embodiments of this application. Figure 9 schematically shows a structural block diagram of the image dirt recognition system 900 provided in an embodiment of this application. As shown in Figure 9, the image dirt recognition system 900 includes:
[0159] The image acquisition device 910 is configured to acquire the image to be recognized.
[0160] The parameter extraction device 920 is configured to extract a first parameter and a second parameter of the image to be recognized; wherein the first parameter is brightness and the second parameter is saturation, or the first parameter is saturation and the second parameter is brightness;
[0161] The candidate region determination device 930 is configured to determine the region in the image to be identified where the first parameter is within a first preset range as the candidate region;
[0162] The dirty area determination device 940 is configured to determine a dirty area in a candidate area where the second parameter is within a second preset range. The dirty area is used to represent an area in the image to be identified formed due to dirt on the endoscope.
[0163] Wherein, when the first parameter is brightness and the second parameter is saturation, the first preset range is a brightness range greater than the first preset brightness, and the second preset range is a saturation range less than the first preset saturation; when the first parameter is saturation and the second parameter is brightness, the first preset range is a saturation range less than the second preset saturation, and the second preset range is a brightness range greater than the second preset brightness.
[0164] In some embodiments of this application, based on the above embodiments, the candidate region determination device 930 includes:
[0165] The candidate region determination unit is configured to determine the smallest bounding rectangle of the region in the image to be identified where the first parameter is within a first preset range as the candidate region.
[0166] The image dirt recognition system 900 also includes:
[0167] The target candidate region determination unit is configured to obtain the target candidate region with the largest area among the candidate regions;
[0168] The intersection-union ratio (IU) calculation unit is configured to calculate the IU ratio of the target candidate region to each of the other candidate regions.
[0169] The candidate region discarding unit is configured to discard candidate regions whose intersection-union ratio with the target candidate region is greater than a first preset threshold.
[0170] In some embodiments of this application, based on the above embodiments, the image dirt recognition system 900 further includes:
[0171] The edge extraction unit is configured to extract the edges of the dirty area to obtain the edge shape of the dirty area;
[0172] The edge matching unit is configured to perform matching detection between the edge shape of the dirty area and the edge shape of the bubble sample in the preset database to obtain the shape matching degree between the edge shape of the dirty area and the edge shape of the bubble sample in the preset database.
[0173] The bubble region determination unit is configured to determine the dirty region with a shape matching degree greater than a preset matching degree as the bubble region. The bubble region is used to represent the region in the image to be identified that is formed due to bubbles on the endoscope.
[0174] In some embodiments of this application, based on the above embodiments, the edge extraction unit includes:
[0175] The smoothing filter subunit is configured to perform smoothing filter processing on images that include dirty areas;
[0176] The gradient magnitude and direction calculation subunit is configured to calculate the image gradient magnitude and direction based on the smoothed image.
[0177] The edge intensity calculation subunit is configured to take pixels where the second derivative of the gradient magnitude in the gradient direction is zero as edge points and calculate the edge intensity of the edge points.
[0178] The strong edge point determination sub-unit is configured to mark the point as a strong edge point if the edge strength of the edge point is greater than a first threshold.
[0179] The weak edge point determination sub-unit is configured to mark the point as a weak edge point if the edge strength of the edge point is greater than a second threshold and less than a first threshold.
[0180] The edge shape determination sub-unit is configured to use the edge shape composed of strong edge points and weak edge points as the edge shape of the dirty area.
[0181] In some embodiments of this application, based on the above embodiments, the first parameter is brightness and the second parameter is saturation; the candidate area determination device 930 includes:
[0182] The first unit for obtaining the maximum and minimum values is configured to obtain the maximum and minimum values of the first parameter in the actual range of the pixel points in the candidate region;
[0183] The first unit of the difference acquisition is configured to calculate the difference between the maximum and minimum values;
[0184] The candidate region acquisition unit is configured to identify regions whose difference is less than a second preset threshold and whose first parameter is within a first preset range as candidate regions.
[0185] In some embodiments of this application, based on the above embodiments, the first parameter is saturation and the second parameter is brightness; the dirty area determination device 940 includes:
[0186] The second unit for obtaining extreme values is configured to obtain the maximum and minimum values of the second parameter of the pixels in the candidate region within the actual range of values.
[0187] The second unit for obtaining the difference is configured to calculate the difference between the maximum and minimum values;
[0188] The dirty area acquisition unit is configured to identify candidate areas whose difference is less than a second preset threshold and whose second parameter is within a second preset range as dirty areas.
[0189] In some embodiments of this application, based on the above embodiments, the image dirt recognition system 900 further includes:
[0190] The ratio determination unit is configured to calculate the ratio of the number of image pixels in the dirty area to the number of image pixels in the image to be identified;
[0191] The dirty area filtering unit is configured to filter out dirty areas with a ratio greater than a preset ratio.
[0192] In some embodiments of this application, based on the above embodiments, when the first parameter is brightness and the second parameter is saturation, the second preset range is a saturation range that is greater than the third preset saturation and less than the first preset saturation.
[0193] When the first parameter is saturation and the second parameter is brightness, the first preset range is a saturation range that is greater than the fourth preset saturation and less than the second preset saturation.
[0194] The specific details of the image dirt recognition system 900 provided in the various embodiments of this application have been described in detail in the corresponding method embodiments, and will not be repeated here.
[0195] Figure 10 schematically illustrates a computer system architecture block diagram for implementing an electronic device according to an embodiment of this application.
[0196] It should be noted that the computer system 1000 of the electronic device shown in Figure 10 is only an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0197] As shown in Figure 10, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1002 or programs loaded from storage section 1008 into random access memory (RAM). The RAM 1003 also stores various programs and data required for system operation. The CPU 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An input / output interface 1005 (I / O interface) is also connected to the bus 1004.
[0198] The following components are connected to the input / output interface 1005: an input section 1006 including a keyboard, mouse, etc.; an output section 1007 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a local area network card, modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the input / output interface 1005 as needed. A removable medium 1011, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 1010 as needed so that computer programs read from it can be installed into the storage section 1008 as needed.
[0199] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1009, and / or installed from removable medium 1011. When the computer program is executed by central processing unit 1001, it performs various functions defined in the system of this application.
[0200] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0201] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0202] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0203] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of this application.
[0204] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0205] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for identifying dirt in an image, characterized in that, The method includes: acquiring an image to be identified; extracting a first parameter and a second parameter from the image to be identified; wherein the first parameter is brightness and the second parameter is saturation, or the first parameter is saturation and the second parameter is brightness; determining a region in the image to be identified where the first parameter falls within a first preset range as a candidate region; determining a region in the candidate region where the second parameter falls within a second preset range as a dirty region, the dirty region representing a region in the image to be identified formed due to dirt on an endoscope; performing edge extraction on the dirty region to obtain the edge shape of the dirty region; and matching the edge shape of the dirty region with the edge shape of bubble samples in a preset database to obtain... The shape matching degree between the edge shape of the dirty area and the edge shape of the bubble sample in the preset database is determined; dirty areas with a shape matching degree greater than a preset matching degree are identified as bubble areas, which are used to represent areas in the image to be identified formed by bubbles on the endoscope; wherein, when the first parameter is brightness and the second parameter is saturation, the first preset range is a brightness range greater than a first preset brightness, and the second preset range is a saturation range less than a first preset saturation; when the first parameter is saturation and the second parameter is brightness, the first preset range is a saturation range less than a second preset saturation, and the second preset range is a brightness range greater than a second preset brightness.
2. The method according to claim 1, characterized in that, Determining a region in the image to be identified where the first parameter falls within a first preset range as a candidate region includes: determining the smallest bounding rectangle of the region in the image to be identified where the first parameter falls within the first preset range as a candidate region; after determining the region in the image to be identified where the first parameter falls within the first preset range as a candidate region, the method further includes: obtaining the target candidate region with the largest area among the candidate regions; calculating the intersection-union ratio (IUR) of the target candidate region with each other candidate region; and discarding candidate regions whose IUR with the target candidate region is greater than a first preset threshold.
3. The method according to claim 1, characterized in that, Edge extraction of the dirty area to obtain the edge shape of the dirty area includes: performing smoothing filtering on the image including the dirty area; calculating the image gradient magnitude and direction based on the smoothed image; taking pixels where the second derivative of the gradient magnitude in the gradient direction is zero as edge points and calculating the edge strength of the edge points; if the edge strength of the edge point is greater than a first threshold, then marking the point as a strong edge point; if the edge strength of the edge point is greater than a second threshold and less than the first threshold, then marking the point as a weak edge point; and taking the edge shape formed by the strong edge points and the weak edge points as the edge shape of the dirty area.
4. The method according to claim 1, characterized in that, The first parameter is brightness and the second parameter is saturation; determining the region in the image to be identified where the first parameter is within a first preset range as the candidate region includes: obtaining the maximum and minimum values of the actual value range of the first parameter of the pixels in the candidate region; calculating the difference between the maximum and minimum values; and determining the candidate region where the difference is less than a second preset threshold and the first parameter is within the first preset range as the candidate region.
5. The method according to claim 1, characterized in that, The first parameter is saturation and the second parameter is brightness; determining the area in the candidate region where the second parameter is within a second preset range as a dirty area includes: obtaining the maximum and minimum values of the actual value range of the second parameter of the pixels in the candidate region; calculating the difference between the maximum and minimum values; and determining the candidate region where the difference is less than a second preset threshold and the second parameter is within the second preset range as a dirty area.
6. The method according to claim 1, characterized in that, After determining the area in the candidate region where the second parameter is within a second preset range as a dirty area, the method further includes: calculating the ratio of the number of image pixels in the dirty area to the number of image pixels in the image to be identified; and filtering out dirty areas where the ratio is greater than a preset ratio.
7. The method according to claim 1, characterized in that, When the first parameter is brightness and the second parameter is saturation, the second preset range is a saturation range that is greater than the third preset saturation and less than the first preset saturation; when the first parameter is saturation and the second parameter is brightness, the first preset range is a saturation range that is greater than the fourth preset saturation and less than the second preset saturation.
8. A dirt recognition system for images, characterized in that, The system includes: an image acquisition device configured to acquire an image to be identified; a parameter extraction device configured to extract a first parameter and a second parameter from the image to be identified; wherein the first parameter is brightness and the second parameter is saturation, or the first parameter is saturation and the second parameter is brightness; a candidate region determination device configured to determine a region in the image to be identified where the first parameter is within a first preset range as a candidate region; a dirty region determination device configured to determine a region in the candidate region where the second parameter is within a second preset range as a dirty region, the dirty region being used to represent a region in the image to be identified formed due to dirt on an endoscope; an edge extraction unit configured to perform edge extraction on the dirty region to obtain the edge shape of the dirty region; and an edge matching unit configured to match the dirty region... The edge shape of the dirty area is matched with the edge shape of the bubble sample in the preset database to obtain the shape matching degree between the edge shape of the dirty area and the edge shape of the bubble sample in the preset database; the bubble region determination unit is configured to determine the dirty area with a shape matching degree greater than a preset matching degree as the bubble region, the bubble region is used to represent the area in the image to be identified formed by the bubble on the endoscope; wherein, when the first parameter is brightness and the second parameter is saturation, the first preset range is a brightness range greater than a first preset brightness, and the second preset range is a saturation range less than a first preset saturation; when the first parameter is saturation and the second parameter is brightness, the first preset range is a saturation range less than a second preset saturation, and the second preset range is a brightness range greater than a second preset brightness.
9. A computer-readable medium, characterized in that, It stores a computer program that, when executed by a processor, implements the method described in any one of claims 1 to 7.
10. An electronic device, characterized in that, include: processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method of any one of claims 1 to 7 by executing the executable instructions.
Citation Information
Patent Citations
Image identification device and method of vehicle
CN104424645A
Capsule endoscope system, image dyeing area recognition method thereof and computer readable storage medium
CN113129356A
Capsule endoscope dirt detection method and device
CN114390225A
Image smudginess identification method and system, readable medium and electronic equipment
CN116977734A