Video processing method and device, electronic equipment and medium
By acquiring and updating inter-frame edge information in endoscopic videos, and using spatiotemporal clues to adjust edge attributes, the problem of inconsistent microstructure edge detection in the existing technology is solved, and stable and accurate edge features in endoscopic videos are achieved. Enhancements that improve the robustness of video processing and the efficiency of doctor examinations.
Patent Information
- Application Number
- CN202310318499.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-28
- Publication Date
- 2024-10-01
AI Technical Summary
Existing endoscopic video processing technology is difficult to stably and accurately detect and enhance microstructural edges, such as capillaries and lesion edges, in videos, and requires high professional technical knowledge and experience of doctors, and single-frame image enhancement methods The lack of spatial and temporal cues leads to inconsistent edge detection.
By obtaining the edges of video frames and neighborhood frames, edge detection, registration and updating are performed, and spatiotemporal clues are used to adjust edge attributes, improving the accuracy and reliability of edge detection and enhancement, and reducing the impact of low-quality images.
It achieves stable and accurate enhancement of edge features in endoscopic videos, provides spatiotemporally consistent edge information, improves the robustness of video processing, and assists doctors in conducting more effective medical examinations.
Smart Images

Figure CN118735976A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of image processing technology, and more specifically, to a video processing method, apparatus, electronic device, computer-readable storage medium, and computer program product. Background Art
[0002] Endoscopy is an optical instrument that is inserted from the outside of the body through the natural cavity of the human body to examine diseases in the body. When using it, the doctor guides the endoscope into the organ to be examined, operates the endoscope to move, and can directly peek into the relevant parts and record images and videos.
[0003] Some endoscope systems can enhance the contrast between blood vessels and their surroundings, and can also magnify dozens to hundreds of times, helping doctors to observe blood vessel structures and lesions more clearly. However, directly viewing blood vessel structures and lesions through an endoscope system requires doctors to have strong and rich experience. Therefore, it is necessary to provide an improved solution to detect and enhance blood vessels or lesions in endoscopic videos, and to provide local prompts for lesions, so as to assist doctors in completing the examination. Summary of the invention
[0004] In view of this, an embodiment of the present disclosure proposes a technical solution for video processing.
[0005] According to a first aspect of the present disclosure, a video processing method is provided. The method includes obtaining a first edge of a first frame of a video and a second edge of at least one neighboring frame of the first frame. The method also includes determining a spatial offset of a pixel of the first edge to a corresponding pixel of a second edge based on the registration between the first frame and the at least one neighboring frame. The method also includes updating a first edge attribute of a pixel of the first edge based at least on a second edge attribute and the spatial offset of a corresponding pixel of the second edge.
[0006] According to a second aspect of the present disclosure, a video processing device is provided. The device includes an edge acquisition unit, a spatial offset determination unit, and an update unit. The edge acquisition unit is configured to acquire a first edge of a first frame of a video and a second edge of at least one neighboring frame of the first frame. The spatial offset determination unit is configured to determine the spatial offset of a pixel of the first edge to a corresponding pixel of the second edge based on the alignment between the first frame and the at least one neighboring frame. The update unit is configured to update a first edge attribute of a pixel of the first edge based at least on the second edge attribute of the corresponding pixel and the spatial offset.
[0007] According to a third aspect of the present disclosure, an electronic device is provided, comprising: at least one processing unit; and at least one memory, wherein the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit, wherein the instructions, when executed by the at least one processing unit, cause the electronic device to execute according to the first aspect of the present disclosure.
[0008] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, comprising machine-executable instructions, which, when executed by a device, cause the device to perform the method according to the first aspect of the present disclosure.
[0009] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising machine executable instructions, which, when executed by a device, cause the device to perform the method according to the first aspect of the present disclosure.
[0010] This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the present disclosure, nor is it intended to limit the scope of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other objects, features and advantages of the present disclosure will become more apparent through a more detailed description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components throughout the exemplary embodiments of the present disclosure.
[0012] Figure 1A A schematic diagram illustrating an example environment in which various embodiments of the present disclosure can be implemented;
[0013] Figure 1B Screenshots showing exemplary videos to which embodiments of the present disclosure may be applied;
[0014] Figure 2 A schematic flow chart of a video processing method according to an embodiment of the present disclosure is shown;
[0015] Figure 3 A schematic diagram of a video processing system according to an embodiment of the present disclosure is shown;
[0016] Figure 4A A schematic diagram showing edge detection applied to a video according to an embodiment of the present disclosure is shown;
[0017] Figure 4B A schematic diagram showing application of image registration to a video according to an embodiment of the present disclosure is shown;
[0018] Figure 5A schematic flow chart of a process for edge enhancement according to an embodiment of the present disclosure is shown;
[0019] Figure 6 A schematic flow chart of a process for contour tracking according to an embodiment of the present disclosure is shown;
[0020] Figure 7 A schematic flow chart of a process for generating contour segments according to an embodiment of the present disclosure is shown;
[0021] Figure 8 A schematic flow chart of a process for contour matching according to an embodiment of the present disclosure is shown;
[0022] Fig. 9 A schematic block diagram showing a video processing device according to an embodiment of the present disclosure; and
[0023] Fig.10 A schematic block diagram of an example device that may be used to implement embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0024] The preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0025] As used herein, the term "including" and its variations mean open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "based at least in part on". The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0026] As mentioned above, some endoscope systems can enhance the contrast between blood vessels and the surrounding area, which helps to observe blood vessels, and can also magnify dozens to hundreds of times, so that vascular structures and lesions can be observed more clearly. For example, a gastroscope or colonoscope with narrowband imaging (NBI) + magnifying endoscopy, where NBI can highlight capillaries and ME can magnify capillaries. Compared with ordinary white light endoscopes, NBI+ME is a lesion examination method that has been used in recent years. It can observe the lesions of the mucosal surface from a microscopic structure. However, directly viewing the capillary edge lesions with NBI+ME requires doctors to have strong and rich experience. It would be helpful if the capillaries were enhanced at the edges and the lesions were locally indicated.
[0027] There are some methods that use deep learning technology to extract microvascular and microstructure features from NBI+ME images and present the characterized images to endoscopists. However, these methods focus on extracting vascular features from single-frame images and are not suitable for video-format image data obtained by endoscopic examinations. For example, due to image quality, such as blur and lighting, the edge enhancement of a single-frame image does not match the real scene. Moreover, these methods only perform image enhancement on each frame, lacking spatiotemporal cues, and the same edge segment is not retained between video frames, making it difficult to perform spatiotemporal consistency analysis sequentially.
[0028] In view of this, an image enhancement method that is more compatible with the real scene of endoscopy is needed to effectively enhance the edge features of the video to assist doctors in reading the video data obtained through the inspection. According to an embodiment of the present disclosure, a video processing method is provided. In this method, the edge of a given frame of the video and the edge of the neighborhood frame of the given frame are obtained by edge detection. Through edge detection, each pixel in the edge has its own edge attribute. In some embodiments, the edge attribute can be, for example, the image color change amplitude expressed in a probability form or the lesion change degree expressed in a conceptual form. Then, the given frame and the neighborhood frame are aligned to determine the corresponding pixels of each pixel in the edge of the given frame in the edge of the neighborhood frame, that is, to establish a mapping between the pixels between the two frames, thereby obtaining the spatial offset of the pixels of the given frame to the corresponding pixels of its neighborhood frame. The spatial offset can be represented by, for example, the difference between the coordinates of the pixels. Next, the edge attributes of the pixels in the edge of the given frame are adjusted according to the edge attributes of the neighborhood frame and the determined spatial offset. In this way, the spatiotemporal clues of the video can be used to improve the accuracy and reliability of edge detection and enhancement, reduce the adverse effects caused by low-quality images in the video, and thus improve the robustness of video processing. The implementation details of the embodiments of the present disclosure are described in detail below with reference to FIGS. 1 to 8 .
[0029] Figure 1A A schematic diagram of an example environment 100 in which multiple embodiments of the present disclosure can be implemented is shown. As shown, the environment 100 relates to an endoscope system, which includes an optional control device 101 that can be operated by an operator, and the operator can operate the control device 101 to control the endoscope lens 102 to move in the human body and collect images and videos. The collected images and videos can be transmitted and stored at a computing device 105. A display 103 can be coupled to the computing device 105 and display the images and videos collected via the lens 102 in real time. In some embodiments, the endoscope system can be a narrow band imaging and magnifying endoscope (NBI+ME), and the resulting video can be an NBI+ME video. FIG. 1 exemplarily shows a gastroscope system, but it should be understood that embodiments of the present disclosure can also be applied to other endoscope systems, including but not limited to ENT endoscopes, oral endoscopes, dental endoscopes, neuroscopes, urethral cystoscopes, resectoscopes, laparoscopes, arthroscopes, sinusoscopes, laryngoscopes, colonoscopes, etc.
[0030] The computing device 105 may be a general computing device or a device dedicated to endoscopy, and is configured to be applicable to image processing and video processing, especially medical image processing. The computing device 105 may be a terminal or a server device. When the computing device 105 is a server, it may be an independent server, or a server network or server cluster composed of servers, including but not limited to a computer, a network host, a single network server, a plurality of network server sets or a plurality of servers to construct a cloud server. When the computing device 105 may include but not limited to a desktop terminal or a mobile terminal, for example, a desktop, a mobile phone, a tablet computer, a laptop computer, a medical auxiliary instrument, etc.
[0031] As mentioned above, existing solutions cannot stably and accurately inspect and present the edges of microstructures (such as capillaries and lesion edges) in the video, and require doctors to have high professional technical knowledge and experience. According to an embodiment of the present disclosure, the computing device 105 can perform edge enhancement on the endoscopic video and provide local prompts for the lesion, assisting doctors in performing more effective medical examinations.
[0032] References Figure 1A An exemplary environment in which embodiments of the present disclosure can be implemented is described. It should be understood that Figure 1A This is only illustrative, and the environment may also include more modules or systems, or some modules or systems may be omitted, or the modules or systems shown may be recombined. Figure 1A The present disclosure is not limited to the different environments shown.
[0033] Figure 1B Screenshots of exemplary videos to which embodiments of the present disclosure may be applied are shown. Figure 1BThe video screenshot is a gastroenteroscopic image obtained by the NBI+ME system. As shown in the figure, the image includes abundant capillary structures and possible lesion areas, and there may be low-quality video frames, which makes it difficult for doctors to accurately and quickly locate the area of interest. The embodiments of the present disclosure are suitable for edge detection and enhancement of such videos, and provide corresponding local prompts (for example, tracking the edges of interest) to reduce the difficulty of reading the video.
[0034] It should be noted that, although the video processing method and system according to the embodiments of the present disclosure are described with reference to NBI+ME video, the embodiments of the present disclosure are also applicable to similar processing of any other types of videos or images, and the present disclosure does not limit this.
[0035] Figure 2 1 shows a schematic flow chart of a video processing method 200 according to an embodiment of the present disclosure. The method 200 may be implemented, for example, by the computing device 105 shown in FIG. 1 . It should be understood that the method 200 may also include additional actions not shown and / or may omit the actions shown, and the scope of the present disclosure is not limited in this respect. Figure 1A The method 200 is described in detail.
[0036] Method 200 involves video processing implemented by computing device 105. The video may be an endoscopic video obtained through an endoscopic acquisition operation, such as narrow band imaging (NBI) and magnified endoscopy (ME) video, or other types of video. In some embodiments, computing device 105 may receive the video in real time or near real time during the endoscopic inspection process and process the video. Alternatively, computing device 105 may receive and store the video without processing it yet, but instead process it after receiving the complete video.
[0037] In block 210, a first edge of a first frame of the video and a second edge of at least one neighboring frame of the first frame are obtained. Here, a neighboring frame may be defined as a number of frames configured to be in front of or behind the first frame. For example, 1, 2, 5, 10, 20, or any other number of frames before and after the first frame (i.e., the current frame) may be defined as a neighboring frame, and the number of the frames before and after may be the same or different, which is not limited in the present disclosure. In some implementations, the neighboring frame may include frames before, after, or in both the front and back directions of the first frame.
[0038] The computing device 105 performs edge detection on the video to generate the edges of each frame of the video. Edge detection can be for multiple different purposes and use different algorithms. For example, the edge detection algorithm may include an algorithm for microstructure edges (such as capillaries) or lesion edges. Therefore, the first edge and the second edge obtained may be microstructure edges or lesion edges. In some implementations, edge detection can be based on the prediction of a deep network. For example, labeled samples can be collected to train the deep network, and then the trained deep network is used to generate predictions of the edge attributes of each frame. Alternatively, feature extraction and classifiers (such as support vector machines) can also be used for training and prediction, or image features can be extracted, and the class probability is obtained in a weighted manner, and compared with a threshold value.
[0039] Through edge detection, edge attributes can be generated for each pixel in the first frame of the video and the neighborhood frame of the first frame, and the edge attributes can indicate the probability that the corresponding pixel belongs to the edge. For example, for microstructure edge detection, the edge attribute can have a range of 0 to 255, which represents a weak microstructure edge to a strong microstructure edge from small to large. For lesion detection, the edge attribute can also have a similar range of 0 to 255. The present disclosure does not limit the scope of the edge attribute. Then, the computing device 105 can determine the pixels in the first edge and the second edge respectively by the pixels whose edge attributes in the first frame and the neighborhood frame are greater than a threshold value (e.g., 0 or other values), thereby determining the first edge and the second edge. It should be noted that the edge attribute or edge probability obtained here is calculated by the computing device 105 based on a single frame, and can be adjusted or optimized using the spatiotemporal information of the video.
[0040] In block 220, based on the registration of the first frame and at least one neighboring frame, a spatial offset of a pixel of the first edge to a corresponding pixel of the second edge is determined. Here, the computing device 105 uses image registration to obtain a mapping relationship between edge points between frames to obtain a spatial offset of the edge points. The spatial offset may represent a difference in coordinates of each pixel between two frames, such as a two-dimensional vector.
[0041] In some embodiments, the computing device 105 may only perform registration for adjacent frames (e.g., subsequent frames immediately adjacent to the first frame) to improve computational efficiency to ensure real-time performance. For non-adjacent frames, the spatial offsets of adjacent frames may be accumulated. In some embodiments, only edges may be matched to further improve computational efficiency. Since edge texture features are obvious, the matching degree is high. Thus, each pixel in the first edge may be mapped to a pixel in the second edge of the neighborhood frame.
[0042] The method for inter-frame registration may include sparse optical flow fields, such as the KLT method, which uses local gradient changes to calculate the mapping points of pixels after focusing on edge points. Alternatively, the registration method may also include a deep learning method, such as FlowNet, etc., which automatically obtains the spatial offset of pixels using a deep learning network.
[0043] In block 230, the first edge attribute of the pixel of the first edge is updated based on at least the second edge attribute and the spatial offset of the corresponding pixel of the second edge. Considering that the edge detection of a single frame is easily affected by the image quality, the deviation of the edge attribute obtained from the real attribute under the conditions of exposure, low light, pollution and blur, the computing device 105 uses the neighborhood frame of the first frame to enhance the edge attribute of the first edge of the first frame.
[0044] In some embodiments, the computing device 105 can search for several frames that meet preset conditions from the preceding and subsequent neighborhood frames of the first frame, such as high-quality frames with a satisfactory degree of offset, and use these frames to enhance the edge of the first frame. Specifically, for a given pixel with a first edge attribute in the first edge of the first frame, the computing device 105 can add the second edge attribute of the corresponding pixel of the pixel in the neighborhood frame to the first edge attribute to adjust the edge attribute of the given pixel. For example, the edge attribute of the first edge can be adjusted using a weighted summation method. The weight of the edge attribute for the neighborhood frame can depend on the spatial offset between pixels. The weight can also depend on the time between the neighborhood frame and the given frame.
[0045] In this way, spatiotemporal consistency information related to the edges of the video is introduced. The edge attributes of the edge pixels of the first frame contain the edge attributes of its neighboring frames, and the edge information of the neighboring frames is obtained from high-quality frames. Therefore, it is possible to reduce the adverse effects of low-quality images in the video and improve the accuracy and reliability of edge detection and enhancement.
[0046] Figure 3 FIG. 3 is a schematic diagram of a video processing system 300 according to an embodiment of the present disclosure. The video processing system 300 may be implemented in the computing device 105 in the form of software or hardware, and is suitable for implementing reference Figure 2 The method 200 described herein. It should be understood that Figure 3 The video processing system 300 shown is merely exemplary and may include more or fewer modules or units, and Figure 3 Some of the modules shown may be divided into multiple modules, and two or more modules may be implemented in the same module.
[0047] The video processing system 300 may receive endoscopic video frames 301, 302, 303, etc. as input in real time, wherein frame 301 is the previous frame of frame 302 in time order, frame 302 is the previous frame of frame 303, and so on. Alternatively, the video processing system 300 may also read a video stored in a storage device of the computing device 105.
[0048] The video processing system 300 includes an edge detection module 310, an inter-frame registration module 320, and a spatiotemporal edge update and vectorization module 330. The edge detection module 310 is used to extract edges in a single frame. By applying an edge detection algorithm, the edge detection module 310 can generate edge attributes for each pixel of the frame, such as the probability indicating the possibility that the pixel belongs to an edge. It should be understood that this probability is relative rather than absolute. In order to improve the real-time performance of video processing, the edge detection module 310 can use an edge detection algorithm that requires less computing resources. In some embodiments, the edge detection module 310 can apply a variety of edge detection algorithms to generate multiple types of edges, such as microstructure edges, lesion edges, etc. Thus, the edge detection module 310 generates edge attributes for frames 301, 302, 303, etc.
[0049] Figure 4A FIG. 3 is a schematic diagram showing an edge detection method for applying edge detection to a video according to an embodiment of the present disclosure. Figure 4A The given frame of the video shown on the left is subjected to edge detection to obtain edge attributes for each pixel, and then the edge attributes are generated as follows: Figure 4A The edge detection result is shown on the right.
[0050] The inter-frame registration module 320 is used to obtain the inter-frame offset for pixels by image registration in the frame sequence of the video, and establish a mapping relationship between the edges of the frames. Considering that the edge problem has obvious characteristics and a high degree of matching, matching can be performed only on the edges of the frames. In other words, the pixels in the edge of a given frame are mapped to the corresponding pixels in the edge of the neighboring frame. In some embodiments, in order to ensure real-time performance, the inter-frame registration module 320 can only perform registration for two adjacent frames. For example, the inter-frame registration module 320 can perform registration between frame 301 and frame 302, map the pixels of the edge of frame 301 to a certain pixel of the edge of frame 302, perform registration between frame 302 and frame 302, map the pixels of the edge of frame 302 to a certain pixel of the edge of frame 303, and so on.
[0051] The edge mapping relationship can be obtained by using inter-frame registration. The edge mapping relationship can be expressed as a spatial offset between two pixels, such as the difference between coordinates. Based on the superposition of spatial offsets between pixels of adjacent frames (e.g., vector addition), the spatial offset of the edge pixels of a given frame in any neighboring frame can be obtained.
[0052] Figure 4B FIG. 3 shows a screenshot of applying image registration to a video according to an embodiment of the present disclosure. The inter-frame registration module 320 sequentially registers Figure 4B A series of adjacent frames on the left are registered to obtain the corresponding pixel of a given pixel in the next frame and determine the spatial offset of the two pixels. Figure 4B As shown, using the resulting spatial offset, a given pixel can be presented as moving between frames (as shown by the arrow).
[0053] The spatiotemporal edge updating and vectorization module 330 is used to adjust the edge attributes of the frame using the information of the neighboring frames (e.g., the spatial offset of pixels over time, edge attributes, etc.) according to the spatiotemporal consistency information of the video to enhance the edges in the video. Additionally, the spatiotemporal edge updating and vectorization module 330 can also be used to establish and track the contour segments of the object of interest from the edges.
[0054] Figure 5 FIG. 5 is a schematic flow chart of a process 500 for edge enhancement according to an embodiment of the present disclosure. The process 500 may be as follows: Figure 2 The exemplary implementation of block 230 shown in FIG. 1 and may be implemented by Figure 3 The spatiotemporal edge updating and vectorization module 330 is shown to implement this.
[0055] Process 500 is used to enhance the edge of a given frame (i.e., "first frame") based on a neighborhood frame. The neighborhood frame may be at least one frame near the given frame whose edge attributes are to be updated. The range of the neighborhood frame may be configured or indicate a number of preceding frames and a number of subsequent frames of the first frame. In some implementations, the neighborhood frame may include a frame before the first frame, or include a frame after the first frame, or may include both. The present disclosure does not limit the range of the neighborhood frame. In general, process 500 is used to search for high-quality frames with an offset as matching frames from a range near the first frame, and use these matching frames to update the edge attributes of the first frame to achieve edge enhancement.
[0056] In block 501, a neighboring frame of the first frame is obtained. In some embodiments, the neighborhood of the first frame may be searched in a certain order. For example, based on the time of the frame, the search may be started from the earliest neighboring frame until the latest neighboring frame. Alternatively, the search may be performed based on the time distance between the neighboring frame and the first frame, starting with the neighboring frame closest to the first frame, and gradually searching for neighboring frames farther away to obtain a neighboring frame.
[0057] In block 502, it is determined whether the quality of the acquired neighboring frame exceeds a threshold. The quality can be obtained by deep learning, or by feature extraction and classifier. If the quality exceeds the threshold, the process 500 proceeds to block 503, otherwise the neighboring frame can be considered to be a low-quality frame, and the use of the frame to enhance the first frame is abandoned, and the process 500 proceeds to block 505.
[0058] In box 504, it is determined whether the average spatial offset between the edge of the neighborhood frame and the edge of the first frame is within a preset range. The average spatial offset refers to the average value of the spatial offset between the pixels in the edge of the first frame and the corresponding pixels in the neighborhood frame. For example, the amplitude of the spatial offset of each pixel can be calculated, and the average value of the amplitude of the spatial offset can be calculated. The preset range can include a lower threshold and an upper threshold. If the average spatial offset is greater than the lower threshold and less than the lower threshold, the process 500 proceeds to box 504. Otherwise, it can be considered that the frame is not suitable for edge enhancement, and the frame is abandoned. The process 500 can proceed to box 505.
[0059] In block 504, a neighborhood frame is selected. The selected neighborhood frame will be used for edge enhancement of the first frame. The frames of the selected neighborhood frame can be recorded, and after all the neighborhood frames have been processed, the edge attributes of the edges of the first frame are updated according to all the selected neighborhood frames.
[0060] In block 505, it is determined whether all neighboring frames have been traversed. In some embodiments, a threshold corresponding to the total number of frames in the neighborhood range can be set. If the number of processed neighboring frames reaches the threshold, it is considered that all frames in the neighborhood range of all first frames have been processed. If it is determined in block 505 that there are no unprocessed neighboring frames, process 500 proceeds to block 506, and the edge attribute of the first edge of the first frame is updated using the selected matching frame. If it is determined that there are unprocessed neighboring frames, process 500 returns to block 501.
[0061] In response to all the neighboring frames being processed and all the selected neighboring frames being determined, edge attributes of edge pixels of the first frame are updated at block 506. For each pixel in the first edge of the first frame, its corresponding pixel and corresponding spatial offset are determined from the selected neighboring frames, and the edge attribute of the updated pixel is determined based on the following equation:
[0062]
[0063] Where Edge()' represents the updated edge attribute of the pixel, Edge() represents the edge attribute obtained by edge detection, and P i represents the pixels in the edge of the first frame, P j represents the corresponding pixel in the edge of the neighborhood frame, D jRepresents the distance of spatial offset, δ and σ are empirical parameters.
[0064] Figure 6 FIG. 6 is a schematic flow chart of a process 600 for contour tracking according to an embodiment of the present disclosure. The process 600 may be as follows: Figure 2 Additional actions of the method 200 shown and may be performed by Figure 3 The spatiotemporal edge updating and vectorization module 330 is shown to implement this.
[0065] The mapping relationship between pixels obtained by edge matching and the updated edge attributes are discrete and irregular features. However, doctors are often interested in lesion contour fragments, which connect and track pixels with the same attributes, which helps unified analysis.
[0066] In box 610, based on the updated edge attributes, the contour segments of the object of interest in the first frame are determined. The contour segments can be, for example, a combination of detected edge segments, reflecting a structure or lesion with clinical significance. The pixel points of the edge can be vectorized into contour segments according to the edge attributes for subsequent tracking. The contour segments within the frame can be determined for all frames in the video, thereby tracking within the entire video. Alternatively, the contour segments can also be determined for a portion of the frames in the neighborhood range of the first frame, thereby tracking within a portion of the video. For each frame, one or more contour segments can be determined. In some implementations, there can be multiple contour segments in a single frame, and the contour segment to be tracked is selected for tracking based on user input.
[0067] In block 620, based on the registration between the first frame and the subsequent frame of the first frame, the overall spatial offset of the contour segment to the subsequent frame is determined. Depending on the implementation, the subsequent frame may be a neighboring frame immediately adjacent to the first frame. In this case, the spatial offset of the pixels in the contour segment to the corresponding pixels may be obtained by registering the adjacent frames, and the overall spatial offset may be determined by taking the average value of the spatial offsets of all pixels of the contour segment. Alternatively, the subsequent frame may also be a subsequent neighboring frame that is spaced a distance from the first frame. The spatial offset of the pixels of the contour segment of the first frame to the corresponding pixels of the subsequent frame may be obtained by accumulating the spatial offsets obtained by registering the adjacent frames, thereby determining the overall spatial offset.
[0068] At block 630, based on the global spatial offset, another contour segment matching the contour segment in the first frame is searched in the subsequent frame. In some embodiments, the matched another contour segment is the contour segment in the subsequent frame that has the smallest distance to the contour segment in the first frame.
[0069] For the frames in the video, process 600 can be performed in chronological order to track the object of interest. In some embodiments, the contour segment of the first frame, another contour segment in the subsequent frame, and so on can be highlighted when playing the video. This achieves visual assistance to help doctors track the object of interest in the video.
[0070] Figure 7 FIG. 7 is a schematic diagram of a process 700 for generating a contour segment according to an embodiment of the present disclosure. The process 700 may be Figure 6 An exemplary implementation of the actions shown in block 610 of .
[0071] In block 710, superpixel extraction is performed for the first frame. At the first frame, superpixel extraction is performed with the updated edge attributes as a guide to obtain a superpixel contour. The method of superpixel extraction includes but is not limited to simple linear iterative clustering (SLIC) and the like. Here, the original gradient calculation of superpixel extraction is replaced with the updated edge attributes to ensure that the superpixel contour is close to the edge of high probability. Then, the contour fragment of the object of interest can be generated based on the superpixel contour.
[0072] Specifically, in block 720, segments are obtained by edge vectorization. In some embodiments, the superpixel contour may be segmented into a set of segments based on intersections in the extracted superpixel contour. Each segment may include a sequence of pixels.
[0073] In block 730, the contour segment of the object of interest is obtained by merging the segments. For the obtained set of segments, it is analyzed which adjacent segments are similar, and similar adjacent segments are combined to form the contour segment of the object of interest. Specifically, for two adjacent segments, the similarity between the two segments can be calculated, and if the similarity exceeds a threshold, the two segments can be merged to generate the contour segment.
[0074] In some embodiments, clues for determining the similarity of adjacent fragments may include intra-frame clues and inter-frame clues. Intra-frame clues may include the absolute value of the difference between the gradients of two adjacent fragments. The fragment gradient may be defined as the average gradient {gx(f), gy(f)} of all pixels within the fragment f, where the gradient direction of the pixel is the offset of the upper and lower neighboring pixels of the pixel. In some embodiments, the difference between the Euclidean distances of the fragment gradients may be used as the corresponding intra-frame clue, where the Euclidean distance is the second norm of the fragment gradient {gx(f), gy(f)}. Intra-frame clues may also include the absolute value of the difference between the edge probabilities Edge(f) of two adjacent fragments, where Edge(f) is the average of the edge probabilities of all pixels on the fragment. Here, the edge probabilities may include the edge probabilities of microstructure edges and the lesion edges of lesion edges.
[0075] The inter-frame clue may include the difference between the spatial offsets {dx(f), dy(f)} of two adjacent fragments. The spatial offset of a fragment may be defined as the average of the spatial offsets of all pixels within the fragment f to the corresponding pixels of the neighboring frame.
[0076] In some embodiments, the similarity of adjacent segments may be determined according to the following equation:
[0077] Among them, Err grad is the difference in segment gradients, Err edge is the difference in segment edge probability, Err disease is the difference in the probability of segment lesions, Err offset is the difference in segment space offset, r1, r2, r3, r4 are the weights of each clue, and δ1, δ2, δ3, δ4 are normalization parameters. rr If the value is greater than a certain threshold, two adjacent fragments are merged.
[0078] Figure 8 FIG. 8 is a schematic diagram of a process 800 for contour matching according to an embodiment of the present disclosure. The process 800 may be Figure 6 Since the pixels in the contour segment have corresponding spatial offsets in the neighborhood, the average value of the spatial offsets of all pixels can be used as the overall offset, and then the nearest contour in the neighborhood is searched based on the overall offset.
[0079] In block 810, the projection of the contour fragment in the subsequent frame is determined based on the overall offset. Assuming that the current contour fragment is Frag_t1, its overall offset in the neighboring frame is {dx, dy}. Thus, the projection of the current contour fragment in the subsequent frame can be obtained according to the overall offset, that is, Frag_t1'=Frag_t1+{dx, dy}.
[0080] In block 820, multiple candidate contour segments in the subsequent frame are determined. Considering the locality of the contour segments, only the contour segments near the projection in the subsequent frame may be considered. In some embodiments, an area in the subsequent frame may be determined based on the position of the projection in the subsequent frame. The area may be the maximum circumscribed rectangle of the projection. To facilitate calculation and improve operating efficiency, the sides of the rectangle may be along the horizontal and vertical directions of the frame. The contour segments covered by the rectangle are defined as the candidate contour segment set Set_t2.
[0081] In block 830, determine the contour segment with the smallest distance to the contour segment of interest. For each candidate contour segment Frag_t2 in the candidate contour segment set Set_t2, determine the distance between the projection Frag_t1' and the candidate contour segment Frag_t2 by determining the minimum distance between each pixel of the projection and the pixel of the candidate contour segment. Then, the candidate contour segment with the smallest distance determined can be determined as another contour segment that matches the contour segment of the first frame. The distance between the projection Frag_t1' and the candidate contour segment Frag_t2 can be calculated according to the following equation:
[0082]
[0083] Among them, for each pixel p of Frag_t1' i , calculate its nearest matching pixel p under Frag_t2 j , if the distance exceeds the threshold T, the distance between the two pixels is defined as T, otherwise it is the true distance |p i -p j The role of the threshold T is to ensure the stability of contour matching between calculation frames.
[0084] The above refers to Figures 1 to Figure 8 A video processing method according to an embodiment of the present disclosure is described. Compared with existing solutions, the embodiments of the present disclosure can use the spatiotemporal cues of the video to improve the accuracy and reliability of edge detection and enhancement, reduce the adverse effects caused by low-quality images in the video, and thus improve the robustness of video processing. Some embodiments of the present disclosure also implement edge vectorization and contour tracking based on spatiotemporal consistency, thereby enabling beneficial visual assistance to help doctors track objects of interest in the video.
[0085] Fig. 9 FIG. 9 is a schematic block diagram of a video processing apparatus 900 according to an embodiment of the present disclosure. The apparatus 900 may be implemented by the computing device 105 and may be implemented as software, hardware, or a combination of software and hardware.
[0086] As shown in the figure, the device 900 includes an edge acquisition unit 910, a spatial offset determination unit 920 and an updating unit 930. The edge acquisition unit 910 is configured to acquire a first edge of a first frame of a video and a second edge of at least one neighboring frame of the first frame. The spatial offset determination unit 920 is configured to determine the spatial offset of the pixels of the first edge to the corresponding pixels of the second edge based on the registration between the first frame and the at least one neighboring frame. The updating unit 930 is configured to update the first edge attribute of the pixels of the first edge based on at least the second edge attribute and the spatial offset of the corresponding pixels of the second edge.
[0087] In some embodiments, the edge acquisition unit 910 can also be configured to determine an edge attribute of each pixel of the first frame and at least one neighboring frame, wherein the edge attribute indicates the probability that the pixel belongs to an edge; and determine the first edge and the second edge by determining pixels in the first frame and at least one neighboring frame whose edge attributes are greater than a threshold.
[0088] In some embodiments, the update unit 930 can also be configured to: determine whether at least one neighborhood frame satisfies a preset condition; and in response to determining that at least one neighborhood frame satisfies the preset condition, update the first edge attribute of the pixel of the first edge based on the second edge attribute and spatial offset of the corresponding pixel of the second edge.
[0089] In some embodiments, the update unit 930 can also be configured to determine whether at least one neighborhood frame meets a preset condition by determining whether the image quality level of at least one neighborhood frame exceeds a quality threshold; and determining whether the average value of the spatial offset from the pixels of the first edge to the corresponding pixels of the second edge is within a predetermined range.
[0090] In some embodiments, the apparatus 900 may further include a tracking unit. The tracking unit is configured to determine a contour segment of the object of interest in the first frame based on the updated first edge attribute of the pixels of the first edge; determine an overall spatial offset of the contour segment to the subsequent frame based on the registration between the first frame and a subsequent frame of the first frame; and search for another contour segment matching the contour segment in the subsequent frame based on the overall spatial offset.
[0091] In some embodiments, the tracking unit may be configured to determine the contour segment of the object of interest in the first frame by: generating a superpixel contour of the first frame based on the updated first edge attribute; and generating the contour segment of the object of interest based on the superpixel contour.
[0092] In some embodiments, the tracking unit may be further configured to generate contour fragments of the object of interest by: dividing the superpixel contour into a set of fragments based on intersections in the superpixel contour; and generating contour fragments by merging the set of fragments.
[0093] In some embodiments, the tracking unit may be further configured to generate the contour segment in the following manner: determining a similarity between two adjacent segments in a group of segments; and merging the two adjacent segments to generate the contour segment in response to the similarity exceeding a threshold.
[0094] In some embodiments, the tracking unit may also be configured to determine the similarity between two adjacent segments in a group of segments by at least one of: the difference between the average gradients of pixels of the two adjacent segments; the difference between the average edge probabilities of pixels of the two adjacent segments; and the difference between the average spatial offsets of pixels of the two adjacent segments to a neighboring frame.
[0095] In some embodiments, the tracking unit can also be configured to search for another contour segment that matches the contour segment in a subsequent frame in the following manner: based on the overall spatial offset, obtain a projection of the contour segment in the subsequent frame; determine multiple candidate contour segments in the subsequent frame; and search for another contour segment that is closest to the projection among the multiple candidate contour segments.
[0096] In some embodiments, the tracking unit may also be configured to determine a plurality of candidate contour segments in a subsequent frame by: determining an area of the subsequent frame based on the position of the projection in the subsequent frame; and determining a plurality of candidate contour segments of the subsequent frame that are at least partially within the area.
[0097] In some embodiments, the tracking unit can also be configured to search for another contour segment that is closest to the projection in the following manner: for each candidate contour segment among multiple candidate contour segments, determine the distance between the projection and the candidate contour segment by determining the minimum distance between each pixel of the projection and a pixel of the candidate contour segment; and determine the candidate contour segment with the smallest determined distance as another contour segment.
[0098] In some embodiments, the tracking unit may be further configured to highlight the contour segment and another contour segment for tracking during the playback of the video.
[0099] In some embodiments, the first edge and the second edge may respectively include at least one of: a microstructure edge and a lesion edge.
[0100] In some embodiments, the video may include narrow band imaging (NBI) and magnified endoscopy (ME) video.
[0101] Fig.10A schematic block diagram of an example device 1000 that can be used to implement an embodiment of the present disclosure is shown. For example, a computing device 105 according to an embodiment of the present disclosure can be implemented by the device 1000. As shown, the device 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 1002 or loaded from a storage unit 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. The CPU 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0102] A number of components in the device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0103] The various processes and processing described above, such as methods 200, 500, 600, 700, and / or 800, may be performed by the processing unit 1001. For example, in some embodiments, the methods 200, 500, 600, 700, and / or 800 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into the RAM 1003 and executed by the CPU 1001, one or more actions of the methods 200, 500, 600, 700, and / or 800 described above may be performed.
[0104] The present disclosure may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present disclosure.
[0105] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0106] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0107] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0108] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0109] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0110] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0111] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0112] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A video processing method, comprising: Obtaining a first edge of a first frame of the video and a second edge of at least one neighboring frame of the first frame; determining, based on the registration between the first frame and the at least one neighboring frame, a spatial offset of pixels of the first edge to corresponding pixels of the second edge; as well as A first edge attribute of the pixel of the first edge is updated based on at least the second edge attribute of the corresponding pixel of the second edge and the spatial offset.
2. The method according to claim 1, wherein obtaining a first edge of the first frame of the video and a second edge of the at least one neighboring frame comprises: determining an edge attribute for each pixel of the first frame and the at least one neighborhood frame, wherein the edge attribute indicates a probability that the pixel belongs to an edge; as well as The first edge and the second edge are determined by determining pixels in the first frame and the at least one neighboring frame whose edge attributes are greater than a threshold.
3. The method of claim 1 , wherein updating the first edge attribute of the pixels of the first edge comprises: Determining whether the at least one neighboring frame satisfies a preset condition; as well as In response to determining that the at least one neighborhood frame satisfies the preset condition, the first edge attribute of the pixel of the first edge is updated based on the second edge attribute of the corresponding pixel of the second edge and the spatial offset.
4. The method according to claim 3, wherein determining whether the at least one neighboring frame satisfies a preset condition comprises at least one of the following: determining whether an image quality level of the at least one neighborhood frame exceeds a quality threshold; and It is determined whether an average value of the spatial offsets from pixels of the first edge to corresponding pixels of the second edge is within a predetermined range.
5. The method according to claim 1, further comprising: determining a contour segment of an object of interest in the first frame based on the updated first edge attributes of the pixels of the first edge; determining an overall spatial offset of the contour segment to a subsequent frame based on a registration between the first frame and a subsequent frame of the first frame; as well as Based on the global spatial offset, another contour segment matching the contour segment is searched in the subsequent frame.
6. The method of claim 5, wherein determining a contour segment of the object of interest in the first frame comprises: Based on the updated first edge attribute, generating a superpixel contour of the first frame; as well as Based on the superpixel contour, the contour segment of the object of interest is generated.
7. The method of claim 6, wherein generating the contour segment of the object of interest comprises: Based on intersections in the superpixel contour, segmenting the superpixel contour into a set of segments; as well as The contour segment is generated by merging the set of segments.
8. The method of claim 7, wherein generating the contour segment by merging the set of segments comprises: determining a similarity between two adjacent segments in the set of segments; as well as In response to the similarity exceeding a threshold, the two adjacent segments are merged to generate the contour segment.
9. The method of claim 8, wherein determining the similarity between two adjacent segments in the set of segments comprises determining at least one of: a difference between average gradients of pixels of the two adjacent segments; The difference between the average edge probabilities of the pixels of the two adjacent segments; and The difference between the average spatial offsets of the pixels of the two adjacent fragments to the neighborhood frame.
10. The method of claim 7, wherein searching the subsequent frame for another contour segment matching the contour segment based on the overall spatial offset comprises: Based on the overall spatial offset, obtaining a projection of the contour segment in the subsequent frame; determining a plurality of candidate contour segments in the subsequent frame; as well as The multiple candidate contour segments are searched for the other contour segment that is closest to the projection distance.
11. The method of claim 10, wherein determining a plurality of candidate contour segments in the subsequent frame comprises: Determining a region of the subsequent frame based on a position of the projection in the subsequent frame; as well as The plurality of candidate contour segments of the subsequent frame that are at least partially within the region are determined.
12. The method according to claim 10, wherein searching for the other contour segment closest to the projection distance comprises: For each candidate contour segment of the plurality of candidate contour segments, determining a distance between the projection and the candidate contour segment by determining a minimum distance between each pixel of the projection and a pixel of the candidate contour segment; as well as The candidate contour segment with the smallest determined distance is determined as the other contour segment.
13. The method according to claim 5, further comprising: During playback of the video, the contour segment and the another contour segment are highlighted for tracking.
14. The method according to any one of claims 1 to 13, wherein the first edge and the second edge each include at least one of: microstructure edges; and Lesion edge.
15. The method of any one of claims 1 to 13, wherein the video comprises narrow band imaging (NBI) and magnified endoscopy (ME) video.
16. A video processing device, comprising: an edge acquisition unit, configured to acquire a first edge of a first frame of the video and a second edge of at least one neighboring frame of the first frame; a spatial offset determination unit configured to determine a spatial offset of pixels of the first edge to corresponding pixels of the second edge based on the registration between the first frame and the at least one neighboring frame; as well as An updating unit is configured to update a first edge attribute of the pixel of the first edge based on at least the second edge attribute of the corresponding pixel and the spatial offset.
17. An electronic device comprising: at least one processing unit; At least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the electronic device to perform the method according to any one of claims 1 to 15.
18. A computer-readable storage medium comprising machine-executable instructions which, when executed by a device, cause the device to perform the method according to any one of claims 1 to 15.
19. A computer program product comprising machine executable instructions which, when executed by a device, cause the device to perform the method according to any one of claims 1 to 15.
