Endoscopic image processing method and apparatus, electronic device, and storage medium
Abstract
This application provides an endoscopic image processing method and apparatus, an electronic device, and a storage medium. The method includes: obtaining an endoscopic video stream, the endoscopic video stream including an original endoscopic image; detecting the original endoscopic image in a corresponding video frame through a first thread, and transmitting a detection result of the original endoscopic image to an integration module; forming a control instruction through the integration module according to the detection result; and adjusting, in response to the control instruction and through a second thread, an output result in the second thread, the output result corresponding to a use environment of the endoscopic video stream, the first thread and the second thread being parallel threads.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1. An endoscopic image processing method, performed by an electronic device, the endoscopic image processing method comprising:
obtaining an endoscopic video stream, the endoscopic video stream including an original endoscopic image;
detecting the original endoscopic image in a corresponding video frame through a first thread, and transmitting a detection result of the original endoscopic image to an integration module, comprising:
detecting a foreign body through a detector in the first thread to obtain a foreign body box distributed in a target endoscopic image frame, the target endoscopic image frame being obtained based on the original endoscopic image, and the foreign body box indicating a region where the foreign body exists in the target endoscopic image frame;
filtering the target endoscopic image frame based on the foreign body box, to position a lesion region in the target endoscopic image frame and determine a lesion category; and
transmitting the lesion region in the target endoscopic image frame to the integration module;
forming a control instruction through the integration module according to the detection result; and
adjusting, in response to the control instruction and through a second thread, an output result in the second thread, the output result corresponding to a use environment of the endoscopic video stream, the first thread and the second thread being parallel threads.
2. The method according to claim 1 , wherein the obtaining an endoscopic video stream comprises:
extracting an endoscopic video frame in pathological information of a target object;
improving resolution of the endoscopic video frame;
converting a format of the endoscopic video frame from a current encoding format to a grayscale value encoding format, to obtain a plurality of endoscopic video frames; and
performing encoding compression on the endoscopic video frame to form an endoscopic video stream.
3. The method according to claim 2 , wherein the converting a format of the endoscopic video frame from a current encoding format to a grayscale value encoding format comprises:
performing encoding compression on the endoscopic video frame using an encoding method corresponding to a target format;
writing a serial number corresponding to the video frame and generating a timestamp corresponding to an image packet, to generate a packet corresponding to the format of the endoscopic video frame; and
splicing the image packet to form a plurality of endoscopic video frames.
4. The method according to claim 1 , wherein the method further comprises:
adjusting the original endoscopic image to a target size to generate standard endoscopic image frames; and
filtering the standard endoscopic image frames and deleting a standard endoscopic image frame having interference, to form the target endoscopic image frame comprising different target endoscopic image frames.
5. The method according to claim 1 , wherein the method further comprises:
when a detection time of the detector in the first thread exceeds a detection time threshold, stopping detecting a current target endoscopic image frame, and obtaining a subsequent target endoscopic image frame for detection.
6. The method according to claim 1 , wherein the adjusting, in response to the control instruction and through a second thread, an output result in the second thread comprises:
when a tracker in the second thread is in a continuation state and a tracking box corresponding to the tracker matches a foreign body box corresponding to a detector, outputting, by the tracker in the second thread, a current target endoscopic image frame; or
when a tracker in the second thread is in a re-initiation state and a tracking box corresponding to the tracker does not match a foreign body box corresponding to a detector, outputting, by the tracker in the second thread, a new target endoscopic image frame.
7. The method according to claim 6 , wherein the method further comprises:
determining a corresponding box regression parameter when a foreign body box exists in the target endoscopic image frame; and
activating the tracker in the second thread by using the box regression parameter.
8. The method according to claim 7 , wherein the method further comprises:
when the tracker in the second thread is activated, distributing a target identifier to a foreign body in the current target endoscopic image frame; and
when foreign bodies in target endoscopic image frames when the tracker in the second thread is in an activated state, a continuation state, and a re-initiation state are consistent, initializing the target identifier to implement continuous tracking on the foreign body in the current target endoscopic image frame.
9. The method according to claim 1 , wherein the method further comprises:
transmitting an adjustment instruction in response to the output result in the second thread, the adjustment instruction adjusting a detection state of a medical device in contact with a target object, to obtain new pathological information.
10. An electronic device, comprising:
a memory, configured to store executable instructions; and
a processor, configured to, when executing the executable instructions stored in the memory, perform:
obtaining an endoscopic video stream, the endoscopic video stream including an original endoscopic image;
detecting the original endoscopic image in a corresponding video frame through a first thread, and transmitting a detection result of the original endoscopic image to an integration module comprising:
detecting a foreign body through a detector in the first thread to obtain a foreign body box distributed in a target endoscopic image frame, the target endoscopic image frame being obtained based on the original endoscopic image, and the foreign body box indicating a region where the foreign body exists in the target endoscopic image frame;
filtering the target endoscopic image frame based on the foreign body box, to position a lesion region in the target endoscopic image frame and determine a lesion category; and
transmitting the lesion region in the target endoscopic image frame to the integration module;
forming a control instruction through the integration module according to the detection result; and
adjusting, in response to the control instruction and through a second thread, an output result in the second thread, the output result corresponding to a use environment of the endoscopic video stream, the first thread and the second thread being parallel threads.
11. A non-transitory computer-readable storage medium, storing executable instructions, the executable instructions, when executed by a processor, implementing:
obtaining an endoscopic video stream, the endoscopic video stream including an original endoscopic image;
detecting the original endoscopic image in a corresponding video frame through a first thread, and transmitting a detection result of the original endoscopic image to an integration module comprising:
detecting a foreign body through a detector in the first thread to obtain a foreign body box distributed in a target endoscopic image frame, the target endoscopic image frame being obtained based on the original endoscopic image, and the foreign body box indicating a region where the foreign body exists in the target endoscopic image frame;
filtering the target endoscopic image frame based on the foreign body box, to position a lesion region in the target endoscopic image frame and determine a lesion category; and
transmitting the lesion region in the target endoscopic image frame to the integration module;
forming a control instruction through the integration module according to the detection result; and
adjusting, in response to the control instruction and through a second thread, an output result in the second thread, the output result corresponding to a use environment of the endoscopic video stream, the first thread and the second thread being parallel threads.
12. The computer-readable storage medium according to claim 11 , wherein the obtaining an endoscopic video stream comprises:
extracting an endoscopic video frame in pathological information of a target object;
improving resolution of the endoscopic video frame;
converting a format of the endoscopic video frame from a current encoding format to a grayscale value encoding format, to obtain a plurality of endoscopic video frames; and
performing encoding compression on the endoscopic video frame to form an endoscopic video stream.
13. The computer-readable storage medium according to claim 12 , wherein the converting a format of the endoscopic video frame from a current encoding format to a grayscale value encoding format comprises:
performing encoding compression on the endoscopic video frame using an encoding method corresponding to a target format;
writing a serial number corresponding to the video frame and generating a timestamp corresponding to an image packet, to generate a packet corresponding to the format of the endoscopic video frame; and
splicing the image packet to form a plurality of endoscopic video frames.
14. The computer-readable storage medium according to claim 11 , wherein the executable instructions further causes the processor to implement:
adjusting the original endoscopic image to a target size to generate standard endoscopic image frames; and
filtering the standard endoscopic image frames and deleting a standard endoscopic image frame having interference, to form the target endoscopic image frame comprising different target endoscopic image frames.
15. The computer-readable storage medium according to claim 11 , wherein the executable instructions further causes the processor to implement:
when a detection time of the detector in the first thread exceeds a detection time threshold, stopping detecting a current target endoscopic image frame, and obtaining a subsequent target endoscopic image frame for detection.
16. The computer-readable storage medium according to claim 11 , wherein the adjusting, in response to the control instruction and through a second thread, an output result in the second thread comprises:
when a tracker in the second thread is in a continuation state and a tracking box corresponding to the tracker matches a foreign body box corresponding to a detector, outputting, by the tracker in the second thread, a current target endoscopic image frame; or
when a tracker in the second thread is in a re-initiation state and a tracking box corresponding to the tracker does not match a foreign body box corresponding to a detector, outputting, by the tracker in the second thread, a new target endoscopic image frame.
17. The computer-readable storage medium according to claim 16 , wherein the executable instructions further causes the processor to implement:
determining a corresponding box regression parameter when a foreign body box exists in the target endoscopic image frame; and
activating the tracker in the second thread by using the box regression parameter.
18. The computer-readable storage medium according to claim 17 , wherein the executable instructions further causes the processor to implement:
when the tracker in the second thread is activated, distributing a target identifier to a foreign body in the current target endoscopic image frame; and
when foreign bodies in target endoscopic image frames when the tracker in the second thread is in an activated state, a continuation state, and a re-initiation state are consistent, initializing the target identifier to implement continuous tracking on the foreign body in the current target endoscopic image frame.Join the waitlist — get patent alerts
Track US12315144B2 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.