A star point extraction method based on FPGA
By using two-step star point connected domain marking and grayscale-based centroid calculation methods on FPGA, the problem of identifying complex star point connected domains is solved, and efficient and accurate star point extraction is achieved, which is suitable for environments with limited micro-nano satellite resources. .
Patent Information
- Application Number
- CN202211459828.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-16
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-11-16
AI Technical Summary
Existing technology is difficult to identify complex star-point connected domains in smaller FPGA resources, and many methods need to scan the image twice, which cannot take into account both resource utilization and extraction accuracy.
Using a two-step star point connected domain marking method and a grayscale-based centroid calculation method, through preliminary marking and label merging, combined with the parallel processing characteristics of FPGA, the star point centroid coordinates can be identified by scanning the image only once.
It improves the accuracy and speed of star point extraction, reduces resource occupation, is suitable for implementation on micro-nano satellites with limited resources, and can correctly identify complex star point connected domains.
Smart Images

Figure CN115930938B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of satellite technology, and in particular relates to a star point extraction method based on FPGA. Background Art
[0002] Micro-nano satellite is a spacecraft platform with multi-payload adaptability. Its main features and advantages are that it is easy to achieve mass production, short development cycle, low economic cost and flexible launch. Micro-nano satellite has now moved from simple technical demonstration and verification to functional applications in various fields, including micro-nano satellite space rendezvous and docking technology, space target capture and docking, future assembly control technology, space robotic arm service operation technology and distributed space system application.
[0003] The above functions also bring higher precision requirements to the satellite's attitude control. The star sensors widely used on satellites are important components for high-precision attitude measurement. Therefore, improving the attitude measurement accuracy of star sensors is a crucial link in the navigation, tracking, capture and other work processes.
[0004] The star sensor processes the star map taken by the image sensor, extracts the center of mass of the star, matches it with the information in the navigation star library, and finally calculates the attitude of the spacecraft. Among them, the extraction of the center of mass of the star is called star point extraction, which is an important part of the star sensor design. Its extraction accuracy will directly affect the final attitude calculation result.
[0005] The star point extraction method is generally based on the connected domain labeling. By labeling the pixels, different labels are assigned to each connected domain to achieve the purpose of separating the star points, and then the centroid of each star point is calculated. How to use smaller FPGA resources to identify more complex star point connected domains is the current research focus. Many current methods cannot take these two points into account. Some methods use smaller FPGA resources but can only identify regular star point connected domains. Some methods can identify complex connected domains but need to scan the image twice. Summary of the invention
[0006] In order to solve the above problems, the purpose of the present invention is to provide a star point extraction method based on FPGA, which solves the problem of how to use smaller FPGA resources to identify more complex star point connected domains.
[0007] In order to achieve the above-outlined purpose, the technical solution adopted by the present invention is as follows: a star point extraction method based on FPGA for micro-nano satellites, specifically including a star point connected domain marking method and a centroid calculation method, wherein the star point connected domain marking process is divided into two steps, firstly, preliminary marking is performed, and then the label merging is performed. After the marking is completed, the pixels in the same star point connected domain will be marked with the same label. The centroid calculation method adopts a grayscale-based centroid method, and the centroid calculation conditions are accumulated while the connected domain is marked, and the centroid of each star point is calculated after a frame of picture.
[0008] The technical features of the present invention also include:
[0009] (1) Perform preliminary marking while reading the map, so that the star point connected domain marking can be completed within one line.
[0010] (2) While reading the image, the centroid calculation conditions are accumulated, and the centroid of the star point is calculated using the grayscale centroid method after one frame is completed.
[0011] (3) A 2×2 window and a 1×2 window are used as the preliminary marking window and the label merging window respectively, and the star point connected domain is marked according to the marking rules.
[0012] (4) The large-bit-width read and write capabilities of the RAM are utilized to complete label merging during the line blanking period of the image sensor.
[0013] (5) This method is implemented based on the characteristics of FPGA parallel processing, and the centroid coordinates of the star point can be obtained by scanning the image once.
[0014] Compared with the prior art, the present invention has the following beneficial effects:
[0015] (1) Based on FPGA design, the characteristics of FPGA parallel design are utilized to avoid storing images, reduce resource utilization, and improve processing speed.
[0016] (2) It can correctly identify complex star point connected domains, thereby improving the accuracy of star point extraction.
[0017] (3) The method has high reliability, occupies few resources, and is suitable for implementation on micro-nano satellites with limited resources.
[0018] The above-described objects, features and advantages as well as the working principle of the present invention will be described and explained in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a flow chart of the star point extraction method of the star sensor of the present invention.
[0020] Figure 2It is a timing diagram of the star point extraction method of the star sensor of the present invention implemented in FPGA.
[0021] Figure 3 It is a schematic diagram of a window used for preliminary marking in the present invention.
[0022] Figure 4a It is a schematic diagram of the star point connected domain before being marked in the present invention.
[0023] Figure 4b It is a schematic diagram of the star point connected domain after preliminary marking in the present invention.
[0024] Figure 4c It is a schematic diagram of the star point connected domain labels after merging in the present invention.
[0025] Figure 5 It is a schematic diagram of a window used for marking merging in the present invention.
[0026] Figure 6 It is a schematic diagram of implementing tag merging in FPGA in the present invention. DETAILED DESCRIPTION
[0027] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0028] The present invention discloses a star point extraction method based on FPGA, the flow chart is as follows: Figure 1 As shown in the figure, the timing diagram of the star point extraction method of the star sensor implemented in FPGA is as follows Figure 2 As shown in the figure, during the effective period of a row of pixels, the label of the previous row is read out for the accumulation of preliminary marking and centroid calculation conditions, and then the label is merged during the row blanking interval. Finally, the centroid calculation is performed after the last row is processed.
[0029] Taking a grayscale star map with a resolution of 1280×1024 as an example, the process of extracting star points therefrom includes the following steps.
[0030] Step 1: The star sensor collects a star map, which has 1024 rows of pixels. Set the pixel row number m = 1, 2, 3, ..., 1024, and initialize m = 1.
[0031] The star map has 1024 rows of pixels, which include valid pixels and invalid pixels. Any star point in the star map is composed of a number of valid pixels, which are interconnected to form a star point connected domain.
[0032] Go to step 2.
[0033] Step 2: Use the preliminary marking window in the FPGA to preliminarily mark the mth row of pixels in the star map, and obtain the preliminary marking results of the row of pixels, as follows:
[0034] When initially marking the pixels in the mth row, only the labels of the previous row need to be considered (for the first row of pixels, i.e., when m=1, it is assumed that the labels of the previous row are all 0). If the gray value of the pixel is greater than the extraction threshold, the pixel is a valid pixel, otherwise it is an invalid pixel. If it is an invalid pixel, its label is recorded as 0, and if it is a valid pixel, the window is marked using the preliminary marking window.
[0035] like Figure 3 As shown, the preliminary marking window is a field-shaped window, which accommodates 4 pixels at a time. In the present invention, only three pixels are considered to be used, namely pixel A, pixel B, and pixel P. Pixel P is a valid pixel currently undergoing preliminary marking, and pixel A and pixel B are pixels that have been marked. At this time, when preliminary marking is performed on pixel P, there are the following five situations:
[0036] 1) Pixel A and pixel B are both valid pixels, and the labels of pixel A and pixel B are not equal;
[0037] 2) Pixel A and pixel B are both valid pixels, and the labels of pixel A and pixel B are equal;
[0038] 3) Pixel A is a valid pixel, and pixel B is an invalid pixel;
[0039] 4) Pixel A is an invalid pixel, and pixel B is a valid pixel;
[0040] 5) Pixel A and pixel B are both invalid pixels.
[0041] like Figure 1 As shown, the preliminary tag memory RAM0 is used to cache the preliminary tag result. RAM0 is a simple dual-port RAM with a write width of 8 bits and a read width of 256 bits. The inconsistent read and write widths of RAM0 are to ensure that the tag merging can be completed during the line blanking interval. The label register is used to cache the label, and the latest label is cached during the preliminary tagging process.
[0042] For case 1), pixel P is marked as the label of pixel A, and the label of pixel B needs to be "recycled", that is, the value of the label register is reduced by 1. By "recycling" the labels, a large number of useless labels can be avoided in the initial marking process, thereby reducing the use of RAM resources. For case 2), pixel P only needs to be marked as the label of pixel A. For case 3), pixel P is marked as the label of pixel A. For case 4), pixel P is marked as the label of pixel B. For case 5), the value of the label register is increased by 1 and used as the marking result of pixel P. Figure 4a is an unlabeled row of pixels, Figure 4b It is the preliminary marking result of the pixels in the mth row according to this rule.
[0043] Go to step 3.
[0044] Step 3: In the FPGA, the label merging window is used to perform label merging on the preliminary labeling results of the mth row of pixels to obtain the label merging result of the row of pixels, which is as follows:
[0045] from Figure 4b In the figure, it can be found that after the initial marking, there will be different labels in the same star point connected domain. The purpose of label merging is to unify the labels in the star point connected domain. Its process is to use Figure 5 The label merging window shown merges the labels of the pixels in the mth row in the preliminary labeling result from right to left. The label merging window accommodates two pixels at a time, namely pixel C and pixel D. If the label of pixel C is greater than the label of pixel D, pixel C is labeled with the label of pixel D. If the label of pixel C is less than or equal to the label of pixel D, the label of pixel C remains unchanged. According to this logic, Figure 4b The result after label merging is as follows Figure 4c The above logic can be implemented in FPGA using combinational logic.
[0046] like Figure 2 As shown in the figure, after completing the preliminary marking of the mth line, the line synchronization signal enters the line blanking interval. Figure 1 As shown, the data after preliminary marking is read out from RAM0 and the label merging is performed at the same time, and the result of label merging is written into the label merging memory RAM1. RAM1 is a simple dual-port RAM, but its read and write bit widths are opposite to those of RAM0. When implementing label merging, the large bit width read function of RAM0 and the large bit width write function of RAM1 are used to complete the label merging of a line of labels during the line blanking interval. The specific process is as follows Figure 6 As shown in the figure, when the labels are merged, the data in RAM0 is read from high to low, which is equivalent to dividing a row into 40 blocks, each block has 32 8-bit pixel labels. While reading the data, the labels of each block are merged using combinational logic. It should be noted that when merging the labels, the blocks are also related. Figure 6 As shown in the figure, when the read address of RAM0 is 20, the 32 pixel labels read out are merged, and the label L'1 of the previous clock is used to perform combinational logic operations to obtain the correct label. When implemented in FPGA, a register reg is used to save L'1 of the previous clock to achieve the above association between blocks. For the EV76C660 sensor, its line blanking interval is 512 clock cycles, and the label merging method only needs 42 clock cycles to complete the marking, which shows that this method fully meets the design requirements.
[0047] At this point, the label merging of the mth row is completed, and the label merging result of the pixels in this row is obtained.
[0048] Go to step 4.
[0049] Step 4: Use the centroid calculation conditional accumulation formula to accumulate the label merging results of the m-th row of pixels to obtain the accumulated result, and store the accumulated result in the RAM of the FPGA, as follows:
[0050] like Figure 2 As shown, the centroid calculation conditions of the mth row of pixels are accumulated during the effective period of the m+1th row of pixels. This arrangement is to achieve the purpose of killing two birds with one stone, because the accumulation of the centroid calculation conditions of the mth row of pixels requires the mth row number, and the preliminary marking of the m+1th row of pixels also requires the number of this row. In other words, while the m+1th row of pixels are preliminarily marked using the mth row number, the centroid calculation conditions of the mth row of pixels are also accumulated using the mth row number. Therefore, while performing the preliminary marking, the pixels of the current row also need to be cached and read out in the next row. As shown in FIG. Figure 1 As shown, the odd-numbered row memory RAM2 and the even-numbered row memory RAM3 are used to alternately cache pixel data. They are both single-port RAMs with a bit width of 8 bits and a depth of 1280. When there are even rows, the pixels of the even rows are cached in RAM2, and the pixels of the previous row in RAM3 are read out for the accumulation of centroid calculation conditions. When there are odd rows, the pixels of the odd rows are cached in RAM3, and the pixels of the previous row in RAM2 are read out for the accumulation of centroid calculation conditions. In order to realize the pipelined accumulation of centroid calculation conditions, the centroid calculation formula above is improved, and the centroid calculation conditions of the effective star point pixels are accumulated through the following centroid calculation condition accumulation formula:
[0051]
[0052] In the formula, i(x,y) is the label of a valid pixel, where x and y are the coordinate information of the pixel. For a star map of size 1280×1024, their values are x=0, 1, 2, …1024, y=0, 1, 2, …1280. SCC(i(x,y)) is the cumulative result of the grayscale values of all pixels in the connected domain labeled i(x,y). SCCX(i(x,y)) is the cumulative result of the grayscale values of all pixels in the connected domain labeled i(x,y) multiplied by x; SCCY(i(x,y)) is the cumulative result of the grayscale values of all pixels in the connected domain labeled i(x,y) multiplied by y. Four centroid calculation condition memories are used, denoted as RAM4, RAM5, RAM6, and RAM7, and the centroid calculation condition cumulative results are stored in the corresponding RAM using the star point label as the address.
[0053] At this point, the centroid calculation conditional accumulation operation of the m-th row of pixels is completed, and the accumulation result is obtained.
[0054] Go to step 5.
[0055] Step 5: Let m = m + 1, and determine whether the updated m is the last row. If not, return to step 2; if it is the last row, the accumulated result at this time is the centroid calculation condition, which is as follows:
[0056] After the centroid calculation conditions of the mth row of pixels are accumulated, set m=m+1 to determine whether the updated m is the last row. If not, return to step 2 to perform a new round of star point marking and centroid calculation conditions accumulation. If it is the last row, the accumulated result at this time is the centroid calculation condition.
[0057] Go to step 6.
[0058] Step 6: Use the centroid calculation formula to calculate the centroid of the centroid calculation conditions to obtain the centroid of each star point in the star map, thereby completing the extraction of star points.
[0059] The centroid calculation formula adopts the grayscale centroid method. For a star map of size 1280×1024, the star point connected domain composed of pixels labeled i is denoted as d, and d=i. While extracting star points, the centroid (x d ,y d ), f(x,y) represents the gray value of a pixel in the connected domain, where x and y are the coordinate information of the pixel, and their values are x=0, 1, 2, ...1024, y=0, 1, 2, ...1280;
[0060]
[0061] Among them SCCX d and SCCY d It is the cumulative sum of the grayscale values of all pixels in the star point connected domain d multiplied by the coordinates, SCC i It is the cumulative sum of the grayscale values of all pixels in the connected domain i. d SCCY d and SCC d They are all called centroid calculation conditions, n represents the pixel column number, n=1, 2, 3,..., 1280.
[0062] like Figure 1 As shown, after the centroid calculation conditions are accumulated in the last row of a frame of the star map, the centroid calculation conditions are output from RAM4, RAM5, RAM6, and RAM7, and the centroid calculation conditions are brought into the above centroid calculation formula to obtain the centroid of each star point in the star map, thereby completing the extraction of the star points.
Claims
1. A star point extraction method based on FPGA, characterized in that: Here are the steps: Step 1: The star sensor collects a star map, which has 1024 rows of pixels. The pixel row number is set to m=1, 2, 3, ..., 1024, and m=1 is initialized. The pixels include valid pixels and invalid pixels. Any star point in the star map is composed of a number of valid pixels, and the valid pixels are interconnected to form a star point connected domain. Go to step 2; Step 2: Use the preliminary marking window in the FPGA to preliminarily mark the mth row of pixels in the star map, obtain the preliminary marking result of the row of pixels, and proceed to step 3; Step 3: In the FPGA, the label merging window is used to perform label merging on the preliminary labeling results of the mth row of pixels to obtain the label merging result of the row of pixels, and then the process goes to step 4; Step 4: Use the centroid calculation condition accumulation formula to accumulate the label merging results of the m-th row of pixels to obtain the accumulation result, and store the above accumulation result in the RAM of FPGA, and go to step 5; Step 5: Let m=m+1, and determine whether the updated m is the last row. If not, return to step 2; if it is the last row, the accumulated result at this time is the centroid calculation condition, and go to step 6; Step 6: Use the centroid calculation formula to calculate the centroid of the centroid calculation conditions to obtain the centroid of each star point in the star map, thereby completing the extraction of star points; In step 2, when preliminarily marking the pixels in the mth row, only the label of the previous row needs to be considered. If the gray value of the pixel is greater than the extraction threshold, the pixel is a valid pixel, otherwise it is an invalid pixel. If it is an invalid pixel, its label is recorded as 0. If it is a valid pixel, the window is marked using the preliminary marking window. The preliminary marking window is a field-shaped window, which accommodates 4 pixels at a time and uses only three pixels, namely pixel A, pixel B, and pixel P; pixel P is a valid pixel currently undergoing preliminary marking, and pixel A and pixel B are pixels that have been marked. At this time, when preliminary marking is performed on pixel P, there are the following five situations: 1) Pixel A and pixel B are both valid pixels, and the labels of pixel A and pixel B are not equal; 2) Pixel A and pixel B are both valid pixels, and the labels of pixel A and pixel B are equal; 3) Pixel A is a valid pixel, and pixel B is an invalid pixel; 4) Pixel A is an invalid pixel, and pixel B is a valid pixel; 5) Pixel A and pixel B are both invalid pixels; Use the label register to cache the label and cache the latest label during the preliminary marking process; For case 1), the pixel P is marked as the label of the pixel A, and the label of the pixel B is recovered, that is, the value of the label register is reduced by 1; for case 2), the pixel P only needs to be marked as the label of the pixel A; for case 3), the pixel P is marked as the label of the pixel A; for case 4), the pixel P is marked as the label of the pixel B; for case 5), the value of the label register is increased by 1 and used as the labeling result of the pixel P; In step 3, the label merging window is used in the FPGA to perform label merging on the preliminary labeling results of the mth row of pixels to obtain the label merging result of the row of pixels, which is as follows: In the FPGA, the labels of the pixels in the mth row in the preliminary marking result are merged from right to left using a label merging window, wherein the label merging window accommodates two pixels at a time, namely, pixel C and pixel D; If the number of pixel C is greater than the number of pixel D, the number of pixel C is changed to the number of pixel D; if the number of pixel C is less than or equal to the number of pixel D, the number of pixel C remains unchanged; After completing the preliminary marking of the mth row, the row synchronization signal enters the row blanking interval; the data after the preliminary marking is read out from the preliminary marking memory RAM0 and the label merging is performed at the same time, and the result of the label merging is written into the label merging memory RAM1. RAM1 is a simple dual-port RAM, but its read and write bit widths are opposite to those of the preliminary marking memory RAM0; when implementing the label merging, the large bit width reading function of the preliminary marking memory RAM0 and the large bit width writing function of RAM1 are used to complete the label merging of a row of labels during the row blanking interval; Get the label merging result of the row of pixels; In step 4, the centroid calculation condition accumulation formula is used to accumulate the label merging results of the m-th row of pixels to obtain the accumulation result, and the above accumulation result is stored in the RAM of the FPGA, as follows: The accumulation of centroid calculation conditions for the mth row of pixels is completed during the effective period of the m+1th row of pixels, that is, while the m+1th row of pixels are preliminarily marked using the label of the mth row, the centroid calculation conditions for the mth row of pixels are also accumulated using the label of the mth row. Therefore, while performing the preliminary marking, the pixels of the current row also need to be cached and read out in the next row.
2. The star point extraction method based on FPGA according to claim 1, characterized in that: For the first row of pixels, ie, when m=1, it is assumed that all the labels in the previous row are 0.
3. The star point extraction method based on FPGA according to claim 1, characterized in that: Use odd-numbered row memory RAM2 and even-numbered row memory RAM3 to cache pixel data alternately. They are both single-port RAMs with a bit width of 8 bits and a depth of 1280. When there are even rows, the pixels of the even rows are cached in RAM2, and the pixels of the previous row in RAM3 are read out for conditional accumulation of centroid calculation. When there are odd rows, the pixels of the odd rows are cached in RAM3, and the pixels of the previous row in RAM2 are read out for conditional accumulation of centroid calculation. The centroid calculation conditions of valid star point pixels are accumulated by the following centroid calculation condition accumulation formula: Where i(x,y) is the label of a valid pixel, where x and y are the coordinate information of the pixel. For a star map of size 1280×1024, their values are x=0…1024, y=0…1280, SCC(i(x,y)) is the cumulative result of the grayscale values of all pixels in the connected domain labeled i(x,y); SCCX(i(x,y)) is the cumulative result of the grayscale values of all pixels in the connected domain labeled i(x,y) multiplied by x; SCCY(i(x,y)) is the cumulative result of the grayscale values of all pixels in the connected domain labeled i(x,y) multiplied by y; four centroid calculation condition memories, denoted as RAM4, RAM5, RAM6, RAM7, use the star point label as the address to store the centroid calculation condition cumulative result in the corresponding RAM; Complete the centroid calculation conditional accumulation operation of the m-th row of pixels to obtain the accumulation result.
4. The star point extraction method based on FPGA according to claim 3, characterized in that: In step 5, after the centroid calculation conditions of the mth row of pixels are accumulated, set m=m+1 to determine whether the updated m is the last row. If not, return to step 2 to perform a new round of star point marking and accumulation of centroid calculation conditions. If it is the last row, the accumulated result at this time is the centroid calculation condition.
5. The star point extraction method based on FPGA according to claim 4, characterized in that: In step 6, the centroid calculation formula is used to calculate the centroid of the centroid calculation condition to obtain the centroid of each star point in the star map, thereby completing the extraction of the star point, as follows: The centroid calculation formula adopts the grayscale centroid method. For a star map of size 1280×1024, the star point connected domain composed of pixels labeled i is denoted as d, and d=i. While extracting star points, the centroid (x d ,y d ), f(x,y) represents the gray value of a pixel in the connected domain, where x and y are the coordinate information of the pixel, and their values are x=0, 1, 2, ...1024, y=0, 1, 2, ...1280; Among them, SCCX d and SCCY d It is the cumulative sum of the grayscale values of all pixels in the star point connected domain d multiplied by the coordinates, SCC d is the cumulative sum of the grayscale values of all pixels in the connected domain d; SCCX d SCCY d and SCC d are all called centroid calculation conditions; n represents the pixel column number, n = 1, 2, 3, ..., 1280; After the centroid calculation conditions are accumulated in the last row of a frame of star map, the centroid calculation conditions are output from RAM4, RAM5, RAM6, and RAM7, and brought into the above centroid calculation formula to obtain the centroid of each star point in the star map, thereby completing the extraction of star points.
Citation Information
Patent Citations
Star sensor multichannel image star point mass center extraction method and star sensor
CN112200855A
