Image edge tracking processing method, device and server
By obtaining the effective boundary region of the image and matching contour points to generate a contour array, the problem of inaccurate description of small objects in traditional methods is solved, and higher precision image edge processing is achieved.
Patent Information
- Application Number
- CN202211372188.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-31
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2042-10-31
AI Technical Summary
Traditional image edge tracking methods are difficult to accurately describe small or oddly shaped objects such as lesions and tumors in the field of medical imaging, thus limiting the accuracy of image processing.
By obtaining the effective boundary region of the image to be processed, using edge contour description information and marker values, the target boundary pixels are extracted, and a preset number of contour points are matched along the edge of the boundary pixels to generate a contour array to achieve pixel-level boundary delineation.
It enables detailed target contour description of small or specially shaped objects, improving the precision and accuracy of image processing.
Smart Images

Figure CN115690139B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and in particular to a tracking processing method and device for image edges and a server. BACKGROUND
[0002] In the field of image processing, when image segmentation, image detection, and model reconstruction are performed, tracking processing of image edges is often required. In a conventional tracking processing method for image edges, the tracking is performed based on pixel points, and the generated contour is offset by one pixel at the edge. However, in the medical imaging field, it is difficult to accurately describe small or special-shaped objects such as lesions and tumors by using the conventional pixel-level delineation, which limits the accuracy of image processing. SUMMARY
[0003] In view of the above technical problems, the present application aims to provide a tracking processing method and device for image edges and a server to achieve more accurate image edge processing.
[0004] In a first aspect, an embodiment of the present application provides a tracking processing method for image edges, which includes: obtaining an effective boundary region of a to-be-processed image, wherein the effective boundary region carries edge contour description information; the edge contour description information includes a plurality of boundary pixel points and a label value of each boundary pixel point; traversing the effective boundary region in a preset traversal direction, and extracting a target boundary pixel point that meets a condition from the boundary pixel points based on the label value; for each target boundary pixel point, sequentially matching a preset number of contour points along an edge of the target boundary pixel point in a preset order, and adding the contour points to a pre-established contour array; and generating a target contour contained in the to-be-processed image based on the contour array.
[0005] In combination with the first aspect, an embodiment of the present application provides a first possible implementation manner of the first aspect, wherein the to-be-processed image carries a pixel coordinate system, and all pixel points of the to-be-processed image and a label value of each pixel point are marked in the pixel coordinate system; the pixel points include the boundary pixel points of the preset organization, non-boundary pixel points, and blank pixel points in the to-be-processed image except the region where the preset organization is located; each pixel point carries a label value; the label value of the blank pixel point is 0; the label value of the non-boundary pixel point is 1; and the label value of the boundary pixel point is a negative value less than 0, which is determined by the number of adjacent non-boundary pixel points of the boundary pixel point.
[0006] With reference to the first possible implementation manner of the first aspect, the second possible implementation manner of the first aspect is provided in the embodiments of the present application, and the step of extracting the target boundary pixel point meeting the condition from the boundary pixel points based on the label value comprises: extracting a boundary pixel point with a first label value less than 0 as the target boundary pixel point meeting the condition based on the label value; and continuing to extract a next target boundary pixel point in a preset clockwise order until the entire effective boundary region is traversed.
[0007] With reference to the second possible implementation manner of the first aspect, the third possible implementation manner of the first aspect is provided in the embodiments of the present application, and the step of continuing to extract a next target boundary pixel point in a preset clockwise order comprises: if the boundary pixel point is an outer contour pixel point, continuing to extract a next target boundary pixel point in a clockwise order; and if the boundary pixel point is an inner contour pixel point, continuing to extract a next target boundary pixel point in an anticlockwise order.
[0008] With reference to the first possible implementation manner of the first aspect, the fourth possible implementation manner of the first aspect is provided in the embodiments of the present application, and the step of sequentially matching a preset number of contour points in a preset order comprises: extracting a position relationship of the target boundary pixel point relative to the non-boundary pixel point; searching for a preset number of contour points corresponding to the position relationship in a pre-established assignment table, and determining positions and coordinates of the contour points in the pixel coordinate system along an edge of the target boundary pixel point based on the position relationship; wherein the assignment table records a plurality of position relationships of a target boundary pixel point relative to the non-boundary pixel point, and a setting position of the contour point relative to the target boundary pixel point under each position relationship; and if the target boundary pixel point is an outer contour pixel point, the contour points are arranged in a first clockwise order, and if the target boundary pixel point is an inner contour pixel point, the contour points are arranged in a second clockwise order.
[0009] With reference to the first aspect, the fifth possible implementation manner of the first aspect is provided in the embodiments of the present application, and the step of generating a target contour contained in the image to be processed based on the contour array comprises: performing a deduplication processing on the contour array; wherein the deduplication processing comprises: removing duplicate contour points and merging the contour points on the same line; and generating the target contour contained in the image to be processed based on the contour array after the deduplication processing.
[0010] With reference to the first aspect, the embodiment of the present application provides a sixth possible implementation manner of the first aspect, and the step of obtaining the effective boundary region of the image to be processed comprises: obtaining a minimum region containing the boundary pixel points in the image to be processed, and determining the minimum region as the effective boundary region of the image to be processed; wherein the minimum region is a minimum rectangular region containing the boundary pixel points.
[0011] In the second aspect, the embodiment of the present application further provides an image edge tracking processing device, which comprises: an obtaining module, configured to obtain an effective boundary region of an image to be processed, wherein the effective boundary region carries edge contour description information; the edge contour description information comprises a plurality of boundary pixel points and a mark value of each boundary pixel point; an extracting module, configured to traverse the effective boundary region according to a preset traversal direction, and extract a target boundary pixel point meeting a condition from the boundary pixel points based on the mark value; a matching module, configured to, for each target boundary pixel point, sequentially match a preset number of contour points along an edge of the target boundary pixel point according to a preset order, and add the contour points to a pre-established contour array; and a processing module, configured to generate a target contour contained in the image to be processed based on the contour array.
[0012] In the third aspect, the embodiment of the present application further provides a server, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the steps of the method of the first aspect when executing the computer program.
[0013] In the fourth aspect, the embodiment of the present application further provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the method of the first aspect when running on a processor.
[0014] The embodiment of the present application brings the following beneficial effects:
[0015] The image edge tracking processing method, device and server provided by the embodiment of the present application can obtain an effective boundary region of an image to be processed, traverse the effective boundary region, extract a target boundary pixel point meeting a condition from the boundary pixel points based on a mark value, sequentially match a preset number of contour points along an edge of the target boundary pixel point according to a preset order for each target boundary pixel point, add the contour points to a pre-established contour array, and generate a target contour of a preset organization in the image to be processed based on the contour array. Since the contour points are matched along the edges of the pixel points, the boundary can be outlined at the pixel level when the target contour is generated based on the contour array, so that a more fine target contour can be obtained for a smaller or more special-shaped object, and thus the imaging is more accurate.
[0016] Other features and advantages of the present application will be set forth in the description that follows, and in part will be apparent from the description, or can be learned by practice of the application. The purposes and other advantages of the application will be realized and attained by the structure particularly pointed out in the description, claims and drawings.
[0017] In order to make the above objectives, features and advantages of the present application more apparent, the following will specifically describe a preferred embodiment in combination with the accompanying drawings, and the detailed description is as follows. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or the prior art description. Obviously, the drawings described below are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0019] Figure 1 A flow chart of an image edge tracking processing method provided by an embodiment of the present application is shown in the figure;
[0020] Figure 2 A schematic diagram of a to-be-processed image provided by an embodiment of the present application is shown in the figure;
[0021] Figure 3 A schematic diagram of an assignment table provided by an embodiment of the present application is shown in the figure;
[0022] Figure 4 A schematic diagram of another assignment table provided by an embodiment of the present application is shown in the figure;
[0023] Figure 5 A structural schematic diagram of an image edge tracking processing device provided by an embodiment of the present application is shown in the figure;
[0024] Figure 6 A structural schematic diagram of a server provided by an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0025] In order to make the objectives, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the present application will be described clearly and completely below in combination with the drawings. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present application.
[0026] At present, for image processing in the field of medical images, points outside the mask image are simply connected, and it is difficult to obtain a pixel-level boundary, resulting in that it is difficult to achieve high-precision requirements for images of small or special-shaped objects.
[0027] Based on this, the image edge tracking processing method, device and server provided by the embodiment of the application can effectively alleviate the above technical problems and improve the precision of image processing.
[0028] In order to facilitate the understanding of the embodiment, first, a kind of image edge tracking processing method disclosed by the embodiment of the application is introduced in detail.
[0029] In a possible implementation, the embodiment of the application provides an image edge tracking processing method, wherein the image edge tracking processing method of the embodiment of the application is actually a boundary tracking algorithm, which is an algorithm that starts from any pixel adjacent to the boundary, automatically walks along the boundary of the figure in a clockwise (or counterclockwise) direction and returns to the starting point. Specifically, as shown in the flowchart of the image edge tracking processing method, the method comprises the following steps: Figure 1
[0030] Step S102, obtaining an effective boundary region of a to-be-processed image;
[0031] In the embodiment of the application, the effective boundary region carries edge contour description information; the edge contour description information includes a plurality of boundary pixel points and a label value of each boundary pixel point.
[0032] In actual use, the to-be-processed image is usually a mask image obtained based on a layered slice of a preset tissue, and further processed by binarization and pixel-level image rendering to obtain an image carrying edge contour description information.
[0033] The effective boundary region usually refers to the smallest region containing the preset tissue, so when obtaining the effective boundary region, the smallest region containing the boundary pixel points in the to-be-processed image is usually obtained first, and then the smallest region is determined as the effective boundary region of the to-be-processed image; in the embodiment of the application, the smallest region is the smallest rectangular region containing the boundary pixel points.
[0034] Step S104, traversing the effective boundary region according to a preset traversal direction, and extracting target boundary pixel points meeting a condition from the boundary pixel points based on the label value;
[0035] In actual use, in addition to including the target boundary pixel point, the effective boundary region further includes non-target edge pixel points and blank pixel points, and the marking values of different pixel points are different, so in this step, the target boundary pixel point can be extracted based on the pixel point.
[0036] In step S106, for each target boundary pixel point, a preset number of contour points are sequentially matched along the edge of the target boundary pixel point in a preset order, and the contour points are added to a pre-established contour array.
[0037] In step S108, the target contour included in the image to be processed is generated based on the contour array.
[0038] In a specific implementation, in step S106, a preset number of contour points can be generated based on the original target boundary pixel point, the contour points are arranged along the edge of the target boundary pixel point, and the contour points are added to the contour array.
[0039] In actual use, the coordinates of the contour points are usually added to the contour array, so in step S108, the target contour included in the image to be processed, i.e., the target contour of the preset organization, can be generated based on the coordinates of the contour points in the contour array, and since the contour points are matched based on the original target boundary pixel point, the position of the original target boundary pixel point can be described more accurately, so that the target contour is more accurate.
[0040] Therefore, the image edge tracking processing method provided by the embodiment of the present application can obtain an effective boundary region of an image to be processed, traverse the effective boundary region, extract target boundary pixel points that meet a condition from boundary pixel points based on marking values, for each target boundary pixel point, sequentially match a preset number of contour points along the edge of the target boundary pixel point in a preset order, and add the contour points to a pre-established contour array, so as to generate a target contour of a preset organization in the image to be processed based on the contour array. Since the contour points are matched along the edge of the pixel point, when the contour array is used to generate the target contour, pixel-level boundary outlining can be realized, so that a more accurate target contour can be obtained for a smaller or more special-shaped object, and imaging is more accurate.
[0041] In actual use, in order to facilitate the description of the pixel-level contour points, the image to be processed usually carries a pixel coordinate system, in which all pixel points of the image to be processed and the marking values of each pixel point are marked, and the pixel points include boundary pixel points of a preset organization, non-boundary pixel points, and blank pixel points in the image to be processed except the region of the preset organization.
[0042] For ease of understanding, Figure 2 A schematic diagram of an image to be processed is shown, wherein, Figure 2 A pixel coordinate system is shown, Figure 2 Each small square represents a pixel point, and the horizontal and vertical coordinates are both taken as an example of a pixel range of -1 to 11, as shown in Figure 2 Each pixel point carries a marker value; wherein the marker value of the blank pixel point is 0; the marker value of the non-boundary pixel point is 1; the marker value of the boundary pixel point is a negative value less than 0, and the marker value of the boundary pixel point is determined by the number of adjacent non-boundary pixel points of the boundary pixel point. For example, assuming that the number of adjacent non-boundary pixel points of a certain boundary pixel point is 1, then the boundary pixel point is usually marked as -1, and if the number of adjacent non-boundary pixel points is 2, then the boundary pixel point is usually marked as -2, therefore, usually the marker value of the negative value is generally greater than -4, that is, except for special cases, there are very few isolated boundary pixel points.
[0043] And based on Figure 2 As shown in the image to be processed, in step S104, the target boundary pixel point is extracted based on the marker value, specifically, the above effective boundary area is usually traversed according to a preset traversal direction, and then the first boundary pixel point with a marker value less than 0 is extracted as the target boundary pixel point that meets the condition; and the next target boundary pixel point is continuously extracted according to a preset clock sequence until the entire effective boundary area is traversed. Secondly, the clock sequence here includes a clockwise sequence or a counterclockwise sequence, and in actual use, a clockwise sequence is usually used for an outer contour pixel point, and a counterclockwise sequence is usually used for an inner contour pixel point, that is, if the boundary pixel point is an outer contour pixel point, the next target boundary pixel point is continuously extracted according to the clockwise sequence; if the boundary pixel point is an inner contour pixel point, the next target boundary pixel point is continuously extracted according to the counterclockwise sequence, in addition, the clock sequence here can also be set according to the actual situation, and the present embodiment does not limit this.
[0044] Further, in step S104, the preset traversal direction can be set according to the actual situation to realize full-area traversal of the effective boundary area, such as from left to right, from top to bottom, etc., to find the first boundary pixel point with a marker value less than 0, if the target boundary pixel point that meets the condition cannot be found in the traversal process, it means that there is no boundary pixel point with a marker value less than 0 in the effective boundary area at this time, then the process is ended.
[0045] For ease of understanding, taking the image to be processed as shown in Figure 2 The effective boundary area extracted in step S102 is Figure 2The effective boundary region is shown in the middle dotted box. The effective boundary region can be defined as a frame, and then traversing the frame from left to right and from top to bottom in a preset traversal direction, a first boundary pixel point with a marker value less than 0 can be found, that is, Figure 2 In this case, the target boundary pixel point corresponding to the pixel coordinates (9, -1) has a marker value of -1. At this time, the point can be recorded as a starting point (start), and the point is taken as a current point (current), and the direction (dict) is recorded as right, that is, the point obtained by traversing the first row to the right; the turn direction is recorded as clockwise, and the contour is an outer contour.
[0046] Further, for the target boundary pixel point, step S106 can be performed to match the contour points along the edge. Specifically, when matching the contour points, it is usually necessary to extract the positional relationship of the target boundary pixel point relative to the non-boundary pixel point; the preset number of contour points corresponding to the positional relationship are found in the pre-established assignment table, and the positions and coordinates of the contour points in the pixel coordinate system are determined based on the positional relationship along the edge of the target boundary pixel point.
[0047] Specifically, in the embodiments of the present application, the assignment table records a plurality of positional relationships of the target boundary pixel point relative to the non-boundary pixel point, and the setting positions of the contour points relative to the target boundary pixel point under each positional relationship; and if the target boundary pixel point is an outer contour pixel point, the contour points are arranged in a first clockwise order, and if the target boundary pixel point is an inner contour pixel point, the contour points are arranged in a second clockwise order.
[0048] In actual use, the above positional relationship usually includes edge-direction adjacent points and corner-direction adjacent points, wherein the edge-direction adjacent points include upper boundary points, lower boundary points, left boundary points and right boundary points, and the corner-direction adjacent points further include left upper corner adjacent points, right upper corner adjacent points, right lower corner adjacent points and left lower corner adjacent points.
[0049] When matching the contour points, if the positional relationship of the target boundary pixel point relative to the non-boundary pixel point is an upper boundary point, the preset number of contour points corresponding to the upper boundary point can be found in the assignment table, and in the pixel coordinate system, the upper boundary edge of the target boundary pixel point determines the preset number of contour points, that is, the positions and coordinates of the contour points are marked in the pixel coordinate system.
[0050] For ease of understanding, the image to be processed shown in Figure 2 is taken as an example for description, and it is assumed that the first boundary pixel point with a marker value less than 0 found in the pixel coordinate system according to the above steps is the target boundary pixel point corresponding to the pixel coordinates (9, -1) with a marker value of -1, at this time, the point is taken as a starting point (start), and the point is taken as a current point (current), and the direction (dict) is recorded as right, that is, the point obtained by traversing the first row to the right; the turn direction is recorded as clockwise, and the contour is an outer contour. Figure 2It can be seen that the position relationship of the target boundary pixel point relative to the non-boundary pixel point is the right upper corner adjacent point, and therefore, the preset number of contour points corresponding to the right upper corner adjacent point can be found in the assignment table. In actual use, the preset number is usually three in the embodiment of the application, that is, three contour points are found. In addition, since the assignment table also records the setting position of the contour point relative to the target boundary pixel point under each position relationship, the setting position of the three contour points relative to the target boundary pixel point can be directly determined based on the assignment table. In actual use, if the target boundary pixel point is an outer contour pixel point, the first clockwise sequence is a clockwise sequence, that is, the matched contour points are arranged in a clockwise sequence, and if the target boundary pixel point is an inner contour pixel point, the second clockwise sequence is usually a counterclockwise sequence, that is, the contour points are arranged in a counterclockwise sequence.
[0051] Further, in order to facilitate understanding, Figure 3 A schematic diagram of an assignment table is shown, which shows the position relationship of the edge direction adjacent point and the corner direction adjacent point, the number of matched contour points under each position relationship, and the position and coordinates of the contour points. Among them, Figure 3 It is shown that the assignment table corresponding to the outer contour pixel point, and the number of contour points corresponding to each position relationship is three.
[0052] In actual use, the above three contour points can be regarded as three continuous points, such as Figure 3 As shown, the point represented by the asterisk is the target boundary pixel point, the circle numbers represent three contour points p1-p3, and the point marked with a value of 1 is the non-boundary pixel point adjacent to the target boundary pixel point. The arrow direction is the first clockwise sequence. Since Figure 3 It is shown that the assignment table corresponding to the outer contour pixel point, and therefore, the first clockwise sequence is a clockwise sequence. Similarly, Figure 4 Another schematic diagram of an assignment table is shown, in which, Figure 4 It is shown that the assignment table corresponding to the inner contour pixel point, and the number of contour points corresponding to each position relationship is three. In actual use, the corresponding assignment table can be selected and used according to the outer contour pixel point and the inner contour pixel point.
[0053] Taking the amplitude table shown in Figure 3 When matching the contour points, after the target boundary pixel point is determined in the above manner, the three contour points p1-p3 can be found according to the assignment table shown in Figure 3 , and the coordinates of the three contour points are pushed into the contour array, and then the next target boundary pixel point is continuously traversed. In actual use, in order to select a suitable next target boundary pixel point, the marked value can also be based on Figure 2The illustrated image to be processed is taken as an example for illustration, assuming that the current target boundary pixel point (current point) is current, when the next suitable target boundary pixel point is continuously extracted in a clockwise order, the neighboring points in 8 directions (up, down, left, right, upper left, lower left, upper right, lower right) of the current point can be viewed first, and the points with a marked value of 1 are excluded, then the neighboring points in 4 corner directions (upper left, lower left, upper right, lower right) of the current point are continuously viewed, and the points with a marked value less than 0 and being sandwiched by two points with a marked value of 1 are excluded, so that the next suitable target boundary pixel point can be effectively selected, and the next suitable target boundary pixel point is regarded as the start point (start), that is, the entire effective boundary region is regarded as being traversed.
[0054] Further, for the contour array obtained by the above process, the contour array can be further de-duplicated; wherein the de-duplication processing includes: removing duplicate contour points and merging contour points on the same line, and then generating a target contour contained in the image to be processed based on the contour array after the de-duplication processing. At this time, the obtained target contour is a boundary contour based on pixel-level outlining, which can make the boundary tracking effect more accurate.
[0055] Further, on the basis of the above embodiment, the embodiment of the present application further provides an image edge tracking processing device, specifically, Figure 5 a structure schematic diagram of an image edge tracking processing device is shown, and the device comprises:
[0056] The acquisition module 50 is used to acquire an effective boundary region of an image to be processed, wherein the effective boundary region carries edge contour description information; the edge contour description information comprises a plurality of boundary pixel points and a marked value of each boundary pixel point;
[0057] The extraction module 52 is used to traverse the effective boundary region in a preset traversal direction, and extract target boundary pixel points meeting a condition from the boundary pixel points based on the marked value;
[0058] The matching module 54 is used to, for each target boundary pixel point, sequentially match a preset number of contour points along the edge of the target boundary pixel point in a preset order, and add the contour points to a pre-established contour array;
[0059] The processing module 56 is used to generate a target contour contained in the image to be processed based on the contour array.
[0060] The image edge tracking processing device provided by the embodiment of the present application has the same technical features as the image edge tracking processing method provided by the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.
[0061] Further, the embodiment of the present application further provides a server, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to realize the steps of the above method.
[0062] The embodiment of the present application further provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executable on a processor to execute the steps of the above method.
[0063] Further, the embodiment of the present application further provides a structural diagram of a server, as shown in Figure 6 Fig. 1, which is a structural diagram of the server, wherein the server comprises a processor 61 and a memory 60, the memory 60 stores computer executable instructions executable by the processor 61, and the processor 61 executes the computer executable instructions to realize the above method.
[0064] In the embodiment shown in Figure 6 Fig. 1, the server further comprises a bus 62 and a communication interface 63, wherein the processor 61, the communication interface 63 and the memory 60 are connected through the bus 62.
[0065] The memory 60 can include a high-speed random access memory (RAM) and can also include a non-volatile memory such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 63 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used. The bus 62 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 62 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 only one bidirectional arrow is used in the figure, but it does not mean that there is only one bus or only one type of bus.
[0066] The processor 61 can be an integrated circuit chip having a processing capability of signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware in the processor 61 or the instruction in the form of software. The processor 61 described above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, or other mature storage media in the art. The storage medium is located in the storage, and the processor 61 reads the information in the storage, and combines the hardware to complete the foregoing method.
[0067] The image edge tracking processing method, device and server computer program product provided by the embodiments of the present application include a computer readable storage medium storing program codes, the program codes include instructions for executing the method described in the foregoing method embodiments. The specific implementation can be referred to the method embodiments, and will not be described here.
[0068] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device can refer to the corresponding process in the foregoing method embodiments, and will not be described here.
[0069] In addition, in the description of the embodiments of the present application, unless otherwise explicitly specified and limited, the terms "mounting", "connecting", "connecting" should be understood in a broad sense, for example, can be fixedly connected, can also be detachably connected, or integrally connected; can be mechanically connected, can also be electrically connected; can be directly connected, can also be indirectly connected through an intermediate medium, can be the communication inside two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0070] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the parts of the present application that essentially contribute to the prior art or the parts of the technical solutions can be embodied in the form of software products. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the various embodiments of the present application. The aforementioned storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0071] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the purpose of facilitating the description of the present application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as limiting the present application. In addition, the terms "first", "second", "third" are only for the purpose of description, and cannot be understood as indicating or implying relative importance.
[0072] Finally, it should be noted that: the above embodiments are only specific embodiments of the present application, which are used to illustrate the technical solutions of the present application, and are not limited thereto, the protection scope of the present application is not limited thereto, although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art within the technical range disclosed by the present application can modify or easily think of changes to the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features; and these modifications, changes or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method of tracking processing of an image edge, characterized by, The method comprises: acquiring an effective boundary region of a to-be-processed image, wherein the effective boundary region carries edge contour description information; the edge contour description information comprises a plurality of boundary pixel points, and each boundary pixel point has a mark value; traversing the effective boundary region according to a preset traversal direction, and extracting a target boundary pixel point meeting a condition from the boundary pixel points based on the mark value; for each target boundary pixel point, sequentially matching a preset number of contour points according to a preset order along the edge of the target boundary pixel point, and adding the contour points to a pre-established contour array; generating a target contour contained in the to-be-processed image based on the contour array; wherein the to-be-processed image carries a pixel coordinate system, all pixel points of the to-be-processed image are marked in the pixel coordinate system, and each pixel point has a mark value; the pixel points comprise preset organization boundary pixel points, non-boundary pixel points, and blank pixel points in a region other than the region where the preset organization is located in the to-be-processed image; each pixel point carries a mark value; wherein the mark value of the blank pixel point is 0; the mark value of the non-boundary pixel point is 1; and the mark value of the boundary pixel point is a negative value less than 0, which is determined by the number of adjacent non-boundary pixel points of the boundary pixel point; the step of extracting a target boundary pixel point meeting a condition from the boundary pixel points based on the mark value comprises: extracting a boundary pixel point with a first mark value less than 0 as the target boundary pixel point meeting the condition based on the mark value, and continuously extracting a next target boundary pixel point in a preset clockwise order until the entire effective boundary region is traversed.
2. The method of claim 1, wherein, the step of continuously extracting a next target boundary pixel point in a preset clockwise order comprises: if the boundary pixel point is an outer contour pixel point, continuously extracting a next target boundary pixel point in a clockwise order; if the boundary pixel point is an inner contour pixel point, continuously extracting a next target boundary pixel point in an anticlockwise order.
3. The method of claim 1, wherein, the step of sequentially matching a preset number of contour points according to a preset order comprises: extracting the positional relationship of the target boundary pixel point relative to the non-boundary pixel point; finding the preset number of contour points corresponding to the positional relationship in a pre-established assignment table, and determining the position and coordinates of the contour points in the pixel coordinate system along the edge of the target boundary pixel point based on the positional relationship; wherein the assignment table records a plurality of positional relationships between a target boundary pixel point and the non-boundary pixel point, and the setting position of the contour points relative to the target boundary pixel point under each positional relationship; and if the target boundary pixel point is an outer contour pixel point, the contour points are arranged in a first clockwise order, and if the target boundary pixel point is an inner contour pixel point, the contour points are arranged in a second clockwise order.
4. The method of claim 1, wherein, the step of generating a target contour contained in the to-be-processed image based on the contour array comprises: The contour array is deduplicated; wherein the deduplication process includes: removing duplicate contour points and merging contour points on the same line; The target contour contained in the image to be processed is generated based on the contour array after deduplication.
5. The method of claim 1, wherein, The steps for obtaining the valid boundary region of the image to be processed include: Obtain the smallest region in the image to be processed that contains the boundary pixels, and determine the smallest region as the effective boundary region of the image to be processed. The minimum region is the smallest rectangular region that contains the boundary pixels.
6. An image edge tracking processing apparatus characterized by comprising: The device includes: The acquisition module is used to acquire the effective boundary region of the image to be processed, wherein the effective boundary region carries edge contour description information; the edge contour description information includes multiple boundary pixels and a label value for each boundary pixel; The extraction module is used to traverse the effective boundary region according to a preset traversal direction and extract target boundary pixels that meet the conditions from the boundary pixels based on the marker value. The matching module is used to match a preset number of contour points along the edge of each target boundary pixel in a preset order for each target boundary pixel, and add the contour points to a pre-established contour array. The processing module is used to generate the target contour contained in the image to be processed based on the contour array; The image to be processed carries a pixel coordinate system, in which all pixels of the image to be processed are marked, as well as the mark value of each pixel; the pixels include the boundary pixels of the preset organization, non-boundary pixels, and blank pixels in the image to be processed other than the area where the preset organization is located. Each pixel carries a marker value; wherein, the marker value of a blank pixel is 0; the marker value of a non-boundary pixel is 1; and the marker value of a boundary pixel is a negative value less than 0, determined by the number of adjacent non-boundary pixels of the boundary pixel. The step of extracting target boundary pixels that meet the conditions from the boundary pixels based on the marker value includes: Based on the marker value, the first boundary pixel with a marker value less than 0 is extracted as the target boundary pixel that meets the condition; and the next target boundary pixel is extracted in a preset clockwise order until the entire effective boundary region is traversed.
7. A server, characterized by The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, performs the steps of the method described in any one of claims 1-5.
Citation Information
Patent Citations
Contour extraction method and device based on seed point self-growth , equipment and medium
CN113989167A
Method for contour extraction for object representation
US20040179737A1