IMAGE PROCESSING METHOD, ELECTRONIC DEVICE, AND READABLE STORAGE MEDIUM
The image processing method for capsule endoscopes adjusts frame rates based on cavity detection, improving intestinal cavity imaging and power efficiency by selectively outputting images, addressing power and view constraints.
Patent Information
- Application Number
- JP2023527384
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2020-11-06
- Filing Date
- 2021-11-02
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-11-02
Smart Images

Figure 0007540087000002 
Figure 0007540087000003 
Figure 0007540087000001
Abstract
Description
[Technical field]
[0001] (CROSS REFERENCE TO RELATED APPLICATIONS) This application claims priority to a Chinese patent application filed on November 6, 2020, with application number 202011227075.5 and title "Image Processing Method, Electronic Device, and Readable Storage Medium," the entire contents of which are incorporated herein by reference.
[0002] The present invention relates to the field of image processing in medical devices, and in particular to an image processing method, an electronic device and a readable storage medium. [Background technology]
[0003] Capsule endoscopes are increasingly being used to examine the digestive tract. They are ingested through the mouth, passed through the mouth, esophagus, stomach, small intestine and large intestine, and finally expelled from the body. Capsule endoscopes typically move passively with the peristaltic movement of the digestive tract, and during this process, the capsule endoscope takes images at a constant frame rate to allow doctors to assess the health of each part of the patient's digestive tract.
[0004] Capsule endoscopes are powered by a built-in battery, take pictures of the digestive tract with a camera module, and transmit them wirelessly to the outside of the body. Due to limitations such as battery power, the total examination time of a capsule endoscope is usually 8 to 14 hours, and the total number of images taken is 30,000 to 100,000. Therefore, the average image capture frame rate is 1 to 2 fps (frames per second), and can be increased to 4 to 8 fps and even 10 to 30 fps in a short period of time.
[0005] Considering power consumption, image quality, and transmission efficiency, existing capsule endoscopes have the following problems.
[0006] Problem 1: When considering image quality, the higher the frame rate, the smoother the image will be and the lower the chance of missing a shot. However, capsule endoscopes are powered by batteries, which have limited power and cannot support 8 to 14 hours of constant shooting at a high frame rate.
[0007] Problem 2: If you always shoot at a low frame rate to conserve battery power, you risk missing shots.
[0008] Problem 3: Too few images of the intestinal cavity, too many images of the intestinal wall. In small and large intestine examinations, observing the structure and morphology of the intestinal cavity is extremely useful for diagnosing diseases. However, when using a capsule endoscope in the intestinal tract, the lens tends to adhere to the intestinal wall, resulting in a narrow field of view and making it impossible to grasp the overall condition of the intestinal tract, which hinders the discovery of lesions.
[0009] Currently, there is a need to ensure sufficient power, increase the imaging frame rate, and at the same time obtain more information about the intestinal cavity, so new image processing methods are needed to solve the above problems. Summary of the Invention
[0010] An object of the present invention is to provide an image processing method, an electronic device and a readable storage medium for solving the above technical problems.
[0011] In order to achieve one of the above objects of the invention, one embodiment of the present invention provides an image processing method, which includes the steps of obtaining an original image, determining whether the current original image contains a cavity, and if so, increasing an imaging frame rate based on an original imaging frame rate, and if not, maintaining the original imaging frame rate and continuing imaging.
[0012] In a further refinement of an embodiment of the present invention, determining whether the current original drawing includes a cavity comprises: converting the current original image into a grayscale image; converting the greyscale image into a first binarized image; obtaining each connected region of dark pixels based on the first binarized image, and counting the total number of the connected regions of the dark pixels in which the number of the dark pixels is greater than a first threshold value set in advance, the dark pixels being pixel points with small grayscale values; and determining whether the current original image includes a cavity based on the total number of connected regions of the dark pixels obtained by counting.
[0013] As a further refinement of an embodiment of the present invention, converting the grayscale image to the first binarized image includes binarizing the grayscale image to form the first binarized image based on a maximum grayscale value and a minimum grayscale value of the grayscale image.
[0014] In a further refinement of an embodiment of the present invention, the step of binarizing the grayscale image to form the first binarized image based on the maximum grayscale value and the minimum grayscale value of the grayscale image may specifically include: if the grayscale value of a pixel point in the grayscale image is greater than a grayscale threshold, the value of this pixel point is represented by a first value in the first binarized image, and if the grayscale value of a pixel point in the grayscale image is equal to or less than the grayscale threshold, the value of this pixel point is represented by a second value in the first binarized image, the first value and the second value being different; The grayscale threshold includes m1=R×maxv+(1−R)×minv, where R denotes a scale factor that is a constant, maxv denotes the maximum grayscale value in the grayscale image, and minv denotes the minimum grayscale value in the grayscale image.
[0015] As a further improvement of an embodiment of the present invention, determining whether the current original image includes a cavity based on the total number of the connected regions of the dark pixels obtained by counting may specifically include: if the total number of connected regions of the dark pixels is zero, determining that the current original image does not include a cavity; determining that the current original image contains a cavity if the total number of connected regions of dark pixels is between 0 and a first index threshold; If the total number of the connected regions of the dark pixels is equal to or greater than the first index threshold, confirming a misrecognition of the current original image.
[0016] In a further refinement of an embodiment of the present invention, determining whether the current original drawing includes a cavity comprises: converting the current original image into a depth image, wherein each depth value in the depth image is a distance of a detection object corresponding to each pixel point in the original image relative to the capsule endoscope; converting the depth image into a second binarized image; obtaining each connected region of bright pixels based on the second binarized image, and counting the total number of the connected regions of the bright pixels in which the number of the bright pixels is greater than a second threshold value set in advance, the bright pixels being pixel points that are far away; and determining whether the current original image includes a cavity based on the total number of connected regions of the bright pixels obtained by counting.
[0017] In a further refinement of an embodiment of the invention, converting the greyscale image into a first binarized image and converting the depth image into the second binarized image comprises: If a depth value of a pixel point in the depth image is greater than a predetermined depth threshold, the value of the pixel point is represented by a third value in the second binarized image, and if the grayscale value of a pixel point in the grayscale image is less than or equal to a predetermined depth threshold, the value of the pixel point is represented by a fourth value in the second binarized image, wherein the third value and the fourth value are different.
[0018] As a further refinement of an embodiment of the present invention, determining whether the current original image includes a cavity based on the total number of connected regions of the bright pixels obtained by counting may specifically include: if the total number of connected regions of the bright pixels is zero, determining that the current original image does not include a cavity; determining that the current original image contains a cavity if the total number of connected regions of light pixels is between 0 and a second index threshold; If the total number of connected regions of light pixels is greater than or equal to the second index threshold, confirming a misrecognition of the current original image.
[0019] As a further refinement of an embodiment of the present invention, when included, increasing the shooting frame rate based on the original shooting frame rate specifically includes: if it is determined that the current original contains a cavity, using a total area of the cavities as a cavity index corresponding to the original; The imaging frame rate is adjusted according to the cavity index, and the larger the cavity index, the higher the imaging frame rate.
[0020] As a further refinement of an embodiment of the present invention, if the current original image includes a cavity, after increasing the shooting frame rate based on the original shooting frame rate, the image processing method further comprises: Calculating a sampling output interval time t of adjacent images according to the original shooting frame rate; Starting from the first original image acquired, sample one original image every distance interval time t. Further included is determining, after each sampling, based on the currently sampled original, whether it contains a cavity.
[0021] In a further refinement of an embodiment of the invention, after determining whether the current original image contains a cavity, the image processing method further comprises: Calculating a sampling output interval time t of adjacent images according to the original shooting frame rate; Starting from the first original image acquired, sample one original image every distance interval time t. after each sampling, comparing the currently sampled original image for similarity with a pre-stored image; If so, discarding the currently sampled original; If not, the method further includes outputting the currently sampled original and replacing the pre-stored image with the currently sampled original.
[0022] In order to achieve one of the above objects of the invention, one embodiment of the present invention provides an electronic device including a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor executes the program to perform steps in an image processing method, wherein the image processing method includes obtaining an original image, determining whether the current original image contains a cavity, and if so, increasing the shooting frame rate based on the original shooting frame rate, and if not, continuing shooting while maintaining the original shooting frame rate.
[0023] In order to achieve one of the above objects of the invention, one embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs steps in an image processing method, in which the image processing method includes obtaining an original image, determining whether the current original image contains a cavity, and if so, increasing the shooting frame rate based on the original shooting frame rate, and if not, maintaining the original shooting frame rate and continuing shooting. Effect of the Invention
[0024] Compared with the prior art, the present invention has the following beneficial effects: The image processing method, electronic device, and readable storage medium of the present invention can automatically adjust the shooting frame rate of the capsule endoscope according to the image actually captured by the capsule endoscope, improve the capture of the intestinal cavity image, reduce the probability of missing an image, and at the same time, save power and improve the usage efficiency of the capsule endoscope. [Brief description of the drawings]
[0025] [Figure 1]FIG. 2 is a schematic diagram showing the flow of an image processing method provided by an embodiment of the present invention. [Diagram 2] FIG. 2 is a schematic diagram showing a flow of cavity identification based on an original image provided by the first embodiment of the present invention. [Diagram 3] 1 is a grayscale image of one embodiment of the present invention. [Figure 4] 1 is a first binarized image according to one embodiment of the present invention. [Diagram 5] 4 is a first binarized image according to another embodiment of the present invention; [Figure 6] FIG. 11 is a schematic diagram showing a flow of cavity identification based on an original drawing provided by the second embodiment of the present invention. [Figure 7] 1 is a depth image of one embodiment of the present invention. [Figure 8] 1 is a second binarized image according to an embodiment of the present invention. [Figure 9] FIG. 2 is a schematic diagram showing the flow of an image processing method according to a preferred embodiment formed based on FIG. 1. [Figure 10] FIG. 2 is a schematic diagram showing an image-based thread operation flow provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0026] The present invention will be described in detail below with reference to specific embodiments shown in the accompanying drawings. However, these embodiments do not limit the present invention, and any modifications of structure, method or function obtained based on these embodiments made by those skilled in the art are all within the protection scope of the present invention.
[0027] As shown in FIG. 1, a first embodiment of the present invention provides an image processing method, which includes the following steps:
[0028] S1, obtain an original image, and determine whether the current original image contains a cavity. If the original image contains a cavity, increase the shooting frame rate based on the original shooting frame rate; if the original image does not contain a cavity, maintain the original shooting frame rate and continue shooting.
[0029] In a preferred embodiment of the present invention, the following two methods are used to identify whether an original image contains a cavity.
[0030] In a first embodiment (method 1) of the present invention, as shown in FIG. 2, determining whether a current original image contains a cavity includes: step S11: converting the current original image into a grayscale image; step S12: converting the grayscale image into a first binary image; step S13: obtaining each connected area of dark pixels based on the first binary image, and counting the total number of connected areas of dark pixels in which the number of dark pixels is greater than a preset first threshold, where the dark pixels are pixel points with small grayscale values; and step S14: confirming whether the current original image contains a cavity based on the total number of connected areas of dark pixels obtained by counting.
[0031] In step S11, the original image is a color image in RGB format, and converting a color image to a grayscale image is a conventional technique, so no further description is given here. As shown in Figure 3, after converting the original image to a grayscale image, each pixel point in the grayscale image has a unique grayscale value.
[0032] In step S12, there are various methods for converting the grayscale image into the first binarized image. In a preferred embodiment of the present invention, the grayscale image is binarized based on the maximum and minimum grayscale values of the grayscale image to form the first binarized image. Specifically, a grayscale threshold is calculated based on the maximum and minimum grayscale values. If the grayscale value of a pixel point in the grayscale image is greater than the grayscale threshold, the value of the pixel point is represented by a first value in the first binarized image, and if the grayscale value of a pixel point in the grayscale image is equal to or less than the grayscale threshold, the value of the pixel point is represented by a second value in the first binarized image. The first value and the second value are different. In a preferred embodiment of the present invention, the grayscale threshold is m1=R×maxv+(1−R)×minv, where R is a constant scale factor, maxv is the maximum grayscale value in the grayscale image, and minv is the minimum grayscale value in the grayscale image. As shown in Fig. 3, in one embodiment of the present invention, R=0.2 is set, and the maxv and minv values obtained by analyzing the grayscale image are maxv=255 and minv=0. Thus, the value of m1 is calculated as 51 by the above formula. Furthermore, the grayscale value of each pixel point in the grayscale image is compared with the calculated grayscale threshold m1 in sequence, and then a first binarized image is formed as shown in Fig. 4.
[0033] It should be noted that in the first binarized image, each pixel point in the image is replaced with only two values, and the two values can be selected as needed, and in a specific embodiment of the present invention, the two values are "0" and "255", respectively, where "0" indicates a dark pixel and "255" indicates a light pixel. In other embodiments of the present invention, "0" and "255" may indicate a light pixel and a dark pixel, respectively, and the two values can be changed as needed, for example, to "0" and "1", or to other values, and further description is omitted here.
[0034] Regarding step S12, when imaging the intestinal cavity, there are dark and light scenes, so the scene has a gradation. Therefore, the dark scene is usually identified as the intestinal cavity. Then, the binarization process can isolate the intestinal cavity region. In this example, the brightness is set to 0 if it is less than the grayscale threshold, and 255 if it is greater than the grayscale threshold.
[0035] In step S13, the number of dark pixels for each connected region of dark pixels is counted and compared with a first threshold to eliminate connected regions of spared dark pixels.
[0036] The first threshold is a fixed value, and its magnitude may be set as necessary.
[0037] As shown in Fig. 5, Fig. 5 shows a first binarized image obtained in another embodiment of the present invention, in the embodiment shown in Fig. 4 and Fig. 5, the first threshold value is 4, and in the embodiment shown in Fig. 4, after comparison, the connected area of the remaining dark pixels for calculation is 1. For the embodiment shown in Fig. 5, the number of pixels in the connected area of three dark pixels is all less than the first threshold value, thus, after comparison, the connected area of the remaining dark pixels for calculation is 0 in the embodiment shown in Fig. 5.
[0038] Preferably, in step S14, if the total number of connected regions of dark pixels is 0, it is determined that the current original image does not contain a cavity; if the total number of connected regions of dark pixels is between 0 and a first index threshold, it is determined that the current original image contains a cavity; and if the total number of connected regions of dark pixels is equal to or greater than the first index threshold, it is determined that the current original image is misrecognized.
[0039] The first index threshold is a fixed value, the magnitude of which may be set as required. In a specific embodiment of the present invention, for cavities in an image, if any, the number of cavities is usually 1, 2 or 3, and the first index threshold is set to, for example, 4, correspondingly.
[0040] As shown in FIG. 6, in the second embodiment (method 2) of the present invention, determining whether the current original image contains a cavity includes: step S21: converting the current original image into a depth image, where each depth value in the depth image is a distance to the capsule endoscope of the object to be detected corresponding to each pixel point in the original image; step S22: converting the depth image into a second binary image; step S23: obtaining each connected area of bright pixels based on the second binary image, and counting the total number of connected areas of bright pixels in which the number of bright pixels is greater than a preset second threshold, where the bright pixels are pixel points that are far away; step S24: confirming whether the current original image contains a cavity based on the total number of connected areas of bright pixels obtained by counting.
[0041] Regarding step S21, there are various methods for converting an original image into a depth image, which are prior art. Specifically, see Chinese patent application with disclosure number CN110335318A, entitled "Method for measuring objects in the digestive tract based on an imaging system".
[0042] Regarding step S22, there are various methods for converting the depth image into the second binarized image. In one specific embodiment of the present invention, step S22 specifically comprises the following steps: if the depth value of a pixel point in the depth image is greater than a predetermined depth threshold, the value of this pixel point is represented by a third value in the second binarized image; if the grayscale value of a pixel point in the grayscale image is less than or equal to the predetermined depth threshold, the value of this pixel point is represented by a fourth value in the second binarized image, and the third value and the fourth value are different.
[0043] The preset depth threshold is a fixed value, and its magnitude may be set as required.
[0044] As shown in Fig. 7, in one embodiment of the present invention, the preset depth threshold is set to 19, and the unit is mm. Furthermore, after comparing each depth value in the depth image with the preset depth threshold in sequence, a second binarized image is formed as shown in Fig. 8.
[0045] It should be noted that in the second binarized image, the depth value of each pixel point in the image is replaced by only two values, and correspondingly, the two values can be selected as needed, and in the embodiment of the present invention, the two values are "0" and "1", respectively, where "0" indicates that the depth value of the pixel point is small, and "1" indicates that the depth value of the pixel point is large, that is, representing a pixel point that is far away. In other embodiments of the present invention, "0" and "1" can also be interchanged, and the two values can also be changed as needed, for example, to "0" and "255", or to other values, and further description is omitted here.
[0046] Regarding step S22, when imaging an intestinal cavity, there are distant and close scenes, so the scene has a multi-stage structure. Therefore, a distant scene is usually identified as an intestinal cavity, and a close scene is usually identified as a scene attached to the intestinal wall. The binarization process can separate the intestinal cavity region. In this specific example, a distance greater than a preset depth threshold is set to 1, and a distance less than the preset depth threshold is set to 0.
[0047] For step S23, for each connected region of bright pixels, count the number of bright pixels and compare it with a second threshold to eliminate the connected region of spared bright pixels. In the example shown in Figure 8, after the comparison, there is one connected region of bright pixels remaining for the calculation.
[0048] Preferably, for step S24, if the total number of connected regions of bright pixels is 0, confirm that the current original image does not contain a cavity; if the total number of connected regions of bright pixels is between 0 and a second index threshold, confirm that the current original image contains a cavity; and if the total number of connected regions of bright pixels is equal to or greater than the second index threshold, confirm that the current original image is misrecognized.
[0049] The second index threshold is a fixed value, the magnitude of which may be set as required. In an embodiment of the present invention, for cavities in an image, if any, the number of cavities is usually 1, 2 or 3, and the second index threshold is set to, for example, 4, correspondingly.
[0050] It should be noted that the above-mentioned two embodiments for determining whether a cavity is included in the current original image, i.e., method 1 and method 2, may be selected and may be executed sequentially or simultaneously. When executed sequentially, for example, if method 1 is executed first and then method 2 is executed, when it is determined that a cavity is included in method 1, verification is performed using method 2, and the result of method 2 is the final determination result. Similarly, if method 2 is executed first and then method 1 is executed, when it is determined that a cavity is included in method 2, verification is performed using method 1, and the result of method 1 is the final determination result. When the two methods are executed simultaneously, when it is determined that a cavity is included in both method 1 and method 2, it is confirmed that a cavity is included, and if not, it is confirmed that the current original image is misrecognized.
[0051] Preferably, in step S1, when it is determined that a cavity is included, the shooting frame rate is increased based on the original shooting frame rate; specifically, when it is determined that a cavity is included in the current original image, the total area of the connected regions used to identify the cavity is used as a cavity index corresponding to the original image, and the shooting frame rate is adjusted according to the cavity index; the larger the cavity index, the higher the shooting frame rate.
[0052] For ease of understanding, the following description will be given with reference to the specific example shown in Fig. 4. For example, if the area of each pixel point is 1, then in the specific example shown in Fig. 4, the number of pixel points included in the connected area of the dark pixels is 6. Therefore, the value of the area is 6. In other words, the cavity index corresponding to this original image is 6.
[0053] Furthermore, before taking an image, the mapping relationship between the frame rate and the cavity index is set. For example, when the original base frame rate is 2 fps and the cavity index is 4, the frame rate is 4 fps, when the cavity index is 5, the frame rate is 5 fps, when the cavity index is 6, the frame rate is 6 fps. In this way, the mapping relationship between the cavity index and the frame rate can be set as required, and further description is omitted here.
[0054] According to the above mapping relationship, in the specific example shown in FIG. 4, a cavity is included and the cavity index is 6, so the shooting frame rate needs to be increased, and the shooting frame rate after adjustment is 6 fps.
[0055] Further, as shown in Fig. 9, in a preferred embodiment of the present invention, after determining whether the current original image contains a cavity, the method further includes: step P1: calculating the sampling output interval time t of adjacent images according to the original shooting frame rate; step P2: starting from the first original image acquired, sampling one original image every distance interval time t; step P3: after each sampling, comparing the similarity between the current sampled original image and the pre-stored image, discarding the current sampled original image if similar, outputting the current sampled original image if not similar, and replacing the pre-stored image with the current sampled original image. In this way, a large number of redundant images are generated during the shooting process, but during the output process, the images are selectively output, that is, the output of more overlapping images can be avoided, and the doctor's interpretation efficiency can be improved and the doctor's interpretation burden can be reduced.
[0056] It should be noted that steps P1 to P3 above are merely added for the convenience of explanation, and that the order described does not actually represent the order in which the steps are executed.
[0057] For step P1, t=1 / f(s), where f indicates the original shooting frame rate and s is the time unit "seconds."
[0058] In step P2, the sampling interval time is t, that is, if the original shooting frame rate is not changed, each captured image is sampled. If the shooting frame rate is increased, only the images captured at intervals of t from the first image are sampled, that is, even if the shooting frame rate is increased, the total number of samples within the same time period does not change. In this way, the sampling efficiency can be improved.
[0059] In this case, sampling means that the processing thread samples the captured images at a predetermined time interval and performs a similarity comparison only on the sampled images. In this way, the similarity comparison is selectively performed and the images are selectively output, which can improve the efficiency of image interpretation.
[0060] Regarding step P3, the similarity comparison is a general-purpose algorithm in the prior art, which usually involves extracting the features of the original image, counting the feature vectors, and finally making a similarity judgment.
[0061] For example, the LBP (Local Binary Pattern) image similarity algorithm is used, and the main steps of this algorithm are as follows: extract the LBP information of the image, count the histogram in some areas, then describe the feature vector of the image information, and then judge whether the two images are similar according to the magnitude of the feature vector. No further explanation is given here.
[0062] During the image capture process of the capsule endoscope, the capsule endoscope rotates. In order to avoid the influence of images captured at multiple angles on the similarity judgment and the user's subjectivity, before the similarity comparison, the images are rotated according to the posture of the capsule endoscope so that they have the same shooting angle and posture as the images to be compared. In this way, the similarity judgment result is more accurate.
[0063] As shown in FIG. 10, in a specific example of the present invention, the above steps are executed using independent threads. Specifically, three independent threads, namely a shooting thread, a processing thread, and a transmission thread, are set, and each thread is independently executed without interfering with each other. In this way, the frame rate can be adjusted according to the cavity, and the transmission of redundant images can be effectively reduced. At the same time, when reducing the transmission of redundant images, there is no increase in the workload due to the adjustment of the frame rate.
[0064] Specifically, the shooting thread shoots images according to the set frame rate. When no cavity is detected, it always shoots images at the original shooting frame rate, that is, every interval time t, one image is shot. At the same time, the processing thread samples one image every interval time t. After increasing the frame rate, the shooting thread shoots images according to the adjusted frame rate. In this specific example, the shooting frame rate increases from the original frame rate, that is, one image is shot every interval t1 (t1 < t). At the same time, the processing thread also samples one image every interval time t. The bars on the shooting thread represent images. Here, the relatively high bar represents the image sampled according to the original shooting frame rate.
[0065] The transmission thread only performs a comparison of the similarity between the sampled image and the previously stored image. Here, the first image stored in advance is the first sampled image, and the subsequent previously stored images are changed according to the similarity result. As can be seen from the above, here, regardless of whether a cavity is identified, the processing thread always samples at an interval of time t, and performs ICD (Intestinal Cavity Detection) and ISJ (Image Similarity Judgment) processing on the image sampled through the transmission thread.
[0066] Preferably, for step S1, after determining that a cavity is included, the method increases the shooting frame rate based on the original shooting frame rate, and then calculates the sampling output interval time t of adjacent images according to the original shooting frame rate, and starting from the first original image acquired, samples one original image every distance interval time t, and repeats step S1 after each sampling, that is, based on the currently sampled original image, determines whether it contains a cavity.
[0067] After it is determined that there is a cavity, the shooting frame rate of the shooting thread is increased, but the images obtained by increasing the frame rate are all transmitted without any calculation processing; after it is determined that there is no cavity, the shooting frame rate is not changed, and at the same time, the transmission thread compares the similarity of the sampled images. If it is determined that the current image is a similar image, it will discard this image without transmitting it.
[0068] Correspondingly, a branch in the transmission thread performs a similarity comparison on the sampled original image, and determines whether to output the currently sampled original image according to the comparison result, and another branch performs cavity identification on the original image, and adjusts the shooting frame rate according to the identification result.
[0069] Of course, in other embodiments of the present invention, the sampling output interval time of adjacent images may be calculated according to the increased frame rate, and the sampled images may be compared for similarity and output, or the sampled images may be subjected to cavity identification to adjust the frame rate, and no further description will be given here.
[0070] Furthermore, one embodiment of the present invention provides an electronic device that includes a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor performs steps in the image processing method when it executes the program.
[0071] Furthermore, one embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, the computer program performing the steps of the image processing method when executed by a processor.
[0072] As described above, the image processing method, electronic device, and readable storage medium of the present invention can simply and efficiently check whether the capsule endoscope has reached a preset detection position based on an image acquired by an existing hardware structure, without any additional hardware support, and with low requirements for hardware computing power. At the same time, during the image acquisition process, image data is acquired at an extremely low equivalent frame rate, which greatly saves battery power and improves the use efficiency of the capsule endoscope.
[0073] It should be noted that, although this specification is described according to embodiments, each embodiment does not include only one independent technical solution, but is described only to clarify the specification, and those skilled in the art should consider the entire specification, and the technical solutions in each embodiment can be appropriately combined to form other embodiments that can be understood by those skilled in the art.
[0074] The series of detailed descriptions provided above are merely specific descriptions of possible embodiments of the present invention, and do not limit the protection scope of the present invention; any equivalent embodiments or modifications made without departing from the technical spirit of the present invention shall be included in the protection scope of the present invention.
Claims
1. An image processing method performed by a capsule endoscope, comprising: acquiring an original image of the intestine, determining whether the current original image includes a cavity, and if so, increasing an imaging frame rate based on an original imaging frame rate; if not, maintaining the original imaging frame rate and continuing imaging; If included, increasing the shooting frame rate based on the original shooting frame rate specifically includes: if determining that the current original image contains a cavity, using a total area of the connected regions used to identify the cavity as a cavity index corresponding to the original image; adjusting the imaging frame rate in accordance with the cavity index, such that the larger the cavity index, the higher the imaging frame rate.
2. Determining whether the current original drawing includes a cavity includes: converting the current original image into a grayscale image; converting the greyscale image into a first binarized image; obtaining each connected region of dark pixels based on the first binarized image, and counting the total number of the connected regions of the dark pixels in which the number of the dark pixels is greater than a first threshold value set in advance, the dark pixels being pixel points in the grayscale image whose grayscale values are equal to or less than a grayscale threshold value; 2. The image processing method of claim 1, further comprising: determining whether the current original image includes a cavity based on a total number of the connected regions of the dark pixels obtained by counting.
3. 3. The image processing method of claim 2, wherein converting the grayscale image into the first binary image includes binarizing the grayscale image to form the first binary image based on a maximum grayscale value and a minimum grayscale value of the grayscale image.
4. Specifically, binarizing the grayscale image to form the first binarized image based on the maximum grayscale value and the minimum grayscale value of the grayscale image includes: if the grayscale value of a pixel point in the grayscale image is greater than the grayscale threshold, the value of this pixel point is represented by a first value in the first binarized image, and if the grayscale value of a pixel point in the grayscale image is equal to or less than the grayscale threshold, the value of this pixel point is represented by a second value in the first binarized image, the first value and the second value being different; 4. The method of claim 3, further comprising: the grayscale threshold m1=R×maxv+(1−R)×minv, where R denotes a scale factor that is a constant, maxv denotes the maximum grayscale value in the grayscale image, and minv denotes the minimum grayscale value in the grayscale image.
5. Determining whether the current original image includes a cavity based on the total number of the connected regions of the dark pixels obtained by counting, specifically, if the total number of connected regions of the dark pixels is zero, determining that the current original image does not include a cavity; determining that the current original contains a cavity if the total number of connected regions of the dark pixels is between 0 and a first index threshold; 3. The method of claim 2, further comprising: confirming a misrecognition of the current original image if the total number of connected regions of dark pixels is greater than or equal to the first index threshold.
6. Determining whether the current original drawing includes a cavity includes: converting the current original image into a depth image, each depth value in the depth image being a distance of a detection object corresponding to each pixel point in the original image relative to the capsule endoscope; converting the depth image into a second binarized image; obtaining each connected region of bright pixels based on the second binarized image, and counting the total number of the connected regions of the bright pixels in which the number of the bright pixels is greater than a second threshold value set in advance, the bright pixels being pixel points in the depth image whose depth values are greater than a second threshold value set in advance; 2. The image processing method according to claim 1, further comprising: determining whether the current original image includes a cavity based on the total number of connected regions of the bright pixels obtained by counting.
7. Determining whether the current original drawing contains a cavity comprises: converting the current original image into a depth image, each depth value in the depth image being a distance of a detection object corresponding to each pixel point in the original image relative to the capsule endoscope; converting the depth image into a second binarized image; obtaining each connected region of bright pixels based on the second binarized image, and counting the total number of the connected regions of the bright pixels in which the number of the bright pixels is greater than a second threshold value set in advance, the bright pixels being pixel points in the depth image whose depth values are greater than a second threshold value set in advance; determining whether the current original image includes a cavity based on the total number of connected regions of the bright pixels obtained by counting; Converting the depth image into the second binarized image includes:
3. The image processing method of claim 2, further comprising: if a depth value of a pixel point in the depth image is greater than a predetermined depth threshold, representing the value of the pixel point with a third value in the second binarized image; and if the grayscale value of a pixel point in the grayscale image is equal to or less than a predetermined depth threshold, representing the value of the pixel point with a fourth value in the second binarized image, wherein the third value and the fourth value are different.
8. Determining whether the current original image includes a cavity based on the total number of the connected regions of the bright pixels obtained by counting, specifically, if the total number of connected regions of the bright pixels is zero, determining that the current original image does not contain a cavity; determining that the current original contains a cavity if the total number of connected regions of light pixels is between 0 and a second index threshold; 7. The method of claim 6, further comprising: confirming a misrecognition of the current original image if the total number of connected regions of light pixels is greater than or equal to the second index threshold.
9. If the current original image includes a cavity, after increasing the shooting frame rate based on the original shooting frame rate, the image processing method includes: Calculating a sampling output interval time t of adjacent images according to the original shooting frame rate; Starting from the first original image acquired, sample one original image every distance interval time t; 9. The image processing method according to claim 1, further comprising: after each sampling, determining based on the currently sampled original whether it contains a cavity.
10. After determining whether the current original image contains a cavity, the image processing method includes: Calculating a sampling output interval time t of adjacent images according to the original shooting frame rate; Starting from the first original image acquired, sample one original image every distance interval time t; after each sampling, comparing the currently sampled original image for similarity with a pre-stored image; If so, discarding the currently sampled original; 9. The image processing method according to claim 1, further comprising: if not similar, outputting the currently sampled original image and replacing the pre-stored image with the currently sampled original image.
11. 1. An electronic device that is a capsule endoscope, comprising a memory and a processor, the memory storing a computer program executable on the processor, the processor executing the program to execute steps of an image processing method, the image processing method comprising the steps of: obtaining an original image of the intestine; determining whether a cavity is included in the current original image; and, if so, increasing the imaging frame rate based on the original imaging frame rate; and, if not, maintaining the original imaging frame rate and continuing imaging; If included, increasing the shooting frame rate based on the original shooting frame rate specifically includes: if determining that the current original image contains a cavity, using a total area of the connected regions used to identify the cavity as a cavity index corresponding to the original image; adjusting the imaging frame rate in accordance with the cavity index, such that the imaging frame rate increases as the cavity index increases.
12. A computer-readable storage medium storing a computer program executed by a capsule endoscope, the computer program, when executed by a processor, performing steps in an image processing method, wherein the image processing method includes: obtaining an original image of the intestine; determining whether a cavity is included in the current original image; and, if so, increasing the imaging frame rate based on the original imaging frame rate; and, if not, maintaining the original imaging frame rate and continuing imaging; If included, increasing the shooting frame rate based on the original shooting frame rate specifically includes: if determining that the current original image contains a cavity, using a total area of the connected regions used to identify the cavity as a cavity index corresponding to the original image; adjusting the imaging frame rate according to the cavity index, such that the larger the cavity index, the higher the imaging frame rate.
Citation Information
Patent Citations
Endoscope capsule device
CN103622658A
Lumen image processing device, lumen image processing method, and program for the same
JP2006223377A
Capsule type medical device, medical controlling device, medical image processing device, and program
JP2007195586A
Photographic equipment
JP2009240531A
Endoscopic device and program
JP2010008394A
