Image matting method under endoscope

By detecting and combining the outline path of the image picture, the image content under the endoscopic mirror is synchronously extracted, which solves the problem of insufficient frequency of medical endoscopic image picture processing, and achieves efficient image data processing and reduces printing consumables.

CN119205737AActive Publication Date: 2024-12-27NANJING SUOTU TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411687609.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2024-12-27
Estimated Expiration
2044-11-25

AI Technical Summary

Technical Problem

In addition to the endoscopic image, the image output from the medical endoscopic host also contains other parameters and status information, which makes the image under the mirror small and difficult to observe in scenes such as teaching, remote consultation, and live broadcast, and on the report workstation The collected image images contain a large number of black backgrounds, which consumes a lot of printing consumables during printing. In addition, traditional processing methods lack processing frequency when facing real-time data of medical image images with a full frame rate of 60FPS, increasing the delay of real-time data.

Method used

Using an endoscopic image picking method, by constructing a two-dimensional Cartesian coordinate system, detecting the edge of the picture, combining the contour paths of the upper and lower half of the image image area, synchronously extracting effective endoscopic image content, and removing unnecessary non-information The image content under the mirror meets the processing frequency of full frame rate.

Benefits of technology

The synchronization processing of the image data of the medical endoscopic host with a resolution of 1920×1080 and a frame rate of 60FPS is achieved, which removes non-mirror content, reduces delay, improves the accuracy and efficiency of image contour detection, and avoids Use unnecessary printing supplies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119205737A_ABST
    Figure CN119205737A_ABST
Patent Text Reader

Abstract

The invention discloses an endoscopic image matting method, which comprises the following steps of: acquiring medical endoscope host image data, taking the rightmost position in the horizontal direction and the middle position in the vertical direction as starting points, and starting to search a picture edge from the left side in the horizontal direction; sequentially taking a quarter of the clock surface as a detection range, and detecting point locations in an anticlockwise direction based on the color RGB value of the region to be removed; integrating the detected point positions to obtain an upper half part image picture area contour path; calculating to obtain a lower half part image picture area contour path; and according to the complete image picture contour path, synchronously extracting effective under-endoscope image contents from the medical endoscope host image data, and removing redundant non-under-endoscope image contents. According to the method, the effective under-endoscope image content can be synchronously extracted, the redundant non-under-endoscope image content can be removed, and the full-frame-rate processing frequency can be completely met in performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of medical endoscope image display, and in particular relates to an endoscope image extraction method. Background Art

[0002] In addition to the endoscopic image, the image output by the medical endoscope host also contains other parameters and status information. This information is distributed on the left or right side of the endoscopic image, resulting in the actual endoscopic image being too small to be easily observed during teaching, remote consultation, and live broadcast, and not being conducive to combining with other intraoperative images (operative field, etc.) within the limited terminal screen display range. In addition, the image captured on the report workstation will contain a lot of black background (at most more than 50% of the total size), resulting in a small endoscopic image on the printed report, which is difficult to identify and not beautiful. At the same time, these large amounts of black will consume a lot of printing consumables when printing.

[0003] Traditional processing methods are mainly used to process images and do not require high time consumption. However, when faced with real-time data of medical imaging pictures with a full frame rate of 60FPS (Frames Per Second), the processing frequency of traditional processing methods is obviously insufficient, which increases the delay of real-time data. Summary of the invention

[0004] In view of the technical problem in the prior art that the real-time data processing frequency of medical imaging images is obviously insufficient, thereby increasing the delay of real-time data, the present invention discloses an endoscopic image extraction method, which can synchronously extract effective endoscopic image content and remove redundant non-endoscopic image content, and the performance fully meets the processing frequency of full frame rate.

[0005] The present invention discloses a method for extracting images under an endoscope, and the method comprises the following steps: Obtain the image data of the medical endoscope host, construct a two-dimensional Cartesian coordinate system, take the upper left corner of the screen as the origin of the coordinate system (0, 0), the horizontal direction of the screen as the X-axis, rightward is positive, and the vertical direction as the Y-axis, downward is positive, and the unit is pixel; Take the rightmost position in the horizontal direction and the middle position in the vertical direction as the starting point, and start to search for the edge of the picture in the horizontal direction to the left; after finding the edge of the picture, start from twelve o'clock, use the clock as a guide, set the detection range from twelve o'clock before the clock start and end point to nine o'clock, and detect the points in a counterclockwise direction based on the RGB value of the color of the area to be removed; when the expected point range obtained reaches one-quarter of the clock face, take the clock end point of the detection range as the new starting point, adjust one-quarter of the clock face in the counterclockwise direction, as the new detection range, and detect the points in the counterclockwise direction; repeat the above detection process until the clock end point of the detection range returns to the twelve o'clock direction; The points detected are integrated to obtain the contour path of the upper half of the image area; Calculate and obtain the contour path of the lower half of the image area; Merge the upper half of the image screen area contour path and the lower half of the image screen area contour path to obtain a complete image screen contour path; According to the complete image picture contour path, effective endoscopic image content is synchronously extracted from the medical endoscope host image data, and redundant non-endoscopic image content is removed.

[0006] Furthermore, the frame rate of the medical endoscope host image data is not less than 60FPS.

[0007] Furthermore, the resolution of the medical endoscope host image data is 1920×1080.

[0008] Furthermore, the process of obtaining the contour path of the upper half of the image screen area includes the following steps: S1, input a frame of RGB data of medical image; set a point named CurrentPos, the X-axis coordinate value is the width of the image size minus 1, and the Y-axis coordinate is the height of the image size divided by 2; from the point CurrentPos, get the RGB value of the color of the area to be removed, named C0, set a variable-length list set, named listEdgePoint; S2, move the X-axis coordinate of point CurrentPos to the left by 10 pixels, and assign the new coordinate point value to CurrentPos, repeat this step until the new coordinate point value is different from C0; S3, move the X-axis coordinate of the point CurrentPos to the right by 1 pixel, and assign the new coordinate point value to CurrentPos, and repeat this step until the new coordinate point value is different from C0; S4, set a coordinate named BeginPos (BeginPos.X, BeginPos.Y), the coordinate value is the same as CurrentPos (CurrentPos.X, CurrentPos.Y), and add the CurrentPos coordinate to the listEdgePoint collection; S5, starting from the position of the point CurrentPos in the twelve o'clock direction, counterclockwise direction, successively obtains the pixel values ​​of the coordinate points between twelve o'clock and nine o'clock; S6, take the pixel value at the coordinate point (CurrentPos.X-1, CurrentPos.Y-1) to determine whether it is the same as C0, if the same, go to step S7; otherwise, assign the value of the next coordinate point (CurrentPos.X, CurrentPos.Y-1) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y, if yes, go to step S17, if not, return to step S5; Step S7, take the pixel value at the coordinate point (CurrentPos.X-1, CurrentPos.Y) to determine whether it is the same as C0, if the same, go to step S8; otherwise, assign the value of the next coordinate point (CurrentPos.X-1, CurrentPos.Y-1) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y. If yes, go to step S17, if not, return to step S5; S8, starting from the position of the point CurrentPos in the nine o'clock direction, counterclockwise direction, successively obtain the pixel values ​​of the coordinate points between nine o'clock and six o'clock; S9, take the pixel value at the coordinate point (CurrentPos.X-1, CurrentPos.Y+1) to determine whether it is the same as C0, if the same, go to step S10; otherwise, assign the value of the next coordinate point (CurrentPos.X-1, CurrentPos.Y) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y, if yes, go to step S17, if not, return to step S8; S10, take the pixel value at the coordinate point (CurrentPos.X, CurrentPos.Y+1) to determine whether it is the same as C0, if the same, go to step S11; otherwise, assign the value of the next coordinate point in the clockwise direction (CurrentPos.X-1, CurrentPos.Y+1) to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos.Y, if yes, go to step S17, if not, return to step S8; S11, starting from the position of the point CurrentPos in the six o'clock direction, counterclockwise direction, successively obtain pixel values ​​at coordinate points between six o'clock and three o'clock; S12, take the pixel value at the coordinate point (CurrentPos.X+1, CurrentPos.Y+1) to determine whether it is the same as C0, if the same, go to step S13; otherwise, assign the value of the next coordinate point (CurrentPos.X, CurrentPos.Y+1) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos.Y, if yes, go to step S17, if not, return to step S11; S13, take the pixel value at the coordinate point (CurrentPos.X+1, CurrentPos.Y) to determine whether it is the same as C0, if the same, go to step S14; otherwise, assign the value of the next coordinate point (CurrentPos.X+1, CurrentPos.Y+1) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos.Y, if yes, go to step S17, if not, return to step S11; S14, starting from the position of the point CurrentPos in the three o'clock direction, sequentially obtain pixel values ​​at coordinate points between three o'clock and twelve o'clock in the counterclockwise direction; S15, take the pixel value at the coordinate point (CurrentPos.X+1, CurrentPos.Y-1) to determine whether it is the same as C0, if the same, go to step S16; otherwise, assign the value of the next coordinate point (CurrentPos.X+1, CurrentPos.Y) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y, if yes, go to step S17, if not, return to step S14; S16, take the pixel value at the coordinate point (CurrentPos.X, CurrentPos.Y-1) to determine whether it is the same as C0, if the same, go to step S5; otherwise, assign the value of the next coordinate point in the clockwise direction (CurrentPos.X+1, CurrentPos.Y-1) to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y, if yes, go to step S17, if not, return to step S14; S17, the coordinate points in the integrated set listEdgePoint are used to draw and save the contour path of the upper half of the image screen area.

[0009] Furthermore, the process of calculating the contour path of the lower half of the image screen area includes the following steps: Traverse the contour path of the upper half of the image area from back to front, and extract all coordinate points in listEdgePoint; For each coordinate point, keep the X-axis coordinate value unchanged, use CurrentPos.Y+(CurrentPos.Y-BeginPos.Y) as the Y-axis coordinate value to generate a new coordinate point; All the new coordinate points generated are drawn and saved as the contour path of the lower half of the image screen area.

[0010] Furthermore, the endoscopic image extraction method comprises the following steps: The complete image screen contour path obtained by caching and merging is first checked before the next detection to see if the contour matches. If it matches, the existing image screen contour path is directly used.

[0011] Furthermore, the process of checking whether the contours match before the next detection includes the following steps: Retrieve the full outline path of an existing image; From the full contour path point set of the image screen, the pixel values ​​of the coordinate points at the positions of 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, and 90% are extracted respectively; Determine whether the pixels at the 10 extracted positions are the same. If so, based on the full contour path of the image screen, from the RGB data matrix of the medical image screen, in order from top to bottom and from left to right, obtain all pixel point data located within the full contour path except the path points, and use the obtained pixel point data as the data content containing the actual microscopic image of the medical image; if not, regenerate the image screen contour path according to the medical image screen.

[0012] The endoscopic image extraction method of the present invention performs full contour path detection on the image data of the medical endoscope host with a resolution of 1920×1080 and a frame rate of 60FPS (Frames Per Second), and compares it with the video image without such processing. The two images are synchronized without delay. In addition, the image contour path detection is correct and the image content under the microscope is accurately extracted. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 It is a flow chart of the method for extracting images under endoscope of the present invention; Figure 2 It is a flow chart of the overall detection steps of the present invention; Figure 3 It is a flow chart of the detection steps between 12 o'clock and 9 o'clock; Figure 4 It is a flow chart of the detection steps between 9 o'clock and 6 o'clock; Figure 5 It is a flow chart of the detection steps between 6 o'clock and 3 o'clock; Figure 6 It is a flow chart of the detection steps between 3 o'clock and 12 o'clock; Figure 7 To find the upper contour path diagram; Figure 8 Schematic diagram of deriving and calculating the lower contour path from the upper contour path. DETAILED DESCRIPTION

[0014] The following examples will enable those skilled in the art to more fully understand the present invention, but are not intended to limit the present invention in any way.

[0015] See also Figure 1 and Figure 2 The present invention discloses a method for extracting images under an endoscope, and the method comprises the following steps: Obtain the image data of the medical endoscope host, construct a two-dimensional Cartesian coordinate system, take the upper left corner of the screen as the origin of the coordinate system (0, 0), the horizontal direction of the screen as the X-axis, rightward is positive, and the vertical direction as the Y-axis, downward is positive, and the unit is pixel; Take the rightmost position in the horizontal direction and the middle position in the vertical direction as the starting point, and start to search for the edge of the picture in the horizontal direction to the left; after finding the edge of the picture, start from twelve o'clock, use the clock as a guide, set the detection range from twelve o'clock before the clock start and end point to nine o'clock, and detect the points in a counterclockwise direction based on the RGB value of the color of the area to be removed; when the expected point range obtained reaches one-quarter of the clock face, take the clock end point of the detection range as the new starting point, adjust one-quarter of the clock face in the counterclockwise direction, as the new detection range, and detect the points in the counterclockwise direction; repeat the above detection process until the clock end point of the detection range returns to the twelve o'clock direction; The points detected are integrated to obtain the contour path of the upper half of the image area; Calculate and obtain the contour path of the lower half of the image area; Merge the upper half of the image screen area contour path and the lower half of the image screen area contour path to obtain a complete image screen contour path; According to the complete image picture contour path, effective endoscopic image content is synchronously extracted from the medical endoscope host image data, and redundant non-endoscopic image content is removed.

[0016] In the present invention, the frame rate of the medical endoscope host image data is not less than 60FPS. The resolution of the medical endoscope host image data is 1920×1080.

[0017] See also Figures 3 to 6 The process of obtaining the contour path of the upper half of the image area includes the following steps: S1, input a frame of RGB data of medical image; set a point named CurrentPos, the X-axis coordinate value is the width of the image size minus 1, and the Y-axis coordinate is the height of the image size divided by 2; from the point CurrentPos, get the RGB value of the color of the area to be removed, named C0, set a variable-length list set, named listEdgePoint; S2, move the X-axis coordinate of point CurrentPos to the left by 10 pixels, and assign the new coordinate point value to CurrentPos, repeat this step until the new coordinate point value is different from C0; S3, move the X-axis coordinate of the point CurrentPos to the right by 1 pixel, and assign the new coordinate point value to CurrentPos, and repeat this step until the new coordinate point value is different from C0; S4, set a coordinate named BeginPos (BeginPos.X, BeginPos.Y), the coordinate value is the same as CurrentPos (CurrentPos.X, CurrentPos.Y), and add the CurrentPos coordinate to the listEdgePoint collection; S5, starting from the position of the point CurrentPos in the twelve o'clock direction, counterclockwise direction, successively obtain the pixel values ​​at the coordinate points between twelve o'clock and nine o'clock; S6, take the pixel value at the coordinate point (CurrentPos.X-1, CurrentPos.Y-1) to determine whether it is the same as C0, if the same, go to step S7; otherwise, assign the value of the next coordinate point (CurrentPos.X, CurrentPos.Y-1) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y, if yes, go to step S17, if not, return to step S5; Step S7, take the pixel value at the coordinate point (CurrentPos.X-1, CurrentPos.Y) to determine whether it is the same as C0, if the same, go to step S8; otherwise, assign the value of the next coordinate point (CurrentPos.X-1, CurrentPos.Y-1) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y. If yes, go to step S17, if not, return to step S5; S8, starting from the position of the point CurrentPos in the nine o'clock direction, counterclockwise direction, successively obtain the pixel values ​​of the coordinate points between nine o'clock and six o'clock; S9, take the pixel value at the coordinate point (CurrentPos.X-1, CurrentPos.Y+1) to determine whether it is the same as C0, if the same, go to step S10; otherwise, assign the value of the next coordinate point (CurrentPos.X-1, CurrentPos.Y) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y, if yes, go to step S17, if not, return to step S8; S10, take the pixel value at the coordinate point (CurrentPos.X, CurrentPos.Y+1) to determine whether it is the same as C0, if the same, go to step S11; otherwise, assign the value of the next coordinate point in the clockwise direction (CurrentPos.X-1, CurrentPos.Y+1) to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos.Y, if yes, go to step S17, if not, return to step S8; S11, starting from the position of the point CurrentPos in the six o'clock direction, counterclockwise direction, successively obtain pixel values ​​at coordinate points between six o'clock and three o'clock; S12, take the pixel value at the coordinate point (CurrentPos.X+1, CurrentPos.Y+1) to determine whether it is the same as C0, if the same, go to step S13; otherwise, assign the value of the next coordinate point (CurrentPos.X, CurrentPos.Y+1) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos.Y, if yes, go to step S17, if not, return to step S11; S13, take the pixel value at the coordinate point (CurrentPos.X+1, CurrentPos.Y) to determine whether it is the same as C0, if the same, go to step S14; otherwise, assign the value of the next coordinate point (CurrentPos.X+1, CurrentPos.Y+1) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos.Y, if yes, go to step S17, if not, return to step S11; S14, starting from the position of the point CurrentPos in the three o'clock direction, sequentially obtain pixel values ​​at coordinate points between three o'clock and twelve o'clock in the counterclockwise direction; S15, take the pixel value at the coordinate point (CurrentPos.X+1, CurrentPos.Y-1) to determine whether it is the same as C0, if the same, go to step S16; otherwise, assign the value of the next coordinate point (CurrentPos.X+1, CurrentPos.Y) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y, if yes, go to step S17, if not, return to step S14; S16, take the pixel value at the coordinate point (CurrentPos.X, CurrentPos.Y-1) to determine whether it is the same as C0, if the same, go to step S5; otherwise, assign the value of the next coordinate point in the clockwise direction (CurrentPos.X+1, CurrentPos.Y-1) to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y, if yes, go to step S17, if not, return to step S14; S17, the coordinate points in the integrated set listEdgePoint are used to draw and save the contour path of the upper half of the image screen area. Figure 7 Schematic diagram for finding the upper contour path.

[0018] Taking into account the characteristics of the endoscope image as a vertically symmetrical image, only the contour path of the upper half of the image area is detected, and the contour path of the lower half of the image area is calculated from the contour path of the upper half of the image area. After merging, the complete image contour path can be obtained, which greatly improves the detection speed.

[0019] See also Figure 8 The process of calculating the contour path of the lower half of the image area includes the following steps: Traverse the contour path of the upper half of the image screen area from back to front, and extract all coordinate points in listEdgePoint; for each coordinate point, keep the X-axis coordinate value unchanged, use CurrentPos.Y+ (CurrentPos.Y-BeginPos.Y) as the Y-axis coordinate value, and generate a new coordinate point; comprehensively generate all the new coordinate points, draw and save them as the contour path of the lower half of the image screen area.

[0020] In order to reduce the processing time of a single image screen area, the detected image screen contour path is cached, and the contour is checked for matching before the next detection. If it matches, the existing image screen contour path can be used directly, avoiding the resources and time required for each detection, thereby greatly improving the processing efficiency; if it does not match, the image screen contour is re-detected.

[0021] As one of the preferred options, the process of checking whether the contour matches before the next detection includes the following steps: Retrieve the full contour path of an existing image screen; extract the pixel values ​​of the coordinate points at the positions of 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, and 90% from the full contour path point set of the image screen; determine whether the pixel points at the 10 extracted positions are the same; if so, obtain all pixel point data located within the full contour path except the path points from the RGB data matrix of the medical image screen in order from top to bottom and from left to right based on the full contour path of the image screen, and use the obtained pixel point data as the data content containing the actual microscopic image of the medical image; if not, regenerate the image screen contour path according to the medical image screen.

[0022] Using the method of the present invention, when performing full contour path detection on the image data of the medical endoscope host with a resolution of 1920×1080 and a frame rate of 60FPS (Frames PerSecond), compared with the video image without such processing, the two images are synchronized without delay. In addition, the image contour path detection is correct and the image content under the microscope is accurately extracted.

[0023] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.

Claims

1. A method for extracting images under an endoscope, characterized in that: The endoscopic image extraction method comprises the following steps: Obtain the image data of the medical endoscope host, construct a two-dimensional Cartesian coordinate system, take the upper left corner of the screen as the origin of the coordinate system (0, 0), the horizontal direction of the screen as the X-axis, rightward is positive, and the vertical direction as the Y-axis, downward is positive, and the unit is pixel; Take the rightmost position in the horizontal direction and the middle position in the vertical direction as the starting point, and start to search for the edge of the picture in the horizontal direction to the left; after finding the edge of the picture, start from twelve o'clock, use the clock as a guide, set the detection range from twelve o'clock before the clock start and end point to nine o'clock, and detect the points in a counterclockwise direction based on the RGB value of the color of the area to be removed; when the expected point range reaches one-quarter of the clock face, take the clock end point of the detection range as the new starting point, adjust one-quarter of the clock face in the counterclockwise direction, as the new detection range, and detect the points in the counterclockwise direction; repeat the detection process until the clock end point of the detection range returns to the twelve o'clock direction; The points detected are integrated to obtain the contour path of the upper half of the image area; Calculate and obtain the contour path of the lower half of the image area; Merge the upper half of the image screen area contour path and the lower half of the image screen area contour path to obtain a complete image screen contour path; According to the complete image picture contour path, effective endoscopic image content is synchronously extracted from the medical endoscope host image data, and redundant non-endoscopic image content is removed.

2. The method for extracting images under an endoscope according to claim 1, characterized in that: The frame rate of the medical endoscope host image data is not less than 60FPS.

3. The method for extracting images under an endoscope according to claim 1, characterized in that: The resolution of the medical endoscope host image data is 1920×1080.

4. The method for extracting images under an endoscope according to claim 1, characterized in that: The process of obtaining the contour path of the upper half of the image screen area includes the following steps: S1, input a frame of RGB data of medical image; set a point named CurrentPos, the X-axis coordinate value is the width of the image size minus 1, and the Y-axis coordinate is the height of the image size divided by 2; from the point CurrentPos, get the RGB value of the color of the area to be removed, named C0, set a variable-length list set, named listEdgePoint; S2, move the X-axis coordinate of point CurrentPos to the left by 10 pixels, and assign the new coordinate point value to CurrentPos, repeat this step until the new coordinate point value is different from C0; S3, move the X-axis coordinate of the point CurrentPos to the right by 1 pixel, and assign the new coordinate point value to CurrentPos, and repeat this step until the new coordinate point value is different from C0; S4, set a coordinate named BeginPos (BeginPos.X, BeginPos.Y), the coordinate value is the same as CurrentPos (CurrentPos.X, CurrentPos.Y), and add the CurrentPos coordinate to the listEdgePoint collection; S5, starting from the position of the point CurrentPos in the twelve o'clock direction, counterclockwise direction, successively obtain the pixel values ​​at the coordinate points between twelve o'clock and nine o'clock; S6, take the pixel value at the coordinate point (CurrentPos.X-1, CurrentPos.Y-1) to determine whether it is the same as C0, if the same, go to step S6; otherwise, assign the value of the next coordinate point (CurrentPos.X, CurrentPos.Y-1) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y. If yes, go to step S17, if not, return to step S5; Step S7, take the pixel value at the coordinate point (CurrentPos.X-1, CurrentPos.Y) to determine whether it is the same as C0, if the same, go to step S8; otherwise, assign the value of the next coordinate point (CurrentPos.X-1, CurrentPos.Y-1) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y. If yes, go to step S17, if not, return to step S5; S8, starting from the position of the point CurrentPos in the nine o'clock direction, counterclockwise direction, successively obtain the pixel values ​​of the coordinate points between nine o'clock and six o'clock; S9, take the pixel value at the coordinate point (CurrentPos.X-1, CurrentPos.Y+1) to determine whether it is the same as C0, if the same, go to step S10; otherwise, assign the value of the next coordinate point (CurrentPos.X-1, CurrentPos.Y) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y, if yes, go to step S17, if not, return to step S8; S10, take the pixel value at the coordinate point (CurrentPos.X, CurrentPos.Y+1) to determine whether it is the same as C0, if the same, go to step S11; otherwise, assign the value of the next coordinate point in the clockwise direction (CurrentPos.X-1, CurrentPos.Y+1) to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos.Y, if yes, go to step S17, if not, return to step S8; S11, starting from the position of the point CurrentPos in the six o'clock direction, counterclockwise direction, successively obtain pixel values ​​at coordinate points between six o'clock and three o'clock; S12, take the pixel value at the coordinate point (CurrentPos.X+1, CurrentPos.Y+1) to determine whether it is the same as C0, if the same, go to step S13; otherwise, assign the value of the next coordinate point (CurrentPos.X, CurrentPos.Y+1) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos.Y, if yes, go to step S17, if not, return to step S11; S13, take the pixel value at the coordinate point (CurrentPos.X+1, CurrentPos.Y) to determine whether it is the same as C0, if the same, go to step S14; otherwise, assign the value of the next coordinate point (CurrentPos.X+1, CurrentPos.Y+1) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos.Y, if yes, go to step S17, if not, return to step S11; S14, starting from the position of the point CurrentPos in the three o'clock direction, sequentially obtain pixel values ​​at coordinate points between three o'clock and twelve o'clock in the counterclockwise direction; S15, take the pixel value at the coordinate point (CurrentPos.X+1, CurrentPos.Y-1) to determine whether it is the same as C0, if the same, go to step S16; otherwise, assign the value of the next coordinate point (CurrentPos.X+1, CurrentPos.Y) in the clockwise direction to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y, if yes, go to step S17, if not, return to step S14; S16, take the pixel value at the coordinate point (CurrentPos.X, CurrentPos.Y-1) to determine whether it is the same as C0, if the same, go to step S5; otherwise, assign the value of the next coordinate point in the clockwise direction (CurrentPos.X+1, CurrentPos.Y-1) to CurrentPos, add the CurrentPos coordinates to the set listEdgePoint, and determine whether CurrentPos.Y is the same as BeginPos. Y, if yes, go to step S17, if not, return to step S14; S17, the coordinate points in the integrated set listEdgePoint are used to draw and save the contour path of the upper half of the image screen area.

5. The method for extracting images under an endoscope according to claim 4, characterized in that: The process of calculating the contour path of the lower half of the image area includes the following steps: Traverse the contour path of the upper half of the image area from back to front, and extract all coordinate points in listEdgePoint; For each coordinate point, keep the X-axis coordinate value unchanged, use CurrentPos.Y+(CurrentPos.Y-BeginPos.Y) as the Y-axis coordinate value to generate a new coordinate point; All the new coordinate points generated are drawn and saved as the contour path of the lower half of the image screen area.

6. The method for extracting images under an endoscope according to claim 1, characterized in that: The endoscopic image extraction method comprises the following steps: The complete image screen contour path obtained by caching and merging is first checked before the next detection to see if the contour matches. If it matches, the existing image screen contour path is directly used.

7. The method for extracting images under an endoscope according to claim 6, characterized in that: The process of checking whether the contour matches before the next detection includes the following steps: Retrieve the full outline path of an existing image; From the full contour path point set of the image screen, the pixel values ​​of the coordinate points at the positions of 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, and 90% are extracted respectively; Determine whether the pixels at the 10 extracted positions are the same. If so, based on the full contour path of the image screen, from the RGB data matrix of the medical image screen, in order from top to bottom and from left to right, obtain all pixel point data located within the full contour path except the path points, and use the obtained pixel point data as the data content containing the actual microscopic image of the medical image; if not, regenerate the image screen contour path according to the medical image screen.

Citation Information

Patent Citations

  • Medical image contour rapid extraction method

    CN111127404A

  • Table tennis ball identification method based on contour detection technology

    CN115049689A

  • Fluorescent observation endoscope apparatus

    JP2005319115A

  • Image processor, imaging apparatus, and image processing method

    JP2010187194A

  • Animation presentation device

    JP2013033321A