Method and apparatus for obtaining a field of view mask for an endoscopic imaging system
By determining the location of feature pixels in the endoscopic imaging system and performing morphological processing, the field mask of the endoscopic imaging system is obtained, which solves the problem of the area outside the circular window on the end face of the fiber bundle affecting diagnosis and realizes rapid and accurate lesion diagnosis.
Patent Information
- Application Number
- CN201911222103.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-03
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2039-12-03
AI Technical Summary
The raw images directly acquired using an endoscopic imaging system include areas outside the circular window region at the end face of the fiber optic bundle, which affects the diagnostic accuracy of lesions in the body tissues of the subject.
By determining the location of feature pixels in the target image, a binarized image is formed and morphological processing is performed to obtain the field mask of the endoscopic imaging system, which blocks the area outside the circular window at the end face of the fiber bundle.
Accurate identification of the circular window area on the end face of the fiber bundle improves diagnostic accuracy, and the acquisition speed is fast with good blocking effect.
Smart Images

Figure CN112906834B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of endoscopic imaging systems, and more particularly to a method and apparatus for obtaining a field mask for an endoscopic imaging system. Background Technology
[0002] Endoscopic imaging systems using fiber optic bundles are medical devices that can be inserted into the human body via endoscopes such as gastroscopes and colonoscopes to acquire localized histological images, enabling precise diagnosis of minute lesions, gastrointestinal diseases, and early gastrointestinal cancers. When using probe-type confocal microscopic endoscopic imaging systems, the raw image acquired directly includes an image area outside the circular window region of the fiber optic bundle endface. This image area is unrelated to the patient's body tissues. Therefore, using the raw image directly acquired through imaging as the basis for judging the patient's tissue lesions may affect the accuracy of the diagnosis, leading to incorrect diagnoses. Summary of the Invention
[0003] In view of the foregoing background technology, one of the technical problems solved by the embodiments of the present invention is to provide a method for obtaining the field mask of an endoscopic imaging system, which overcomes the problem that the image area outside the circular window area of the fiber bundle end face in the original image obtained directly by imaging using an endoscopic imaging system is not conducive to the diagnosis of lesions in the body tissues of the subject.
[0004] In a first aspect, embodiments of this application provide a method for obtaining a field-of-view mask for an endoscopic imaging system, the method comprising:
[0005] Optionally, in one embodiment of this application, determining the position of the feature pixels in the target image based on the pixel values of the target image includes:
[0006] Based on the distance between adjacent fiber cores of the endoscopic imaging system, candidate regions for the feature pixels are determined in the target image;
[0007] The feature pixels are selected from the candidate regions according to the set filtering rules.
[0008] Optionally, in one embodiment of this application, determining the candidate region of the feature pixel in the target image based on the adjacent fiber core distance of the endoscopic imaging system includes:
[0009] Determine the center pixel of the target image;
[0010] A seed pixel is selected from all pixels that are less than a first preset distance from the center pixel, wherein the seed pixel has the largest pixel value and the first preset distance is greater than the distance between adjacent fiber cores;
[0011] The region containing all pixels that are less than a second preset distance from the seed pixel is determined as the candidate region, wherein the second preset distance is greater than the distance between adjacent fiber cores.
[0012] Optionally, in one embodiment of this application, selecting the feature pixels from the candidate region according to the set filtering rules includes:
[0013] Calculate the feature values of the seed pixels;
[0014] The filtering rules are set according to the feature values of the seed pixels, and the feature pixels are selected from the candidate region according to the filtering rules.
[0015] The feature pixel is determined as the seed pixel, and the candidate region is updated to be the region containing all pixels that are less than a second preset distance from the seed pixel.
[0016] Return to the step of calculating the feature value of the seed pixel.
[0017] Optionally, in one embodiment of this application, when the number of seed pixels is greater than one, setting the filtering rule based on the feature values of the seed pixels includes:
[0018] The filtering rules are set based on the average feature value of all the seed pixels.
[0019] Optionally, in one embodiment of this application, selecting the feature pixels from the candidate region according to the filtering rules includes:
[0020] Calculate the feature values of all pixels in the candidate region, and determine the pixels in the candidate region whose feature values satisfy the filtering rules as the feature pixels.
[0021] Optionally, in one embodiment of this application, the method for calculating the feature value includes:
[0022] Determine the target pixel point for which feature values need to be calculated, and define the region containing all pixels that are less than the target pixel point by the second preset distance as the target region;
[0023] Based on the distance between the pixel and the target pixel, the target region is divided into a first sub-region, a second sub-region, and a third sub-region;
[0024] The feature value of the target pixel is determined based on the pixel value of the target pixel, the average pixel value of all pixels in the first sub-region, the average pixel value of all pixels in the second sub-region, the proportion of pixels in the first sub-region whose pixel value is greater than or equal to the pixel value of the target pixel, the proportion of pixels in the second sub-region whose pixel value is greater than or equal to the pixel value of the target pixel, the proportion of pixels in the second sub-region whose pixel value is greater than or equal to the average pixel value of all pixels in the first sub-region, and the proportion of pixels in the third sub-region whose pixel value is greater than or equal to a ninth preset multiple of the pixel value of the target pixel.
[0025] Optionally, in one embodiment of this application, the step of imaging the target object to obtain a target image includes:
[0026] Imaging of the target object yields at least two original images;
[0027] The target image is obtained based on all the original images.
[0028] Optionally, in one embodiment of this application, performing morphological processing on the binarized image to obtain the field-of-view mask for the endoscopic imaging system includes:
[0029] The binarized image is subjected to morphological processing to obtain a first mask image;
[0030] The first mask image is filled with holes to obtain the field mask of the endoscopic imaging system.
[0031] Secondly, embodiments of this application provide an apparatus for obtaining a field mask of an endoscopic imaging system. The apparatus includes an imaging module for imaging a target object to obtain a target image.
[0032] The feature pixel point determination module is used to determine the position of the feature pixels in the target image based on the pixel values of the target image;
[0033] The binarized image generation module is used to generate a binarized image based on the position of the feature pixels.
[0034] The morphological processing module is used to perform morphological processing on the binarized image to obtain the field mask of the endoscopic imaging system.
[0035] The method and apparatus for obtaining the field mask of an endoscopic imaging system according to embodiments of this application first image the target object to obtain a target image, then determine the position of feature pixels in the target image based on the pixel values of the target image; then form a binarized image based on the position of the feature pixels; finally, perform morphological processing on the binarized image to obtain the field mask of the endoscopic imaging system. The method and apparatus for obtaining the field mask of an endoscopic imaging system according to embodiments of this application can not only accurately identify the circular window area of the fiber optic bundle end face, but also obtain the field mask of the endoscopic imaging system quickly. The obtained field mask of the endoscopic imaging system provides good occlusion of the area outside the circular window of the fiber optic bundle end face, facilitating the diagnosis of lesions in the body tissues of the subject being examined. Attached Figure Description
[0036] The following sections will describe some specific embodiments of the present application in a detailed manner, by way of example and not limitation, with reference to the accompanying drawings. The same reference numerals in the drawings denote the same or similar parts or components. Those skilled in the art should understand that these drawings are not necessarily drawn to scale. In the drawings:
[0037] Figure 1 A flowchart illustrating the acquisition of a field mask for an endoscopic imaging system, as provided in Embodiment 1 of this application;
[0038] Figure 2 A raw image formed by the end face of the fiber optic bundle of the lens probe used in conjunction with an endoscopic imaging system;
[0039] Figure 3 This is a schematic diagram showing the distance between adjacent fiber cores;
[0040] Figure 4 This is a partial schematic diagram of a binarized image;
[0041] Figure 5 This is a schematic diagram of the field mask for an endoscopic imaging system.
[0042] Figure 6 To utilize Figure 5 Endoscopic imaging system field mask Figure 2 The image shown is a schematic diagram of the effect after masking.
[0043] Figure 7 A flowchart illustrating the acquisition of a field mask for an endoscopic imaging system, as provided in Embodiment 2 of this application;
[0044] Figure 8 This is a schematic diagram showing the distance calculation results between the target pixel and other pixels.
[0045] Figure 9 This is a schematic diagram showing the division results of the first, second, and third sub-regions within the target region.
[0046] Figure 10 This is a structural diagram of an apparatus for obtaining a field mask for an endoscopic imaging system, provided in Embodiment 3 of this application. Detailed Implementation
[0047] The specific implementation of the embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0048] Example 1
[0049] Embodiment 1 of this application provides a method for obtaining a field mask for an endoscopic imaging system, wherein the endoscopic imaging system includes, but is not limited to, a probe-type confocal microendoscopic imaging system, and the field mask of the endoscopic imaging system is used to display the circular window area of the fiber bundle end face. Figure 1 As shown in the embodiments of this application, a method for obtaining a field mask for an endoscopic imaging system includes the following steps:
[0050] S101. Imaging the target object to obtain a target image.
[0051] In this embodiment, taking a probe-type confocal microscopic endoscopy imaging system as an example, imaging the target object refers to connecting the confocal probe to the confocal laser host and imaging the fiber bundle end face, provided that the probe end face is clean. The target image can be the original image obtained directly from imaging, or an image obtained after processing the original image.
[0052] See Figure 2 The original image obtained by the endoscopic imaging system from the target object can be divided into three layers from the inside out. The inner layer is the circular window at the end face of the fiber bundle; the middle layer is ring-shaped and characterized by very low brightness; the outer layer is the part outside the inner and middle layers, and the pattern is uncertain.
[0053] S102. Determine the position of the feature pixels in the target image based on the pixel values of the target image.
[0054] In this embodiment, since the target image is obtained by imaging the end face of the fiber bundle, the brightness of the fiber core location and the surrounding area has a specific pattern, see [reference needed]. Figure 3 In the image, the brighter pixels are usually the location of a fiber core. The brightness of the area around the fiber core is lower than that of the fiber core. Therefore, based on the brightness pattern of the fiber core location and the area around the fiber core, that is, the pixel value pattern of the corresponding pixels at the fiber core location and the area around the fiber core, the feature pixels used to identify the location of the fiber core in the target image can be determined.
[0055] S103. Based on the position of the feature pixels, form a binarized image.
[0056] In this embodiment, the size of the binarized image is the same as that of the target image. The binarized image is used to present a clear black and white effect in order to distinguish the positions of feature pixels and non-feature pixels.
[0057] For example, both the target image and the binarized image contain R rows and C columns of pixels. If a feature pixel in the target image is located at the 5th row and 5th column, then the gray value of the pixel at the 5th row and 5th column can be set to 1 in the resulting binarized image. If the pixel at the 5th row and 6th column is not a feature pixel, then the gray value of the pixel at the 5th row and 6th column can be set to 0 in the resulting binarized image.
[0058] S104. Perform morphological processing on the binarized image to obtain the field mask of the endoscopic imaging system.
[0059] In this embodiment, since there are gaps between adjacent fiber cores, see [link to documentation]. Figure 4 This will result in multiple isolated white points, i.e. pixels with a gray value of 1, in the binarized image. In order to connect multiple isolated feature pixels into a region, morphological processing can be performed on the binarized image to distinguish the circular window region of the fiber bundle end face from other regions, thereby obtaining the field mask of the endoscopic imaging system.
[0060] In this embodiment, the endoscopic imaging system field mask is used to display the circular window area of the fiber optic bundle end face in the image. That is, the obtained endoscopic imaging system field mask is used to block the image, so that only the circular window area of the fiber optic bundle end face in the original image obtained by imaging the fiber optic bundle end face is displayed, while the area outside the circular window of the fiber optic bundle end face that cannot be used for diagnosis is blocked.
[0061] For the field mask of the endoscopic imaging system, please refer to Figure 5 The white area in the middle is used to display the circular window area of the fiber bundle end face in the original image, with a grayscale value of 1; the black area is used to cover the area outside the circular window area of the fiber bundle end face in the original image, with a grayscale value of 0.
[0062] use Figure 5 The endoscopic imaging system field mask pair shown Figure 2 After masking the image shown, the following can be obtained: Figure 6 The effect shown.
[0063] In this embodiment, the target object is first imaged to obtain a target image. Then, based on the pixel values of the target image, the positions of feature pixels in the target image are determined. Next, a binarized image is formed based on the positions of the feature pixels. Finally, morphological processing is performed on the binarized image to obtain the endoscopic imaging system field mask. The method for obtaining the endoscopic imaging system field mask in this embodiment not only accurately identifies the circular window region of the fiber optic bundle end face, but also achieves fast acquisition speed. The obtained endoscopic imaging system field mask effectively blocks areas outside the circular window of the fiber optic bundle end face, facilitating the diagnosis of lesions in the body tissues of the examined individual.
[0064] Example 2
[0065] like Figure 2 As shown, the method for obtaining a field mask for an endoscopic imaging system provided in Embodiment 2 of this application includes:
[0066] S201. Imaging the target object to obtain a target image.
[0067] In this embodiment, to quickly obtain the target image, the target image can be a raw image frame directly imaged by the endoscopic imaging system at a certain operating power. The operating power of the endoscopic imaging system can be determined based on the operating power of the light source in the lens fiber bundle of the endoscopic imaging system. The light source of the lens fiber bundle of the endoscopic imaging system can be a laser. In practical applications, a suitable operating power can be selected according to requirements or hardware and software conditions; this embodiment does not impose any limitations.
[0068] In this embodiment, in order to more accurately determine the location of the fiber core from the target image, at least two original images can be obtained first by imaging with an endoscopic imaging system, and then all the original images can be processed to obtain the target image. Thus, the target image can be obtained based on at least two original images.
[0069] Optionally, in order to quickly obtain at least two raw images, imaging can be performed at one of the operating power levels of the endoscopic imaging system. Correspondingly, step S201 may include the following sub-steps:
[0070] S201a, Imaging the target object at one operating power of the endoscopic imaging system to obtain at least two raw images.
[0071] S201b: Center out all original images by pixel value to obtain the target image.
[0072] Since the original images are obtained through the same endoscopic imaging system, all the original images are of the same size. By centering all the original images according to their pixel values, a centered image can be obtained, which can be used as the target image.
[0073] For example, if a raw image frame contains R rows and C columns of pixels, use I m When selecting the center image from N original frames, the pixel value of each pixel in the center image can be calculated using the following formula:
[0074] I m (r,c)=median{I n (r,c)|n=1,2,L,N},1≤r≤R,1≤c≤C, where the median function is the median function.
[0075] Optionally, to further improve the accuracy of determining the location of the fiber core in the target image, the target object can be imaged at two different operating powers of the endoscopic imaging system to obtain at least two original images. Correspondingly, step S201 may include the following sub-steps:
[0076] Sub-step S201c involves imaging the target object at two different operating powers of the endoscopic imaging system to obtain a first power image and a second power image.
[0077] In sub-step S201d, the pixel values of the corresponding pixels in the first power image and the second power image are processed by difference to obtain the target image.
[0078] In sub-step S201c, when imaging the target object at two operating powers of the endoscopic imaging system, at least one original image can be obtained at each operating power. When only one original image is obtained at one of the operating powers, that original image can be used as either the first power image or the second power image; when multiple original images are obtained at one of the operating powers, the multiple original images need to be processed to obtain either the first power image or the second power image.
[0079] Optionally, when the first power image and / or the second power image are obtained by processing multiple frames of original images, sub-step S201c may include at least one of steps A and B, wherein:
[0080] Step A: Image the target object at the first operating power of the endoscopic imaging system to obtain multiple frames of raw images; center all the multiple frames of raw images according to pixel values to obtain the first power image.
[0081] Step B: Image the target object at the second operating power of the endoscopic imaging system to obtain multiple frames of original images; center all the multiple frames of original images according to pixel values to obtain the second power image.
[0082] In sub-step S201d, since the first power image and the second power image are the same size, that is, the number of rows and columns of pixels are the same, pixels in the first power image and the second power image with the same row and column positions can be processed by difference according to pixel values. If using To represent the first power image, use To represent the second power image, use I d If we want to represent the target image, we can obtain the target image using the following formula:
[0083] For example, the target object can be imaged at one operating power of the endoscopic imaging system to obtain three original images. The pixel values of the three original images are then averaged to obtain a first power image. The target object can be imaged again at another operating power of the endoscopic imaging system to obtain ten original images. The pixel values of the ten original images are then averaged to obtain a second power image. Pixels with the same row and column positions in the first power image and the second power image are then compared according to their pixel values. The image obtained after the comparison is determined as the target image.
[0084] Optionally, although the more original image frames obtained by imaging the target object under the first operating power and the second operating power, the better the effect of subsequent processing using the target images will be, it will bring about the problem of longer imaging time and data processing time. Therefore, in order to ensure data accuracy and reduce data processing time, it is preferable to obtain 11 original images by imaging the target object under the first operating power and the second operating power respectively.
[0085] Optionally, in order to improve the subsequent processing effect on the target image, in sub-step S201c, the two operating powers of the endoscopic imaging system can be the maximum operating power and the minimum operating power of the lens fiber bundle light source of the endoscopic imaging system, respectively.
[0086] S202. Based on the distance between adjacent fiber cores of the endoscopic imaging system, determine the candidate region of feature pixels in the target image.
[0087] In this embodiment, since the lens fiber bundle of the endoscopic imaging system includes multiple fiber cores, and the distance between adjacent fiber cores is relatively close, see [reference needed]. Figure 3 In the original and target images, the distances between pixels corresponding to adjacent fiber cores are relatively close, for example, about 4 pixels. Therefore, the target image will also include multiple feature pixels, and the distances between adjacent feature pixels are also relatively close. To quickly and accurately determine feature pixels from the target image, candidate regions for feature pixels can be divided in the target image based on the distances between adjacent fiber cores in the endoscopic imaging system. Then, it is searched whether each candidate region contains at least one feature pixel.
[0088] In this embodiment, since the position of the fiber core in the target image is usually located in the central region of the image, in order to quickly determine the first feature pixel point from the target image, step S202 may include:
[0089] Sub-step S202a: Determine the center pixel of the target image.
[0090] Sub-step S202b: Select a seed pixel from all pixels that are less than a first preset distance from the center pixel, wherein the seed pixel has the largest pixel value and the first preset distance is greater than the distance between adjacent fiber cores.
[0091] Sub-step S202c: Determine the region containing all pixels that are less than a second preset distance from the seed pixel as the candidate region, wherein the second preset distance is greater than the distance between adjacent fiber cores.
[0092] In sub-step S202a, if the target image comprises R rows and C columns of pixels, and the coordinates of the center pixel are (r... c ,c c If so, then The round function is an integer function.
[0093] Sub-step S202b is used to determine the first candidate region based on the center pixel, select the first feature pixel from the first candidate region based on the pixel value, and use the first feature pixel as a seed pixel to determine the candidate region for finding other feature pixels in sub-step S202c based on the seed pixel.
[0094] Since the pixel value of the feature pixel is relatively high, the pixel with the largest pixel value in the first candidate region can be identified as the first feature pixel.
[0095] Seed pixels are selected feature pixels. There can be one or more seed pixels. Each time a feature pixel is selected, it becomes a seed pixel and can be used to determine the candidate region for finding other feature pixels.
[0096] In sub-steps S202b and S202c, the first preset distance and the second preset distance must be greater than the distance between adjacent fiber cores to ensure that the candidate region includes at least one feature pixel. The values of the first preset distance and the second preset distance can be the same or different. In practical applications, the values of the first preset distance and the second preset distance can be reasonably selected according to the requirements.
[0097] Optionally, since the distance between adjacent fiber cores is usually about 4 pixels, in order to improve the determination speed of the first feature pixel, the first preset distance can be set to 5 pixels, that is, the area where all pixels whose center distance from the center pixel is less than 5 pixels is determined as the first candidate area for finding the first feature pixel.
[0098] Optionally, in order to improve the selection speed of other feature pixels, the second preset distance can be set to 5 pixels to ensure that at least one feature pixel adjacent to the seed pixel will be included in the determined candidate region.
[0099] S203. Select feature pixels from the candidate region according to the set filtering rules.
[0100] In this embodiment, the specific conditions included in the filtering rules are not limited. For example, the pixel with the largest pixel value in the candidate region can be determined as the feature pixel, or the pixel with a pixel value greater than a preset value in the candidate region can be determined as the feature pixel. The setting method of the condition parameters in the filtering rules is also not limited. For example, some or all of the condition parameters in the filtering rules can be set to fixed values in advance; or some or all of the condition parameters in the filtering rules can be calculated and set in real time based on the determined feature pixels or candidate regions.
[0101] In this embodiment, to improve the accuracy of subsequent judgment of feature pixels, a filtering rule can be set based on the feature values of the selected feature pixels. That is, step S203 may include:
[0102] Sub-step S203a: Calculate the feature values of the seed pixel.
[0103] Sub-step S203b: Set filtering rules based on the feature values of seed pixels, and select feature pixels from the candidate region according to the filtering rules.
[0104] The feature value may include one or more parameters, and the feature value of the seed pixel can be calculated based on the relevant parameters of one or more seed pixels.
[0105] For example, in sub-step S203a, when the number of seed pixels is 1, that is, when only the first feature pixel is selected, the feature value of the first feature pixel can be used as the feature value of the seed pixel; when the number of seed pixels is greater than one, that is, when at least two feature pixels are selected, the feature value of the seed pixel can be calculated based on the feature values of all selected feature pixels; or the feature value of the most recently selected feature pixel can be used as the feature value of the seed pixel.
[0106] Optionally, to improve the accuracy of feature pixels, feature pixels can be selected from the candidate region by comparing the feature values of all pixels in the candidate region with the feature values of the seed pixel. That is, sub-step S203b may include: calculating the feature values of all pixels in the candidate region and determining the pixels in the candidate region whose feature values meet the screening rules as feature pixels.
[0107] Optionally, to improve the accuracy of feature pixel selection, the feature value may include multiple parameters. Specifically, the calculation method for the feature value may include:
[0108] Step C: Determine the target pixel point for which feature values need to be calculated, and define the area containing all pixels that are less than a second preset distance from the target pixel point as the target area.
[0109] Step D: Based on the distance between the pixel and the target pixel, divide the target region into a first sub-region, a second sub-region, and a third sub-region.
[0110] Step E: Determine the feature value of the target pixel based on the pixel value of the target pixel, the average pixel value of all pixels in the first sub-region, the average pixel value of all pixels in the second sub-region, the proportion of pixels in the first sub-region whose pixel value is greater than or equal to the target pixel value, the proportion of pixels in the second sub-region whose pixel value is greater than or equal to the average pixel value of all pixels in the first sub-region, and the proportion of pixels in the third sub-region whose pixel value is a ninth preset multiple of the target pixel value.
[0111] In step C, the target pixel is a single pixel. That is, when calculating the feature value of a seed pixel, the target pixel is the seed pixel, and the region containing all pixels less than a second preset distance from the seed pixel is determined as the target region. When calculating the feature value of all pixels in the candidate region, the target pixel is one of the pixels, and the region containing all pixels less than a second preset distance from the seed pixel is determined as the target region.
[0112] For example, see Figure 8 Each square represents a pixel, and the number in the square represents the distance between that pixel and the target pixel. The pixel marked "0.0" in the figure is the target pixel. If the second preset distance is 5 pixels, then the distance between the gray background pixels and the target pixel is less than 5 pixels, and the area where these pixels are located is the target area.
[0113] In step D, the division rules for the first, second, and third sub-regions can be determined based on the imaging characteristics of the fiber core in the original image. (See also...) Figure 3 The closer the area is to the fiber core, the brighter it is. Therefore, based on the pixel value distribution range of the pixels in the original image, the first sub-region, the second sub-region, and the third sub-region can be divided from a circular region centered on the pixel where the fiber core is located.
[0114] For example, when the distance between adjacent fiber cores is 4 pixels, if the second preset distance is 5 pixels, the first sub-region can be the region where the distance from the target pixel is greater than 0 pixels and less than 2 pixels; the second sub-region can be the region where the distance from the target pixel is greater than or equal to 2 pixels and less than 3 pixels; and the third sub-region is the outer region of the second sub-region.
[0115] See Figure 9 Each square represents a pixel. Pixels marked as 1 belong to the first sub-region, pixels marked as 2 belong to the second sub-region, and pixels marked as 3 belong to the third sub-region.
[0116] In step E, if FV1 is used to identify the pixel value of the target pixel, FV2 is used to identify the average pixel value of all pixels in the first sub-region, and FV3 is used to identify the average pixel value of all pixels in the second sub-region, then when FV4 is used to identify the proportion of pixels in the first sub-region whose pixel value is greater than or equal to the pixel value of the target pixel, the value of FV4 is the proportion of pixels in the first sub-region whose pixel value is greater than or equal to FV1.
[0117] When using FV5 to identify the proportion of pixels in the second sub-region whose pixel value is greater than or equal to the target pixel value, the value of FV5 is the proportion of pixels in the second sub-region whose pixel value is greater than or equal to FV1.
[0118] When FV6 is used to identify the proportion of pixels in the second sub-region whose pixel value is greater than or equal to the average pixel value of all pixels in the first sub-region, the value of FV6 is the proportion of pixels in the second sub-region whose pixel value is greater than or equal to FV2.
[0119] When β is used to identify the ninth preset multiple, and FV7 is used to identify the proportion of pixels in the third sub-region whose pixel value is greater than or equal to the ninth preset multiple of the target pixel value, the value of FV7 is the proportion of pixels in the third sub-region whose pixel value is greater than or equal to β times FV1, where the value of β can range from 0.8 to 1.0.
[0120] Optionally, when the feature value includes multiple parameters, the corresponding filtering rules can also include multiple filtering conditions. Pixels in the candidate region can only be selected as feature pixels if they meet all the filtering conditions. Specifically, the feature values of the feature pixels selected in sub-step S203b must meet all of the following filtering conditions:
[0121] The FV1 of the feature pixel is greater than or equal to a first preset multiple of the FV1 of the seed pixel;
[0122] The FV2 of the feature pixel is greater than or equal to a second preset multiple of the FV2 of the seed pixel;
[0123] The FV3 of the feature pixel is greater than or equal to the third preset multiple of the FV3 of the seed pixel;
[0124] The FV4 of the feature pixel is less than or equal to the fourth preset multiple of the FV4 of the seed pixel;
[0125] The FV5 of the feature pixel is less than or equal to the fifth preset multiple of the FV5 of the seed pixel;
[0126] The FV6 of the feature pixel is less than or equal to the sixth preset multiple of the FV6 of the seed pixel;
[0127] The FV7 of the feature pixel is greater than or equal to the seventh preset multiple of the FV7 of the seed pixel, and less than or equal to the eighth preset multiple of the FV7 of the seed pixel.
[0128] The values of the first, second, third, and seventh preset multiples can range from 0.8 to 1.0; the values of the fourth, fifth, sixth, and eighth preset multiples can range from 1.0 to 2.0.
[0129] Optionally, after multiple tests and verifications, it is preferable to set the first, second, third, and seventh preset multiples to 0.8; and the fourth, fifth, sixth, and eighth preset multiples to 1.2.
[0130] Optionally, in order to improve the accuracy of subsequent judgment of feature pixels, when the number of seed pixels is greater than one, the feature value of the seed pixel can be determined based on the feature values of all selected feature pixels. That is, sub-step S203b may also include: setting a filtering rule based on the average feature value of all seed pixels.
[0131] For example, if the feature values include seven parameters: FV1, FV2, FV3, FV4, FV5, FV6, and FV7, then the average of FV1, FV2, FV3, FV4, FV5, FV6, and FV7 of all seed pixels can be used as the feature values of the seed pixels.
[0132] In this embodiment, in order to further determine candidate regions for selecting other feature pixels from the target image based on the feature pixels selected in sub-step S203b, the following may be included after sub-step S203b:
[0133] Sub-step S203c: The feature pixel is determined as the seed pixel, and the candidate region is updated to the region containing all pixels that are less than the second preset distance from the seed pixel.
[0134] Furthermore, in order to continue selecting other feature pixels in the updated candidate region, after executing sub-step S203c, the process can return to execute sub-step S203a, that is, return to the step of calculating the feature values of the seed pixel. If no new feature pixels can be selected through sub-step S203b, it means that all feature pixels in the target image have been selected, and the execution of step S203 is complete.
[0135] S204. Based on the position of the feature pixels, form a binarized image.
[0136] In this embodiment, to distinguish between pixels with two different attributes, a binarized image of the same size as the target image is formed, and the pixel values of the pixels with the two attributes are set to two different values in the binarized image. Specifically, to distinguish between feature pixels and non-feature pixels in the binarized image, the pixel value of all pixels in the binarized image that are at the same position as the feature pixels is the first pixel value, and the pixel value of all pixels that are at a different position than the feature pixels is the second pixel value, wherein the first pixel value and the second pixel value are different.
[0137] Optionally, to improve the occlusion effect of the field-of-view mask, the second pixel value can be fixed at 0, and the first pixel value can be any integer between 1 and 255. For example, the pixel value of the pixel in the binarized image that is at the same position as the feature pixel can be set to 1, and the pixel value of the pixel that is at a different position from the feature pixel can be set to 0.
[0138] S205. Perform morphological processing on the binarized image to obtain the field mask of the endoscopic imaging system.
[0139] In this embodiment, morphological processing of the binarized image may include performing morphological closing and opening operations using operators. Morphological closing operations can fill in small holes within the image, connecting adjacent objects and smoothing boundaries. Opening operations can eliminate small objects in fine images, separating imaged objects in fine areas and smoothing the boundaries of larger objects.
[0140] In this embodiment, since holes may still exist after morphological processing of the binarized image, step S205 may further include the following to eliminate hole defects in the image:
[0141] Sub-step S205a: Morphological processing is performed on the binarized image to obtain the first mask image.
[0142] Sub-step S205b involves filling holes in the first mask image to obtain the field mask for the endoscopic imaging system.
[0143] The first mask image can be an image obtained by performing morphological processing on a binarized image using a first preset operator. Hole filling is used to remove holes present in the first mask image to obtain a better field-of-view mask for the endoscopic imaging system. This embodiment does not limit the hole filling method.
[0144] Optionally, in order to obtain better morphological processing results, the first preset operator can be a circular operator, and the radius of the first preset operator is not less than the distance between adjacent fiber cores.
[0145] Optionally, while a larger circular radius of the first preset operator results in better morphological processing, it also increases processing time. Therefore, to achieve better processing results and shorter processing time, the radius of the first preset operator can be preferably set to the distance between adjacent fiber cores. For example, when the distance between adjacent fiber cores is 4 pixels, the radius of the first preset operator can be set to 4 pixels.
[0146] Optionally, since the edges of the image obtained after filling the holes in the first mask image still have burrs, in order to reduce the edge burrs of the endoscopic imaging system's field of view mask, sub-step S205b may further include:
[0147] The first mask image is filled with holes to obtain the second mask image; the second mask image is then subjected to morphological processing to obtain the field mask of the endoscopic imaging system.
[0148] The second preset operator can be used to perform morphological processing on the second mask image.
[0149] Optionally, to achieve better processing results, the second preset operator can be a circular operator, and the radius of the second preset operator is not less than the distance between adjacent fiber cores. Preferably, the radius of the second preset operator is set to 20 pixels.
[0150] In this embodiment, at least two original images are obtained through imaging using an endoscopic imaging system. Then, all original images are processed to obtain the target image, which allows for more accurate determination of the fiber core's location from the target image. Based on the distance between adjacent fiber cores in the endoscopic imaging system, candidate regions for feature pixels are divided in the target image, enabling rapid and accurate determination of feature pixels. By setting filtering rules based on the feature values of the selected feature pixels, the accuracy of subsequent feature pixel judgments can be continuously improved. By calculating feature values based on multiple parameters, the accuracy of feature pixel filtering can be improved. Through hole filling processing and two morphological processing steps, the smoothness of the endoscopic imaging system's field-of-view mask edge region can be improved.
[0151] Example 3
[0152] This application provides an apparatus for obtaining a field mask for an endoscopic imaging system, such as... Figure 10 As shown, the device for obtaining the field mask of an endoscopic imaging system includes an imaging module, a feature pixel point determination module, a binarized image generation module, and a morphological processing module, wherein:
[0153] The imaging module is used to image the target object and obtain the target image;
[0154] The feature pixel determination module is used to determine the position of feature pixels in the target image based on the pixel values of the target image.
[0155] The binarized image generation module is used to generate a binarized image based on the position of feature pixels.
[0156] The morphological processing module is used to perform morphological processing on the binarized image to obtain the field mask of the endoscopic imaging system.
[0157] In this embodiment, the feature pixel determination module includes a candidate region determination unit and a filtering unit. The candidate region determination unit is used to determine the candidate region of feature pixels in the target image based on the distance between adjacent fiber cores of the endoscopic imaging system. The filtering unit is used to select feature pixels from the candidate region according to the set filtering rules.
[0158] In this embodiment, the candidate region determination unit is further configured to determine the center pixel of the target image; select a seed pixel from all pixels that are less than a first preset distance from the center pixel, wherein the seed pixel has the largest pixel value and the first preset distance is greater than the distance between adjacent fiber cores; and determine the region containing all pixels that are less than a second preset distance from the seed pixel as a candidate region, wherein the second preset distance is greater than the distance between adjacent fiber cores.
[0159] In this embodiment, the filtering unit is also used to calculate the feature value of the seed pixel; set filtering rules according to the feature value of the seed pixel, and select feature pixels from the candidate region according to the filtering rules; determine the feature pixel as the seed pixel, and update the candidate region to the region where all pixels are located at a distance less than a second preset distance from the seed pixel; and return to perform the calculation of the feature value of the seed pixel.
[0160] In this embodiment, a filtering rule setting module is also included, which is used to set filtering rules based on the average feature value of all seed pixels when the number of seed pixels is greater than one.
[0161] In this embodiment, the filtering unit is also used to calculate the feature values of all pixels in the candidate region, and to determine the pixels in the candidate region whose feature values satisfy the filtering rules as feature pixels.
[0162] In this embodiment, the feature pixel determination module further includes a feature value calculation unit. The feature value calculation unit is used to determine the target pixel whose feature value needs to be calculated, and to determine the area where all pixels that are less than a second preset distance from the target pixel are located as the target area. Based on the distance between the pixel and the target pixel, the target area is divided into a first sub-area, a second sub-area, and a third sub-area. Based on the pixel value of the target pixel, the average pixel value of all pixels in the first sub-area, the average pixel value of all pixels in the second sub-area, the proportion of pixels in the first sub-area whose pixel value is greater than or equal to the target pixel value, the proportion of pixels in the second sub-area whose pixel value is greater than or equal to the target pixel value, the proportion of pixels in the second sub-area whose pixel value is greater than the average pixel value of all pixels in the first sub-area, and the proportion of pixels in the third sub-area whose pixel value is greater than or equal to a ninth preset multiple of the target pixel value, the feature value of the target pixel is determined.
[0163] In this embodiment, the imaging module is also used to image the target object and obtain at least two original images; based on all the original images, the target image is obtained.
[0164] Optionally, the imaging module is also used to image the target object at one operating power of the endoscopic imaging system to obtain at least two raw images; and to center all raw images by pixel values to obtain the target image.
[0165] Optionally, the imaging module is also used to image the target object at two different operating powers of the endoscopic imaging system to obtain a first power image and a second power image; and to perform difference processing on the pixel values of the corresponding pixels in the first power image and the second power image to obtain the target image.
[0166] Optionally, when the first power image and / or the second power image are obtained by processing multiple frames of original images, the imaging module is further configured to image the target object at the first operating power of the endoscopic imaging system to obtain multiple frames of original images; and to center all the multiple frames of original images by pixel values to obtain the first power image. And / or, the imaging module is further configured to image the target object at the second operating power of the endoscopic imaging system to obtain multiple frames of original images; and to center all the multiple frames of original images by pixel values to obtain the second power image.
[0167] In this embodiment, the morphological processing module includes a first processing unit and a second processing unit. The first processing unit is used to perform morphological processing on the binarized image to obtain a first mask image. The second processing unit is used to fill holes in the first mask image to obtain a field mask for the endoscopic imaging system.
[0168] Optionally, the second processing unit is further configured to fill holes in the first mask image to obtain a second mask image; and to perform morphological processing on the second mask image to obtain a field mask for the endoscopic imaging system.
[0169] This embodiment provides an apparatus for obtaining the field mask of an endoscopic imaging system, which can realize the corresponding methods for obtaining the field mask of the endoscopic imaging system in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0170] Specific embodiments of this application have now been described. Other embodiments are within the scope of the appended claims. In some cases, the actions described in the claims can be performed in a different order and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing can be advantageous.
[0171] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0172] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.
[0173] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0174] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0175] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0176] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0177] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0178] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0179] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0180] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0181] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0182] This application can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific transactions or implement specific abstract data types. This application can also be practiced in distributed computing environments where transactions are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0183] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0184] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for obtaining a field-of-view mask for an endoscopic imaging system, characterized in that, include: To obtain a target image by imaging the target object; Based on the pixel values of the target image, determine the positions of the feature pixels in the target image; A binarized image is formed based on the position of the feature pixels; Morphological processing is performed on the binarized image to obtain the field mask of the endoscopic imaging system; Determining the position of feature pixels in the target image based on the pixel values of the target image includes: Based on the distance between adjacent fiber cores of the endoscopic imaging system, candidate regions for the feature pixels are determined in the target image; The feature pixels are selected from the candidate regions according to the set filtering rules.
2. The method according to claim 1, characterized in that, Determining the candidate region of the feature pixel in the target image based on the adjacent fiber core distance of the endoscopic imaging system includes: Determine the center pixel of the target image; A seed pixel is selected from all pixels that are less than a first preset distance from the center pixel, wherein the seed pixel has the largest pixel value and the first preset distance is greater than the distance between adjacent fiber cores; The region containing all pixels that are less than a second preset distance from the seed pixel is determined as the candidate region, wherein the second preset distance is greater than the distance between adjacent fiber cores.
3. The method according to claim 2, characterized in that, The step of selecting the feature pixels from the candidate region according to the set filtering rules includes: Calculate the feature values of the seed pixels; The filtering rules are set according to the feature values of the seed pixels, and the feature pixels are selected from the candidate region according to the filtering rules. The feature pixel is determined as the seed pixel, and the candidate region is updated to be the region containing all pixels that are less than a second preset distance from the seed pixel. Return to the step of calculating the feature value of the seed pixel.
4. The method according to claim 3, characterized in that, When the number of seed pixels is greater than one, setting the filtering rule based on the feature value of the seed pixels includes: setting the filtering rule based on the average feature value of all the seed pixels.
5. The method according to claim 3, characterized in that, The step of selecting the feature pixel from the candidate region according to the filtering rule includes: calculating the feature value of all pixels in the candidate region, and determining the pixel in the candidate region whose feature value satisfies the filtering rule as the feature pixel.
6. The method according to claim 3, characterized in that, The method for calculating the eigenvalues includes: Determine the target pixel point for which feature values need to be calculated, and define the region containing all pixels that are less than the target pixel point by the second preset distance as the target region; Based on the distance between the pixel and the target pixel, the target region is divided into a first sub-region, a second sub-region, and a third sub-region; The feature value of the target pixel is determined based on the pixel value of the target pixel, the average pixel value of all pixels in the first sub-region, the average pixel value of all pixels in the second sub-region, the proportion of pixels in the first sub-region whose pixel value is greater than or equal to the pixel value of the target pixel, the proportion of pixels in the second sub-region whose pixel value is greater than or equal to the pixel value of the target pixel, the proportion of pixels in the second sub-region whose pixel value is greater than or equal to the average pixel value of all pixels in the first sub-region, and the proportion of pixels in the third sub-region whose pixel value is greater than or equal to a ninth preset multiple of the pixel value of the target pixel.
7. The method according to claim 1, wherein imaging the target object to obtain a target image comprises: Imaging of the target object yields at least two original images; The target image is obtained based on all the original images.
8. The method according to claim 1, characterized in that, The morphological processing of the binarized image to obtain the field-of-view mask for the endoscopic imaging system includes: The binarized image is subjected to morphological processing to obtain a first mask image; The first mask image is filled with holes to obtain the field mask of the endoscopic imaging system.
9. An apparatus for obtaining a field mask for an endoscopic imaging system, based on the method of any one of claims 1-8, characterized in that, include: The imaging module is used to image the target object and obtain the target image; The feature pixel point determination module is used to determine the position of the feature pixels in the target image based on the pixel values of the target image; The binarized image generation module is used to generate a binarized image based on the position of the feature pixels. The morphological processing module is used to perform morphological processing on the binarized image to obtain the field mask of the endoscopic imaging system.
Citation Information
Patent Citations
Image shadow removing method and device
CN104240207A
Method and device for detecting lens center
CN106839976A
Digital watermark positioning method and apparatus
CN108269220A