Method and device for determining point coordinates in image, corresponding equipment and medium
Patent Information
- Application Number
- CN202280096958.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2025-01-21
AI Technical Summary
Existing straight line detection algorithms cannot meet the accuracy and efficiency requirements in some fields. In particular, the image dark line intersection positioning method is based on Hough transform, which has poor stability and low accuracy.
By sampling at equal intervals along the first direction and the second direction in the image, a set of candidate points is determined, and straight line fitting is performed to calculate intersection coordinates, combined with a filtering step to improve calculation accuracy.
The determination of the coordinates of the midpoint of the image with strong stability and high accuracy is achieved, and the problems of low accuracy and poor stability in the existing technology are solved.
Smart Images

Figure CN119343698A_ABST
Abstract
Description
Method and device for determining point coordinates in an image, and corresponding equipment and medium Technical Field
[0001] The present invention generally relates to the field of image processing, and in particular to a method for determining the coordinates of points in an image, and corresponding apparatuses, computer devices, and storage media. Background Art
[0002] Line detection has developed along with the development of digital image processing and has been widely used in many fields such as scientific research, industrial and agricultural production, military technology, medical care, etc.
[0003] Existing line detection algorithms fall into three categories: the Hough line detection algorithm, the Freeman line detection algorithm, and the Inchworm crawling algorithm. These classic algorithms are widely used in many fields and have significantly contributed to social development. However, these algorithms do not address all human needs. For example, in certain specific areas, they fail to meet the requirements for accuracy and efficiency.
[0004] Existing algorithms for locating line intersections often rely on image enhancement methods, using the Hough transform to find line parameters and then calculating the intersection coordinates based on the intersection formula. Because most existing methods for locating dark line intersections in images are based on the Hough transform, they suffer from poor stability and low accuracy.
[0005] Summary of the Invention
[0006] The purpose of the present invention is to propose a solution to at least partially solve or alleviate the above-mentioned problems in the prior art.
[0007] According to a first aspect of the present invention, a method for determining the coordinates of a point in an image is provided, wherein an image plane in which the image is located includes a first direction and a second direction perpendicular to the first direction, and the image includes a plurality of first straight track lines transverse to the second direction and a plurality of second straight track lines transverse to the first direction.
[0008] The method for determining the coordinates of a point in the image includes:
[0009] Sampling steps include:
[0010] Apply a first sampling strip to perform equally spaced sampling of the image in the first direction along the first direction to determine a first set of candidate points, wherein for each equally spaced sampling in the first direction, perform the following sub-steps:
[0011] - performing cumulative summation of pixel values of pixels within the sampling area of the image selected by the first sampling strip during the first direction equally spaced sampling to obtain a series of first pixel value sums; and
[0012] - determining extreme points of the series of first pixel value sums, and for each determined extreme point: determining a corresponding first candidate point obtained by the first-direction equally-interval sampling, wherein the coordinates of the corresponding first candidate point in the second direction are the coordinates of the second-direction position corresponding to the extreme point in the second direction, and the coordinates of the corresponding first candidate point in the first direction are determined based on the position of the first sampling strip in the first direction during the first-direction equally-interval sampling.
[0013] The first candidate point set is formed by first candidate points obtained by sampling in the first direction at equal intervals each time;
[0014] Apply a second sampling strip to perform equally spaced sampling of the image in the second direction along the second direction to determine a second set of candidate points, wherein for each equally spaced sampling in the second direction, perform the following sub-steps:
[0015] - performing pixel value accumulation and summation on the pixels within the sampling area of the image selected by the second sampling strip during the second direction equally spaced sampling to obtain a series of second pixel value sums; and
[0016] - determining extreme points of the series of second pixel value sums, and for each determined extreme point: determining a corresponding second candidate point obtained by the second-direction equally-interval sampling, wherein the coordinates of the corresponding second candidate point in the first direction are the coordinates of the first-direction position corresponding to the extreme point in the first direction, and the coordinates of the corresponding second candidate point in the second direction are determined based on the position of the second sampling strip in the second direction during the second-direction equally-interval sampling.
[0017] The second candidate point set is formed by the second candidate points obtained by sampling in the second direction at equal intervals each time;
[0018] The grouping steps include:
[0019] dividing the first candidate points in the first candidate point set into a plurality of first candidate point groups; and
[0020] dividing the second candidate points in the second candidate point set into a plurality of second candidate point groups;
[0021] The straight line fitting steps include:
[0022] Performing straight line fitting on the first candidate point in each first candidate point group to obtain a corresponding first straight line analytical expression; and
[0023] Performing straight line fitting on the second candidate points in each second candidate point group to obtain a corresponding second straight line analytical expression; and
[0024] Coordinate calculation steps include:
[0025] Calculate the coordinates of the intersection of each first straight line analytical expression and each second straight line analytical expression.
[0026] According to a second aspect of the present invention, there is provided an apparatus for determining coordinates of a point in an image, comprising a processor, wherein the processor is configured to execute computer instructions to cause the above-mentioned determination method according to the present invention to be executed.
[0027] According to a third aspect of the present invention, a computer device is provided, comprising a memory and a processor, wherein the memory stores computer instructions executable by the processor, and when the computer instructions are executed by the processor, the above-mentioned determination method of the present invention is executed.
[0028] According to a fourth aspect of the present invention, a non-transitory computer-readable storage medium is provided, on which computer instructions are stored. When the computer instructions are executed by a processor, the above-mentioned determination method according to the present invention is executed.
[0029] The present invention provides an improved technical solution for determining the coordinates of points in an image, which has the advantages of strong stability and high precision. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The present invention will now be described by way of non-limiting example embodiments only with reference to the accompanying drawings, in which:
[0031] FIG1 shows a flow chart of a method for determining point coordinates in an image according to an embodiment of the present invention;
[0032] FIG2 shows an example image to which the present invention is applicable, wherein a single equally spaced sampling using an example second sampling strip is shown;
[0033] FIG3 a shows a graph of the pixel values and obtained by sampling the pixels at equal intervals as shown in FIG2 ;
[0034] FIG3 b shows an enlarged view of the V-shaped feature circled in FIG3 a ;
[0035] FIG4 is a schematic diagram showing relevant details of the equally spaced sampling shown in FIG2 ;
[0036] FIG5 is a schematic diagram showing a method for obtaining the Y coordinate of a candidate point according to an embodiment of the present invention;
[0037] FIG6 shows an example image and related details to which the present invention is applicable;
[0038] FIG7 is a schematic diagram showing filtering the second candidate point set to filter out falsely detected points according to an embodiment of the present invention;
[0039] FIG8 shows an example image showing an abnormal condition; and
[0040] FIG. 9 shows a schematic diagram of determining the coordinates of points in an image with abnormal conditions. DETAILED DESCRIPTION
[0041] In order to make the above and other features and advantages of the present invention more clear, the present invention is further described below with reference to the accompanying drawings. It should be understood that the specific embodiments given herein are for the purpose of explaining to those skilled in the art and are only exemplary and not restrictive.
[0042] The features described herein may be embodied in different forms and should not be construed as limited to the examples described herein. Rather, the embodiments described herein are provided merely to illustrate some of the many possible ways of implementing the apparatus, methods, and / or devices described herein, which will be apparent upon understanding the disclosure of this application.
[0043] As used herein, the term "and / or" includes any one of the associated listed items and any combination of any two or more of the associated listed items.
[0044] Although terms such as "first," "second," and "third" may be used herein to describe various components, parts, portions, or elements, these components, parts, portions, or elements are not limited by these terms. Rather, these terms are used merely to distinguish one component, part, portion, or element from another component, part, portion, or element. Thus, a first component, part, portion, or element referred to herein may also be referred to as a second component, part, portion, or element without departing from the teachings of the present invention.
[0045] The terms used in this document are only used to describe various embodiments and are not intended to limit the present disclosure. Unless the context clearly indicates otherwise, "a", "an", and "the" are intended to include plural forms as well. The terms "include", "comprising", and "having" specify the presence of stated features, operations, components, elements, and / or combinations thereof, but do not preclude the presence or addition of one or more other features, operations, components, elements, and / or combinations thereof.
[0046] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention belongs. The terms used herein are only for the purpose of describing specific embodiments and are not intended to limit the embodiments of the present invention.
[0047] 1 shows a flow chart of a method 100 for determining point coordinates in an image according to an embodiment of the present invention. The method 100 may include a sampling step 1001 , a grouping step 1002 , a straight line fitting step 1003 , and a coordinate calculation step 1004 .
[0048] To facilitate understanding of the determination method of the present invention, the image involved in this article is now exemplified with reference to FIG2 . FIG2 shows an example image to which the present invention is applicable. The image can be acquired by a camera, an image sensor, or the like. The image can be an image of a mechanical structure, a carrier, a slide, or a biochip, for example, having straight track lines. As shown in FIG2 , the image plane in which the image is located may include a first direction X and a second direction Y perpendicular to the first direction X, and the image includes a plurality of first straight track lines transverse to the second direction Y (i.e., a plurality of dark lines in the image that are substantially parallel to the first direction X) and a plurality of second straight track lines transverse to the first direction X (i.e., a plurality of dark lines in the image that are substantially parallel to the second direction Y). Specifically, there are 6 first straight track lines and 8 second straight track lines in the example image. Since each first straight track line intersects with each second straight track line, there are a total of 6×8=48 intersection points in the example image. As shown in FIG2 , the image can have a pixel length L and a pixel width W. An example second sampling strip is also shown in FIG2 . As an example and not a limitation, the pixel length of the sampling bar is the same as the pixel length of the example image, that is, L, and the pixel width of the sampling bar is less than the pixel width of the example image, that is, W2. In this article, a straight track line transverse to any direction means that the straight track line is parallel to the direction perpendicular to the any direction or the angle between the straight track line and the direction perpendicular to the any direction is less than a preset value. The range of the preset value may include 1 to 10 degrees, 10 to 20 degrees, 20 to 30 degrees, 30 to 40 degrees or 40 to 50 degrees, etc. For example, the preset value may be 1 degree, 2 degrees, 3 degrees, 4 degrees, 5 degrees, 6 degrees, 7 degrees, 8 degrees, 9 degrees, 10 degrees.
[0049] The sampling step 1001 includes a first direction sampling step and a second direction sampling step.
[0050] In the first direction sampling step, a first sampling strip is used to perform first-direction equally spaced sampling of the image along the first direction to determine a first set of candidate points. For each first-direction equally spaced sampling, the following first-direction sampling sub-steps 1 and 2 are performed. The first direction sampling sub-step 1 includes accumulating pixel values along the first direction for pixels within a sampling region of the image selected by the first sampling strip during the first-direction equally spaced sampling period to obtain a series of first pixel value sums. The value of the series of first pixel value sums at any second-direction position in the second direction is equal to the sum of the pixel values of pixels within the sampling region aligned along the first direction at that second-direction position. The first direction sampling sub-step 2 includes determining extreme points of the series of first pixel value sums, and for each extreme point determined, determining a corresponding first candidate point obtained by the first-direction equally spaced sampling period. The coordinates of the corresponding first candidate point in the second direction are the coordinates of the second-direction position corresponding to the extreme point in the second direction. The coordinates of the corresponding first candidate point in the first direction are determined based on the position of the first sampling strip in the first direction during the first-direction equally spaced sampling period. In this way, the first candidate points obtained by sampling in the first direction at equal intervals each time form the first candidate point set.
[0051] In the second direction sampling step, a second sampling strip is used to perform second-direction equally spaced sampling of the image along the second direction to determine a second set of candidate points. For each second-direction equally spaced sampling, the following second-direction sampling sub-steps 1 and 2 are performed. The first second-direction sampling sub-step comprises: accumulating pixel values along the second direction for pixels within the sampling region of the image selected by the second sampling strip during the second-direction equally spaced sampling period to obtain a series of second pixel value sums, wherein the value of the series of second pixel value sums at any first-direction position in the first direction is equal to the sum of the pixel values of pixels within the sampling region aligned along the second direction at that first-direction position. The second second-direction sampling sub-step 2 comprises: determining extreme points of the series of second pixel value sums, and for each extreme point determined, determining a corresponding second candidate point obtained by the second-direction equally spaced sampling. The coordinates of the corresponding second candidate point in the first direction are the coordinates of the first-direction position corresponding to the extreme point in the first direction. The coordinates of the corresponding second candidate point in the second direction are determined based on the position of the second sampling strip in the second direction during the second-direction equally spaced sampling period. In this way, the second candidate points obtained by sampling in the second direction at equal intervals each time form the second candidate point set.
[0052] All extreme value points used in the sampling step 1001 may be the same maximum value point or the same minimum value point. For example, if the straight track line is a dark line, all extreme value points used may be the same minimum value point; if the straight track line is a bright line, all extreme value points used may be the same maximum value point.
[0053] In the grouping step 1002 , the first candidate points in the first candidate point set are divided into a plurality of first candidate point groups; and the second candidate points in the second candidate point set are divided into a plurality of second candidate point groups.
[0054] In one embodiment, the first candidate points in the first candidate point set are divided into a plurality of first candidate point groups using a first grouping method, wherein the first grouping method is configured such that the first candidate points in each first candidate point group are substantially arranged in a straight line transverse to the second direction. Furthermore, the second candidate points in the second candidate point set are divided into a plurality of second candidate point groups using a second grouping method, wherein the second grouping method is configured such that the second candidate points in each second candidate point group are substantially arranged in a straight line transverse to the first direction.
[0055] In the line fitting step 1003 , a line fitting is performed on the first candidate point in each first candidate point group to obtain a corresponding first line analytical expression; and a line fitting is performed on the second candidate point in each second candidate point group to obtain a corresponding second line analytical expression.
[0056] Performing linear fitting based on multiple points with known coordinates to obtain a linear expression is well known in the art and will not be described in detail here. Common linear fitting methods include: least squares method; gradient descent method; Gauss-Newton method and Lev-Massachusetts method.
[0057] In the coordinate calculation step 1004 , the coordinates of the intersection points of each first straight line analytical expression and each second straight line analytical expression are calculated.
[0058] The method of finding the coordinates of the intersection point of two known straight line analytical expressions is well known in the art and will not be described in detail here.
[0059] Preferably, in one embodiment, the straight line fitting step 1003 further includes the following steps: calculating the average of the slopes of the obtained first straight line analytical expressions as a first slope k1, replacing the slope in each of the first straight line analytical expressions with the first slope k1 to obtain a corresponding optimized first straight line analytical expression; and calculating the average of the slopes of the obtained second straight line analytical expressions as a second slope k2, replacing the slope in each of the second straight line analytical expressions with the second slope k2 to obtain a corresponding optimized second straight line analytical expression. In this case, the coordinates of the intersection of each first straight line analytical expression and each second straight line analytical expression calculated in the coordinate calculation step 1003 specifically include: calculating the coordinates of the intersection of each optimized first straight line analytical expression and each optimized second straight line analytical expression.
[0060] Further preferably, in one embodiment, the straight line fitting step 1003 further includes the following steps: calculating the average value k3 of k1 and -1 / k2; replacing the first slope k1 in each of the optimized first straight line analytical expressions with k3 to obtain a corresponding further optimized first straight line analytical expression; and replacing the second slope k2 in each of the optimized second straight line analytical expressions with -1 / k3 to obtain a corresponding further optimized second straight line analytical expression. In this case, calculating the coordinates of the intersection of each optimized first straight line analytical expression and each optimized second straight line analytical expression in the coordinate calculation step 1003 specifically includes: calculating the coordinates of the intersection of each further optimized first straight line analytical expression and each further optimized second straight line analytical expression.
[0061] The above step 1001 and its sub-steps will be described in further detail below with reference to FIG. 2 to FIG. 5 .
[0062] Referring to Figure 2, a second sampling strip is shown when performing a second direction equally spaced sampling (assuming it is the n2th second direction equally spaced sampling) in the second direction Y. The second sampling strip is represented by the white line frame in Figure 2. The second sampling strip has a pixel width W2. W2 can be an empirical value, for example, it can be 100 pixels by default. For example, the process of performing equally spaced sampling in the second direction Y can be that the second sampling strip traverses the example image starting from the lower edge of the example image. By applying the second sampling strip to perform equally spaced sampling in the second direction Y in a manner of traversing the example image, an example second candidate point set (hereinafter referred to as the second candidate point set P2) will be obtained.
[0063] Figure 3a shows a series of second pixel value sums obtained for the n2th equally spaced sampling shown in Figure 2, shown here as a second pixel value sum curve. Referring to Figure 4, this pixel value sum curve is obtained by cumulatively summing the pixel values (here, grayscale values) within a region of the example image selected by the second sampling strip shown in Figure 2 in the second direction Y, obtaining a series of second pixel value sums, and then performing curve fitting on these sums. It will be appreciated that, under ideal conditions (as opposed to the general or non-ideal conditions described below), since the multiple second straight traces are dark lines, cumulatively summing the pixel values within the sampling region selected by the second sampling strip in the second direction Y can yield a corresponding number of minimum values. Specifically, since there are eight second straight traces in the example image shown in Figure 2, there are eight minimum points on the pixel value sum curves shown in Figures 3a and 4, each of which appears as a V-shaped trough in the pixel value sum curves shown in Figures 3a and 4. A V-shaped feature is indicated by a circle in Figure 3a. Figure 3b shows an enlarged view of the V-shaped feature circled in Figure 3a. Based on these eight minimum points, eight candidate points (second candidate points) are determined. The X coordinate of each of these eight candidate points can be read from the pixel values and curve shown in Figure 3a. The Y coordinate of each of these eight candidate points can be determined based on the position of the second sampling strip in the second direction during the n2th equally spaced sampling in the second direction. In particular, referring to Figure 5, the Y coordinate of each of the eight candidate points can be determined based on the position of the centerline of the second sampling strip in the second direction. If the second sampling strip is a rectangular sampling strip as shown in Figure 2, the coordinate of each second candidate point in the second direction Y is determined based on the coordinate (e.g., Yc) in the second direction Y of a corner of the second sampling strip (e.g., the upper left corner shown in Figure 5) during the n2th equally spaced sampling in the second direction and half the pixel width W2 of the second sampling strip, which is equal to (Yc-W2 / 2). Thus, the coordinates (X, Y) of each second candidate point can be determined.
[0064] For the example image shown in Figure 2, the process of applying the first sampling bar to perform equally spaced sampling in the first direction X in a manner of traversing the image to obtain a first set of candidate points (hereinafter referred to as the first candidate point set P1) is similar to the process of applying the second sampling bar to perform equally spaced sampling in the second direction Y in a manner of traversing the image to obtain a second set of candidate points P2. Therefore, for the sake of simplicity, it is not shown in the figure.
[0065] Assume that the pixel width (i.e., the width in the first direction) of the first sampling strip (not shown) used is W1. W1 can also be an empirical value and can be equal to or different from W2. The process of performing equally spaced sampling in the first direction X is to traverse the example image with the first sampling strip starting from the left edge of the example image. By applying the first sampling strip to perform equally spaced sampling in the first direction X in a manner that traverses the example image, an example first candidate point set P1 is obtained.
[0066] Since there are six first straight lines in this example image, it can be understood that, under ideal conditions (as opposed to the general or non-ideal conditions described below), for a single equally spaced sampling in the first direction X (assuming the n1th equally spaced sampling), accumulating and summing pixel values yields a curve with six minimum points. Based on these six minimum points, six candidate points (first candidate points) are determined. The Y coordinate of each of these six candidate points can be read from the resulting pixel values and curve. The X coordinate of each of these six candidate points can be determined based on the position of the first sampling strip in the first direction during the n1th equally spaced sampling in the first direction, specifically based on the position of the centerline of the first sampling strip in the first direction. If the first sampling strip is a rectangular sampling strip, the coordinates of each first candidate point in the first direction X are determined based on the coordinates of a corner of the first sampling strip in the first direction X during the n1th equally spaced sampling in the first direction and half the pixel width W1 of the first sampling strip. Thus, the coordinates (X, Y) of each first candidate point can be determined.
[0067] However, due to the influence of various physical conditions and background noise (for biochips, tissue regions and stain regions) during the sampling process, the resulting set of candidate points may contain points that should not be candidates, such as points that are not on the straight track (false detection points) or points that are on the straight track but not detected by sampling (missed detection points). Figure 6 shows an example image and its associated tissue regions, stain regions, normal points, false detection points, missed detection points, and track lines.
[0068] In one embodiment, preferably, the method for determining the coordinates of a point in an image of the present invention may include a filtering step. The filtering step includes: filtering the first candidate point set in a first filtering manner to obtain a filtered first candidate point set, and filtering the second candidate point set in a second filtering manner to obtain a filtered second candidate point set. In one embodiment, the first filtering manner is configured such that, in the filtered first candidate point set, the angle between a line connecting any first candidate point from a sampling area selected by any first-direction equally-interval sampling and the corresponding first candidate point closest to it from another sampling area selected by the first direction equally-interval sampling satisfies a first predetermined angle condition relative to the first direction, and the second filtering manner is configured such that, in the filtered second candidate point set, the angle between a line connecting any second candidate point from a sampling area selected by any second-direction equally-interval sampling and the corresponding second candidate point closest to it from another sampling area selected by the second direction equally-interval sampling satisfies a second predetermined angle condition relative to the second direction. In another embodiment, the first filtering method is configured such that, for each first candidate point from the sampling area selected by any first-direction equally-interval sampling: the nearest adjacent first candidate point from the sampling area selected by another first-direction equally-interval sampling and adjacent to the first candidate point is determined, and the line between the first candidate point and the corresponding nearest adjacent first candidate point is determined; whether the angle of the line between the first candidate point and the nearest adjacent first candidate point relative to the first direction satisfies a first predetermined angle condition, and if the judgment result is negative, the first candidate point is filtered out; and the second filtering method is configured such that, for each second candidate point from the sampling area selected by any second-direction equally-interval sampling: the nearest adjacent second candidate point from the sampling area selected by another second-direction equally-interval sampling and adjacent to the first candidate point is determined, and the line between the first candidate point and the corresponding nearest adjacent second candidate point is determined; whether the angle of the line between the second candidate point and the nearest adjacent second candidate point relative to the second direction satisfies a second predetermined angle condition, and if the judgment result is negative, the second candidate point is filtered out.In another embodiment, the filtering step includes: for any first candidate point sampled at equal intervals in any first direction, determining the target first candidate point closest to any first candidate point from multiple first candidate points sampled at equal intervals in another first direction; calculating the first angle of the line connecting any first candidate point and the target first candidate point relative to the first direction or the line connecting another first candidate point sampled at equal intervals in any first direction and its corresponding another target first candidate point; if the first angle does not meet the first predetermined angle condition, filtering out any first candidate point; and, for any second candidate point sampled at equal intervals in any second direction, determining the target second candidate point closest to any second candidate point from multiple second candidate points sampled at equal intervals in another second direction; calculating the second angle of the line connecting any second candidate point and the target second candidate point relative to the second direction or the line connecting another second candidate point sampled at equal intervals in any second direction and its corresponding another target second candidate point; if the second angle does not meet the second predetermined angle condition, filtering out any second candidate point. In other words, in this further embodiment, the first angle can be an angle relative to the first direction, or can be the angle between the lines between multiple first candidate points sampled at equal intervals in the first direction at any time and their respective corresponding target candidate points; and similarly, the second angle can be an angle relative to the second direction, or can be the angle between the lines between multiple second candidate points sampled at equal intervals in the second direction at any time and their respective corresponding target candidate points.
[0069] The filtering step may be performed after the sampling step and before the grouping step. False detection points can be filtered out through the filtering step, thereby improving calculation accuracy.
[0070] In one embodiment, the first predetermined angle condition includes a deviation from a first expected tilt angle of no more than a first angle threshold; the second predetermined angle condition includes a deviation from a second expected tilt angle of no more than a second angle threshold, wherein the first expected tilt angle and the second expected tilt angle are the same or different, and the first angle threshold and the second angle threshold are the same or different. When the first angle is the angle of a line connecting any first candidate point and the target first candidate point relative to the first direction, the first expected tilt angle corresponds to the angle relative to the first direction; when the second angle is the angle of a line connecting any second candidate point and the target second candidate point relative to the second direction, the second expected tilt angle corresponds to the angle relative to the second direction. When the first angle is the angle between lines connecting a plurality of first candidate points sampled at equal intervals in the first direction and their respective corresponding target candidate points, the first expected tilt angle corresponds to the angle between any two of these lines; when the second angle is the angle between lines connecting a plurality of second candidate points sampled at equal intervals in the second direction and their respective corresponding target candidate points, the second expected tilt angle corresponds to the angle between any two of these lines.
[0071] The filtering step will be further described below by way of example with reference to FIG6 and FIG7.
[0072] By traversing the sample image in the second direction Y using a second sampling strip, sampling is performed at equal intervals, ultimately determining the second candidate point set P2. As described above, due to the various physical conditions and the influence of background noise (tissue and stain regions) during the sampling process, the second candidate point set P2 contains false positives, missed positives, and normal points, as shown in FIG6 . Therefore, the number of minimum values obtained by accumulating and summing pixel values in the second direction Y for pixels within the sampling area will be greater than the number of the plurality of second straight trajectory lines. False positives will directly affect the accuracy of subsequent straight line fitting.
[0073] The following will describe the process of filtering the second candidate point set according to the second predetermined angle condition to filter out false positive points with reference to FIG7. The inclination angle β of the second straight trajectory line is used here as the second predetermined angle condition. As an example, specifically, first, for all candidate points in the current sampling strip, the candidate points closest to them are found among all candidate points in its adjacent sampling strips, so that multiple candidate point pairs can be obtained; secondly, since the inclination angle of the straight line formed by the lines connecting the candidate point pairs on the same second straight trajectory line in the image coordinate system must be similar to the inclination angle β, the false positive points can be filtered out by excluding the candidate point pairs whose inclination angles of the straight lines formed by the lines connecting the candidate point pairs are inconsistent. In this way, the second candidate point set P2 will become smaller and become the filtered second candidate point set, which is represented by P in this article.20 Similarly, the first candidate point set P1 can be filtered to become smaller and become the filtered first candidate point set, which is represented by P in this paper. 10 express.
[0074] In one embodiment, the method for determining the coordinates of points in an image of the present invention may include a determination step after the sampling step and before the filtering step. In the determination step, it is determined whether the number of first candidate points in the first candidate point set is greater than a first threshold number, and whether the number of second candidate points in the second candidate point set is greater than a second threshold number; and only if the determination results are negative, the filtering step, the grouping step, the straight line fitting step, and the coordinate calculation step are performed.
[0075] Causes of an abnormal number of candidate points (e.g., an excessive number) include image noise, such as salt and pepper noise; scratches, stains, and water droplets on the biochip are also potential contributing factors. Excessive numbers of candidate points can significantly increase algorithm runtime and, in severe cases, cause the algorithm to become chronically blocked; they can also increase the probability of algorithm errors. Therefore, the aforementioned judgment step can advantageously mitigate issues caused by an excessive number of candidate points.
[0076] In one embodiment, the first candidate points in the first candidate point set are divided into multiple first candidate point groups so that the angle of the line between any two first candidate points divided into the same first candidate point group relative to the first direction meets the first predetermined angle tolerance requirement; and the second candidate points in the second candidate point set are divided into multiple second candidate point groups so that the angle of the line between any two second candidate points divided into the same second candidate point group relative to the second direction meets the second predetermined angle tolerance requirement.
[0077] In one embodiment, the first predetermined angle tolerance requirement includes not deviating from a first expected tilt angle by more than a first angle tolerance; the second predetermined angle tolerance requirement includes not deviating from a second expected tilt angle by more than a second angle tolerance. The first expected tilt angle and the second expected tilt angle may be the same or different, and the first angle tolerance and the second angle tolerance may be the same or different.
[0078] The principle of grouping candidate points is described below. The idea of angle filtering is also applied to group candidate points. Specifically, the second candidate point set P2 (or the filtered second candidate point set P 20 ) and the second candidate point set P2 (or the filtered second candidate point set P 20) and calculate the angles of these lines relative to the second direction. For each angle that meets the first predetermined angle tolerance requirement, the candidate points involved in forming such an angle are grouped together, and then the candidate points that have been grouped together are removed from the second candidate point set P2 (or the filtered second candidate point set P 20 ) is removed, and then the second candidate point set P2 (or the filtered second candidate point set P 20 ) and perform the same operation on the remaining candidate points until the second candidate point set P2 (or the filtered second candidate point set P 20 ) is empty. In this way, a subset of candidate points on each of the plurality of second straight trajectory lines can be determined. Similarly, a subset of candidate points on each of the plurality of first straight trajectory lines can be determined.
[0079] Fig. 8 shows an example image with abnormal conditions. As shown in Fig. 8 , there are fewer dark lines and fewer dark line intersections on the example image, such as the intersections marked with white boxes.
[0080] For the example image with an abnormal condition, as shown in FIG8 , the present invention proposes processing the image through a corresponding process for determining the coordinates of points in the abnormal image. In one embodiment, the method for determining the coordinates of points in an image of the present invention further includes: identifying whether an abnormal condition exists before performing the sampling step; and, if the identification result is positive, performing a process for determining the coordinates of points in the abnormal image, wherein the sampling step and the steps subsequent to the sampling step are performed only if the identification result is negative. The process for determining the coordinates of points in the abnormal image includes, via a trained object detection network: identifying intersections in the image; marking each identified intersection with a rectangular frame such that the rectangular frame is centered on the intersection; and calculating the coordinates of each identified intersection based on the size and position of the rectangular frame. Referring to FIG9 , the intersections are marked with white squares, with the center of the squares coinciding with the intersections. The coordinates of each identified intersection are calculated based on the size and position of the rectangular frame.
[0081] Here, the object detection network can be any network suitable for object detection, including existing object detection networks and lightweight detection networks. The object detection network can be based on a supervised learning method. A lightweight detection network refers to a network with a smaller number of backbone parameters. While the performance of such a network is lower than that of a larger network, it has faster inference speed and consumes less computing resources.
[0082] The method for determining the coordinates of a point in an image of the present invention can be applied to an image with abnormal conditions, as exemplified in FIG8 , or to a general image, as exemplified in FIG2 .
[0083] The present invention also provides an apparatus for determining the coordinates of a point in an image. The aspects, steps, operations, details, and elements described above with respect to the determination method of the present invention may be applied to the determination apparatus of the present invention. Specifically, the determination apparatus of the present invention includes a processor configured to execute computer instructions to cause any one of the steps and operations described above with respect to the method for determining the coordinates of a point in an image of the present invention, or any suitable combination thereof, to be performed.
[0084] The present invention also provides a computer device, which includes a memory and a processor, wherein the memory stores computer instructions executable by the processor, and when the computer instructions are executed by the processor, the processor is instructed to perform the steps of the determination method of the present invention. The computer device can be broadly defined as a server, a terminal, or any other electronic device with the necessary computing and / or processing capabilities. In one embodiment, the computer device may include a processor, a memory, a network interface, a communication interface, etc. connected via a system bus. The processor of the computer device can be used to provide the necessary computing, processing, and / or control capabilities. The memory of the computer device may include a non-volatile storage medium and an internal memory. An operating system, a computer program, etc. may be stored in or on the non-volatile storage medium. The internal memory can provide an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface and the communication interface of the computer device can be used to connect to and communicate with external devices via a network. When the computer program is executed by the processor, the steps of the determination method of the present invention are performed.
[0085] The present invention can be implemented as a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, cause the steps of the determination method of the present invention to be performed. In one embodiment, the computer instructions are distributed across a plurality of network-coupled computer devices or processors so that the computer instructions are stored, accessed, and executed in a distributed manner by one or more computer devices or processors. A single method step / operation, or two or more method steps / operations, can be performed by a single computer device or processor or by two or more computer devices or processors. One or more method steps / operations can be performed by one or more computer devices or processors, and one or more other method steps / operations can be performed by one or more other computer devices or processors. One or more computer devices or processors can perform a single method step / operation, or perform two or more method steps / operations.
[0086] It will be understood by those skilled in the art that all or part of the steps for program operation of the present invention can be performed by computer instructions to instruct relevant hardware such as computer equipment or processors, and the computer instructions can be stored in a non-transitory computer-readable storage medium, which causes the steps for program operation of the present invention to be executed when the computer instructions are executed. Depending on the circumstances, any reference to memory, storage, database or other media herein may include non-volatile and / or volatile memory. Examples of non-volatile memory include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory, magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state disk, etc. Examples of volatile memory include random access memory (RAM), external cache memory, etc.
[0087] The various technical features described above can be combined arbitrarily. Although not all possible combinations of these technical features are described, any combination of these technical features should be considered to be covered by this specification as long as such combination does not conflict.
[0088] Although the present invention has been described in conjunction with the embodiments, it should be understood by those skilled in the art that the above description and the accompanying drawings are only exemplary and non-restrictive, and the present invention is not limited to the disclosed embodiments. Various modifications and variations are possible without departing from the spirit of the present invention.
Claims
1. A method for determining the coordinates of a midpoint in an image, wherein an image plane includes a first direction and a second direction perpendicular to the first direction, and the image includes a plurality of first straight lines transverse to the second direction and a plurality of second straight lines transverse to the first direction. The method for determining the coordinates of a point in the image includes: Sampling steps include: Apply a first sampling strip to perform equally spaced sampling of the image in the first direction along the first direction to determine a first set of candidate points, wherein for each equally spaced sampling in the first direction, perform the following sub-steps: - performing cumulative summation of pixel values of pixels within the sampling area of the image selected by the first sampling strip during the first direction equally spaced sampling to obtain a series of first pixel value sums; and - determining extreme points of the series of first pixel value sums, and for each determined extreme point: determining a corresponding first candidate point obtained by the first-direction equally-interval sampling, wherein the coordinates of the corresponding first candidate point in the second direction are the coordinates of the second-direction position corresponding to the extreme point in the second direction, and the coordinates of the corresponding first candidate point in the first direction are determined based on the position of the first sampling strip in the first direction during the first-direction equally-interval sampling. The first candidate point set is formed by first candidate points obtained by sampling in the first direction at equal intervals each time; Apply a second sampling strip to perform equally spaced sampling of the image in the second direction along the second direction to determine a second set of candidate points, wherein for each equally spaced sampling in the second direction, perform the following sub-steps: - performing pixel value accumulation and summation on the pixels within the sampling area of the image selected by the second sampling strip during the second direction equally spaced sampling to obtain a series of second pixel value sums; and - determining extreme points of the series of second pixel value sums, and for each determined extreme point: determining a corresponding second candidate point obtained by the second-direction equally-interval sampling, wherein the coordinates of the corresponding second candidate point in the first direction are the coordinates of the first-direction position corresponding to the extreme point in the first direction, and the coordinates of the corresponding second candidate point in the second direction are determined based on the position of the second sampling strip in the second direction during the second-direction equally-interval sampling. The second candidate point set is formed by the second candidate points obtained by sampling in the second direction at equal intervals each time; The grouping steps include: dividing the first candidate points in the first candidate point set into a plurality of first candidate point groups; and dividing the second candidate points in the second candidate point set into a plurality of second candidate point groups; The straight line fitting steps include: Performing straight line fitting on the first candidate point in each first candidate point group to obtain a corresponding first straight line analytical expression; and Performing straight line fitting on the second candidate points in each second candidate point group to obtain a corresponding second straight line analytical expression; and Coordinate calculation steps include: Calculate the coordinates of the intersection of each first straight line analytical expression and each second straight line analytical expression.
2. The determination method according to claim 1, wherein the method for determining the coordinates of a point in the image further comprises: The filtering step before the straight line fitting step includes: For any first candidate point sampled at equal intervals in any first direction, determine a target first candidate point closest to the first candidate point from a plurality of first candidate points sampled at equal intervals in another first direction; calculate a first angle between a line connecting the first candidate point and the target first candidate point and a line connecting another first candidate point sampled at equal intervals in the first direction or another first candidate point sampled at equal intervals in the first direction and its corresponding target first candidate point; if the first angle does not satisfy a first predetermined angle condition, filter out the first candidate point; and For any second candidate point sampled at equal intervals in any second direction, determine the target second candidate point closest to the any second candidate point from multiple second candidate points sampled at equal intervals in another second direction; calculate the second angle of the line connecting the any second candidate point and the target second candidate point relative to the second direction or the line connecting another second candidate point sampled at equal intervals in any second direction and its corresponding another target second candidate point; if the second angle does not meet the second predetermined angle condition, filter out the any second candidate point.
3. The determination method according to claim 2, wherein: The first predetermined angle condition includes a deviation from a first expected tilt angle not exceeding a first angle threshold; The second predetermined angle condition includes a deviation from the second expected tilt angle not exceeding a second angle threshold, The first expected tilt angle and the second expected tilt angle are the same or different, and the first angle threshold and the second angle threshold are the same or different.
4. The determination method according to claim 1 or 2, wherein: Dividing the first candidate points in the first candidate point set into a plurality of first candidate point groups such that an angle between any two first candidate points divided into the same first candidate point group and the first direction satisfies a first predetermined angle tolerance requirement; and The second candidate points in the second candidate point set are divided into a plurality of second candidate point groups so that an angle between a line between any two second candidate points divided into the same second candidate point group and the second direction meets a second predetermined angle tolerance requirement.
5. The determination method according to claim 4, wherein: The first predetermined angle tolerance requirement includes a deviation from the first expected tilt angle not exceeding a first angle tolerance; The second predetermined angle tolerance requirement includes that the deviation from the second expected tilt angle does not exceed the second angle tolerance, The first expected tilt angle and the second expected tilt angle are the same or different, and the first angle tolerance and the second angle tolerance are the same or different.
6. The determination method according to claim 1 or 2, wherein the straight line fitting step further comprises: Calculating an average of the slopes of the first straight line analytical expressions as a first slope k1, and replacing the slope in each of the first straight line analytical expressions with the first slope k1 to obtain a corresponding optimized first straight line analytical expression; as well as Calculating the average of the slopes of the respective second straight line analytical expressions as a second slope k2, and replacing the slope in each of the second straight line analytical expressions with the second slope k2 to obtain a corresponding optimized second straight line analytical expression, Wherein in the coordinate calculation step: Calculating the coordinates of the intersection of each first straight line analytical expression and each second straight line analytical expression includes calculating the coordinates of the intersection of each optimized first straight line analytical expression and each optimized second straight line analytical expression.
7. The determination method according to claim 6, wherein the straight line fitting step further comprises: Calculate the average value k3 of k1 and -1 / k2; Replacing the first slope k1 in each of the optimized first straight line analytical expressions with k3 to obtain a corresponding further optimized first straight line analytical expression; as well as Substituting the second slope k2 in each of the optimized second straight line analytical expressions with -1 / k3 to obtain a corresponding further optimized second straight line analytical expression, Wherein in the coordinate calculation step: Calculating the coordinates of the intersection of each optimized first straight line analytical expression and each optimized second straight line analytical expression includes calculating the coordinates of the intersection of each further optimized first straight line analytical expression and each further optimized second straight line analytical expression.
8. The determination method according to claim 2, wherein the method for determining the coordinates of a point in the image further comprises: After the sampling step and before the filtering step, determining whether the number of first candidate points in the first candidate point set is greater than a first number threshold and determining whether the number of second candidate points in the second candidate point set is greater than a second number threshold; as well as The filtering step, the grouping step, the straight line fitting step and the coordinate calculation step are performed only when the judgment results are all negative.
9. The determination method according to claim 1 or 2, wherein: The first sampling strip and the second sampling strip are rectangular sampling strips; The coordinates of the corresponding first candidate point in the first direction are determined based on the coordinates of a corner of the first sampling strip in the first direction during the first direction equally spaced sampling and half of the pixel width of the first sampling strip; and The coordinates of the corresponding second candidate point in the second direction are determined based on the coordinates of a corner of the second sampling strip in the second direction during the second direction equally spaced sampling and half the pixel width of the second sampling strip.
10. The determination method according to claim 1 or 2, further comprising: Before the sampling step, identifying whether an abnormal condition exists; and, if the recognition result is positive, performing a process for determining the coordinates of points in the abnormal image, wherein the sampling step and steps subsequent to the sampling step are performed only if the recognition result is negative, the process for determining the coordinates of points in the abnormal image comprising, via a trained object detection network: identifying intersection points in the image; Mark each identified intersection with a rectangular box so that, for each identified intersection, the rectangular box marking it is centered on the intersection; For each identified intersection, its coordinates are calculated based on the size and position of the rectangular box marking it.
11. The determination method according to claim 1 or 2, wherein: The image is an image of a biochip, and the extreme value points are both minimum value points.
12. An apparatus for determining coordinates of a point in an image, comprising a processor, wherein the processor is configured to execute computer instructions to cause the method according to any one of claims 1 to 11 to be performed.
13. A computer device comprising a memory and a processor, wherein the memory stores computer instructions executable by the processor, and when the computer instructions are executed by the processor, the determination method according to any one of claims 1 to 11 is executed.
14. A non-transitory computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, cause the determination method according to any one of claims 1 to 11 to be performed.