The application claims priority from Chinese Patent Application No. 202010828250.X, filed Aug. 18, 2020, entitled “Image-Based Position Detection Method, Electronic Device and Readable Storage Medium”, all of which are incorporated herein by reference in their entirety.
The present invention relates to the field of medical equipment imaging, and more particularly to an image-based position detection method, an electronic device and a readable storage medium.
Capsule endoscopy for gastrointestinal examination is increasingly used. A capsule endoscope is taken orally, then passes through mouth, esophagus, stomach, small intestine, large intestine and is finally excreted. Usually, the capsule endoscope travels passively with the peristalsis of digestive tract, and takes images at a certain frame rate during this process, so that a doctor can check the conditions of regions of the digestive tract of a subject.
Since the capsule endoscope is powered by a built-in battery, its working time is limited, e.g., 8-12 h. Meanwhile, the working time is also affected by the frame rate. Generally, the capsule endoscope can take 30000-50000 images. The higher frame rate the capsule endoscope has, the higher detection rate (not easy to miss) can be achieved, but the total working time may be shorter, resulting in a decrease in the completion rate of examination.
The existing capsule endoscopes are generally divided into stomach capsules, small bowel capsules and colon capsules. For the capsule for examination of lower digestive tract, it is very important to save power in the early stage. If the capsule stays in the upper digestive tract, especially in the stomach, for too long, it consumes too much power, which may eventually lead to incomplete examination of the colon, etc.
In the prior art, in order to save power, taking a capsule endoscope for examination of small intestine as an example, the capsule endoscope enters a sleep state after working for 3 min after starting up, and wakes up after a fixed period of sleep time (such as 1 h 45 min), or is awaken manually to continue working. In this way, the fixed sleep time is statistically significant because most capsules are in the small intestine or at least not in the colon at 1 h 45 min after ingestion, so this can save some power. However, due to the great difference between different subjects, this mode cannot accurately control the switching time of working mode, and the working efficiency needs to be improved.
To solve the problems, the present invention provides an image-based position detection method, an electronic device, and a readable storage medium.
It is an object of present invention to provide an image-based position detection method, comprising: driving a capsule endoscope to continuously capture a group of images at an interval of a first preset time t1, wherein each group of images comprises at least one image;
In an embodiment of the present invention, each group of images comprises at least 2 images.
In an embodiment of the present invention, obtaining at least one image from each group of images comprises:
In an embodiment of the present invention, obtaining at least one image from each group of images comprises:
In an embodiment of the present invention, obtaining at least one image from each group of images, and calculating the determination index according to the grayscale values of at least two channels of the image comprises:
In an embodiment of the present invention, determining whether the capsule endoscope reaches the preset detection position according to the value of the determination index comprises:
In an embodiment of the present invention, the method further comprises: configuring a counter;
In an embodiment of the present invention, before determining whether the capsule endoscope reaches the preset detection position according to the value of the determination index, the method further comprises:
In an embodiment of the present invention, in the process of obtaining at least one image from each group of images, the method further comprises:
In an embodiment of the present invention, the method further comprises: configuring a counter;
It is another object of the present invention to provide an electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the program to implement the steps of the image-based position detection method as described above.
It is still another object of the present invention to provide a computer-readable storage medium for storing a computer program, wherein the computer program is executed by the processor to implement the steps of the image-based position detection method as described above.
Compared with the prior art, the present invention has the advantages. According to the image-based position detection method, the electronic equipment and the readable storage medium, whether the capsule endoscope reaches the preset detection position is determined according to the grayscale value of the obtained images, additional hardware assistance is not needed, the requirement on hardware calculation force is low, the battery power is greatly saved, and the work efficiency of the capsule endoscope is improved.
The present invention can be described in detail below with reference to the accompanying drawings and preferred embodiments. However, the embodiments are not intended to limit the present invention, and the structural, method, or functional changes made by those skilled in the art in accordance with the embodiments are included in the scope of the present invention.
A capsule endoscope of the present invention is mainly used for examination of lower digestive tract, for example, for examination of small intestine. Correspondingly, structures of the capsule endoscope are the same as those of the existing capsule endoscope. In a specific embodiment of the present invention, after the capsule endoscope captures an image, the image is transmitted to an external data recorder through a wireless transmission unit; after the data recorder receives the image, an image processing unit processes the image according to the following method steps, and sends a corresponding command to the capsule endoscope through a control unit based on a processing result, so as to identify the position of the capsule endoscope in the digestive tract and adjust the working state of the capsule endoscope. The capsule endoscope can automatically adjust its frame rate, exposure parameters, etc., according to environmental changes, user requirements and other factors in the process of capturing images, and this part belongs to the prior art and is not further described here.
Referring to
Preferably, before the step S1, images may be captured at a fixed frame rate f0 within a certain time T0, so as to observe the environment before the preset detection position. For example, the preset detection position is the small intestine, and a step before step S1 is used to observe the esophagus, etc. After that, the process proceeds to step S1. In a specific embodiment of the present invention, the value of f0 is: 2-16 fps, preferably 4-8 fps, and the value of T0 is 3-10 min.
In step S1, the capsule endoscope is in a sleep state for most of the time, and a sleep time can be adjusted according to the value of the first preset time t1, so that the current position of the capsule endoscope can be accurately determined in a state of efficient operation of the capsule endoscope.
In a specific embodiment of the present invention, the value of t1 may be set to 100-900 s. That is, in step S1, the capsule endoscope is awakened every the time t1, while a set number of images are captured.
Preferably, in step S1, when the capsule endoscope is awakened, a group of images are continuously captured at a fixed frame rate f1, and the value of f1 can be specifically set as required. In a specific embodiment of the present invention, f1 is set to a relatively high value, for example: f1 is set to 2-6 fps.
Preferably, the number of images included in each group of images can be set according to actual needs, and the number of images in different groups of images can be the same or different. In a specific embodiment of the present invention, the number of images continuously captured in each group is set to be the same.
Preferably, each group of images comprises at least 2 images. In a specific embodiment of the present invention, the number of images in each group is set to 2-5. Once the images of each group are captured, they are immediately transmitted to the external data recorder, and analyzed therein for determining the position of the capsule endoscope.
Due to an AEC (Auto-Exposure Control) of the capsule endoscope takes some time to stabilize (depending on a specific AEC method), usually the first image may have poor exposure (too dark or overexposed). Therefore, each group of images comprises at least 2 images, namely at least 2 images are continuously captured, so that the quality of the images can be ensured, and the calculation accuracy is improved.
In step S2, in a first preferred embodiment of the present invention, one image at a last capture position is obtained from each group of images. Accordingly, the last image in each group of images is obtained for calculation, so that the exposure value of the image is more stable, and the calculation accuracy can be improved.
In step S2, in a second preferred embodiment of the present invention, for each group of images, the images are obtained sequentially forward from the last capture position in each group of images, where the number of the obtained images in each group of images is ensured to be the same, and the number of the obtained images is at least 2.
Further, in step S2, each image comprises three channels of grayscale values, namely, R, G, and B channels of grayscale values. In a specific embodiment of the present invention, the grayscale values of at least two channels are selected from the three channels for calculating the determination index.
In a specific embodiment of the present invention, for each image used for calculation, 2 channels of grayscale values are selected, which are the grayscale values of the G channel and the B channel, respectively.
Specifically, for each group of images, if the number of the obtained images is 1, grayscale value statistics of the G channel and the B channel of the current image are used as the G channel value Gmean and the B channel value Bmean required for calculating the determination index. The grayscale value statistic is a mean value of the grayscale value of a corresponding channel in a single image.
If the number of the obtained images is at least 2, the mean value of the grayscale value statistics of the G channel of the images obtained from each group of images is used as the G channel value Gmean required for calculating the determination index, and the mean value of the grayscale value statistics of the B channel of the images obtained from each group of images are used as the B channel value Bmean required for calculating the determination index.
The determination index corresponding to each group of images is represented by Y, and Y=Gmean−k×Bmean−d, where k and d are constants. In a specific embodiment of the present invention, the value k takes a value near 1 and the value d takes a value near 20
Referring to
Referring to
Specifically, the corresponding determination index is obtained immediately after each group of images is generated, and if the value of the counter N is greater than or equal to Nmin, it is determined that the capsule endoscope reaches the preset detection position;
The value of the counter is adjusted by a plurality of determination indexes obtained by defining a time sequence, and whether the capsule endoscope reaches a preset detection position is determined by the value of the counter. Thus, taking the small intestine detected by the capsule endoscope as an example, the influence of environmental factors, such as bile reflux phenomenon, on the determination result can be avoided, and the calculation accuracy is improved.
The preset first index threshold is greater than the preset second index threshold, and the value of the preset first index threshold can be set as required. In a specific embodiment of the present invention, the value of the preset second index threshold is set to 0, and the value of the preset first index threshold belongs to the interval (5, 20), for example, the preset first index threshold is set to 10, and the value of Nmin is set to 2.
Preferably, as for step S3, the present invention provides a third preferred embodiment to implement step S3. In the third preferred embodiment, in the process of determining whether the capsule endoscope reaches the preset detection position, exposure parameters when an image is captured are introduced, so that auxiliary determination parameters for determining whether the capsule endoscope reaches the preset detection position are added, which improves the detection accuracy.
Referring to
Further, referring to
In the embodiments of the present invention, the exposure parameters are automatically adjusted along with capture environments, so that the brightness of the obtained images is moderate. In a specific embodiment of the present invention, the “time” is generally a value in the range of 0.1-0.8 ms, the “gain” is generally a value in the range of 1-8, the tg can be specifically set as required, and the value range of tg in a specific embodiment of the present invention belongs to the interval (0.1 ms, 3 ms).
In the implementation process of the present invention, the exposure parameters are used as auxiliary parameters for determining whether the capsule endoscope reaches the preset detection position, so that the accuracy can be further improved.
It should be noted that the first preferred embodiment, the second preferred embodiment and the third preferred embodiment for implementing step S3 can be used separately to determine whether the capsule endoscope reaches the preset detection position. Alternatively, the first preferred embodiment and the second preferred embodiment can be used synchronously or sequentially to determine whether the capsule endoscope reaches the preset detection position. Alternatively, the first preferred embodiment and the third preferred embodiment can be used synchronously or sequentially to determine whether the capsule endoscope reaches the preset detection position.
Preferably, before step S3, the method further comprises: determining whether an operation time of the capsule endoscope is greater than a preset time threshold, and if the operation time is greater than the preset time threshold, determining whether the capsule endoscope reaches the preset detection position according to the value of the determination index, and if the operation time is not greater than the preset time threshold, determining whether the capsule endoscope reaches the preset detection position according to the value of the determination index after determining that the operation time of the capsule endoscope is greater than the preset time threshold.
It can be understood that this step can be performed before step S3. However, in order to save the battery power to the greatest extent, this step may be performed before step S1, or step S1 may be performed when the operation time of the capsule endoscope approaches the preset time threshold, which will not be further described herein.
The preset time threshold is also a preset time constant, and its value can be specifically set as required. In the specific embodiments of the present invention, taking the examination of small intestine as an example, the value range of the preset time threshold belongs to the interval (10 min, 30 min).
Further, after determining that the capsule endoscope reaches the preset detection position, adjusting the working mode of the capsule endoscope accordingly. In this embodiment, after it is determined that the capsule endoscope reaches the small intestine, the working mode of the capsule endoscope is adjusted to be a small intestine detection mode, and in this mode, images are normally captured according to preset conditions for real-time detection, and the specific implementation process is not described here.
Further, it is another object of the present invention to provide an electronic device, comprising a memory and a processor, where the memory stores a computer program that can run on the processor, and the processor executes the program to implement the steps of the image-based position detection method as described above.
Further, it is still another object of the present invention to provide a computer-readable storage medium for storing a computer program, where the computer program is executed by the processor to implement the steps of the image-based position detection method as described above.
To sum up, the image-based position detection method, the electronic device and the readable storage medium of the present invention can simply and efficiently determine whether the capsule endoscope reaches the preset detection position based on the images obtained by the existing hardware structure, without additional hardware assistance, and have low hardware computing power requirement. Meanwhile, in the process of capturing images, an extremely low equivalent frame rate is used, so that the battery power is greatly saved, and the use efficiency of the capsule endoscope is improved.
It should be understood that, although the description is described in terms of embodiments, not every embodiment merely comprises an independent technical solution. Those skilled in the art should have the description as a whole, and the technical solutions in each embodiment may also be combined as appropriate to form other embodiments that can be understood by those skilled in the art.
The series of detailed descriptions set forth above are only specific descriptions of feasible embodiments of the present invention and are not intended to limit the scope of protection of the present invention. On the contrary, many modifications and variations are possible within the scope of the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
202010828250.X | Aug 2020 | CN | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2021/112776 | 8/16/2021 | WO |