A multi-camera positioning method based on a single device
By shooting dark scenes on a single device and performing image preprocessing, the closed contour separation image is determined and polar coordinate data is obtained. This solves the problem of difficulty in maintaining positional relationships after the multi-camera system equipment is restarted, and achieves high-definition image separation and camera position positioning. The accuracy provides stable basic data for computer vision.
Patent Information
- Application Number
- CN202011445004.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-08
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2040-12-08
AI Technical Summary
In a multi-camera joint system, it is difficult to maintain consistent camera position relationships after the device is restarted, affecting the stability and accuracy of computer vision capture.
Obtain high-definition images by shooting dark scenes on a single device, perform image preprocessing and grayscale transformation, determine closed contours to separate foreground and background images, obtain polar coordinate data, save the mutual position relationship between cameras, and ensure rapid positioning after the device is restarted.
It achieves accurate separation of high-definition images and accurate positioning of camera positions, provides basic data for computer vision calculations, and ensures that the system can still operate normally after the device is restarted.
Smart Images

Figure CN112614178B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of device computing technology, and specifically is a multi-camera position positioning method based on a single device. Background Art
[0002] It is difficult to meet people's needs by integrating a camera on a single device. A multi-camera joint system that combines multiple cameras with different functions to complete complex tasks is bound to be used more and more. A multi-camera joint system is a system in which multiple cameras cooperate with each other and improve consistency by calibrating images obtained by different cameras.
[0003] Currently, devices that use multiple cameras as a system to achieve computer vision capture are very common. Since cameras usually use USB interfaces, the order of the camera device list obtained by the USB interface on the same device will change after each power failure and restart. Therefore, a position positioning method is currently needed to solve the position relationship between multiple cameras on the same device. Summary of the invention
[0004] In order to solve the problems existing in the above scheme, the present invention provides a multi-camera position positioning method based on a single device; in the present invention, when obtaining a high-definition image, the scene is placed in front of the camera so that all cameras can capture the scene completely; the color of the foreground object is dark; the camera captures the scene multiple times at a fixed position to obtain photos, and each camera selects the photo with the largest resolution as the high-definition image; by limiting the color of the foreground object and the content of the shooting, it is helpful to quickly and accurately separate the high-definition image into the foreground image and the background image; in the present invention, the high-definition image is preprocessed and the image after the image preprocessing is marked as a grayscale image; the grayscale value is used to determine The closed contour of the foreground object in the grayscale image is determined, and the grayscale image is masked according to the closed contour to obtain the foreground image and the background image; the foreground image and the background image are separated by the grayscale value to improve the accuracy of the separation and ensure the accuracy of the polar coordinate data of the foreground object; the present invention can obtain the mutual position relationship and polar coordinate data of the cameras through the conversion between the high-definition image and the polar coordinates; when there are multiple cameras on the same device, even if the device crashes and restarts, the corresponding camera can be quickly located according to the saved mutual position relationship and polar coordinate data, and the basic data of coordinate conversion is provided when these cameras are used for computer vision calculation.
[0005] The purpose of the present invention can be achieved by the following technical solution: a multi-camera position positioning method based on a single device, the method comprising the following steps:
[0006] Step 1: Use a camera to capture the same scene and obtain a high-definition image;
[0007] Step 2: Separate the foreground and background in the high-definition image to obtain the foreground image and the background image, and set the center position of the high-definition image as the origin of the polar coordinate system;
[0008] Step 3: Extract the foreground objects in the foreground image, obtain the polar coordinates of the foreground objects in the high-definition image, and at the same time convert the closed contours of the foreground objects into vector data;
[0009] Step 4: Determine the relative positions and angles between the cameras that captured the high-definition images based on the polar coordinate data of the same foreground object in different high-definition images;
[0010] Step 5: Save the relative positions of the cameras.
[0011] Furthermore, the specific steps for obtaining the high-definition image in Step 1 are as follows: Place the scene in front of the cameras so that all cameras can capture the scene completely; the color of the foreground object is dark; the cameras take multiple photos of the scene at fixed positions, and each camera selects the photo with the highest resolution as the high-definition image.
[0012] Furthermore, the specific steps for obtaining the foreground image and the background image in Step 2 are as follows:
[0013] Step Z1: Perform image preprocessing on the high-definition image and mark the image after image preprocessing as a grayscale image; the image preprocessing includes image segmentation, image denoising, image enhancement, and grayscale transformation;
[0014] Step Z2: Determine the closed contour of the foreground object in the grayscale image through the grayscale value. The specific steps for determining the closed contour are as follows:
[0015] Step Z21: Obtain the grayscale average value of the grayscale image and mark the grayscale average value as HPZ;
[0016] Step Z22: Obtain the pixel grayscale value of the pixel points in the grayscale image and mark the pixel grayscale value as XHZ;
[0017] Step Z23: When the pixel grayscale value XHZ satisfies XHZ≥α1×HPZ, mark the pixel point as a preliminary selected pixel point, obtain the pixel points adjacent to the preliminary selected pixel point and mark them as adjacent pixel points, and mark the grayscale value of the adjacent pixel points as LXHZ; where α1 is a preset proportional coefficient and α1>1.5;
[0018] Step Z24: When and LXHZ≥HPZ, mark the adjacent pixel point as a dark pixel point; when and LXHZ<HPZ, mark the adjacent pixel point as a light pixel point; where is the preset scale factor, and
[0019] Step Z25: When the adjacent pixel points include at least one dark pixel point and one light pixel point, the preliminarily selected pixel points surrounded by the adjacent pixel points are marked as contour pixels;
[0020] Step Z26: Generate a preliminary contour through contour pixels, obtain the grayscale average value of the pixels in the preliminary contour and mark it as LHPZ; when LHPZ≥α2×HPZ, mark the preliminary contour as a closed contour; where α2 is a preset proportional coefficient, and 1<α2≤1.5;
[0021] Step Z3: Mask the grayscale image according to the closed contour to obtain the foreground image and the background image.
[0022] Furthermore, the foreground object is extracted from the foreground image, the center of gravity position of the foreground object is determined, and the polar coordinates of the center of gravity position in the corresponding high-definition image are obtained; the outline of the foreground object is obtained and marked as an edge outline, the polar coordinates corresponding to the pixel points in the edge outline are obtained, and the edge outline is converted into vector data.
[0023] Furthermore, the specific steps for determining the relative positions of the cameras in step 4 are as follows:
[0024] Step X1: Determine the foreground object in the high-definition image corresponding to each camera according to the vector data;
[0025] Step X2: Obtain the shortest distances between the edge contour of the foreground object and the four sides of the high-definition photo, marked as upper distance SJ, lower distance XJ, left distance ZJ and right distance YJ respectively; obtain the distance evaluation coefficient JPX by the formula JPX=||SJ-XJ|-|ZJ-YJ||;
[0026] Step X3: Select the image with the smallest distance evaluation coefficient as the target high-definition image, and establish a polar coordinate system with the center position of the target high-definition image as the pole;
[0027] Step X4: Obtain the polar coordinates of the center position of each high-definition image in the polar coordinate system described in step X3 according to the polar coordinates of the center position of the foreground object and mark them as camera coordinates;
[0028] Step X5: Determine the relative positions of the cameras according to the camera coordinates, and save the relative positions of the cameras.
[0029] Furthermore, the cameras are numbered from left to right and from top to bottom according to the camera coordinates, and the number is represented by i; i = 1, 2, ..., n; the camera number i and the corresponding camera coordinates are saved; when the device crashes and restarts, the positioning of all cameras can be completed quickly and accurately according to the stored camera numbers and corresponding camera coordinates.
[0030] Compared with the prior art, the present invention has the following beneficial effects:
[0031] 1. In the present invention, when obtaining a high-definition image, the scene is placed in front of the camera so that all cameras can capture the scene completely; the color of the foreground object is dark; the camera captures the scene multiple times at a fixed position to obtain photos, and each camera selects the photo with the highest resolution as the high-definition image; by limiting the color of the foreground object and the content of the photo, it is helpful to quickly and accurately separate the high-definition image into the foreground image and the background image;
[0032] 2. In the present invention, the high-definition image is preprocessed and the image after the image preprocessing is marked as a grayscale image; the closed contour of the foreground object in the grayscale image is determined by the grayscale value, and the grayscale image is masked according to the closed contour to obtain the foreground image and the background image; the foreground image and the background image are separated from the high-definition image by the grayscale value, which can improve the accuracy of the separation and ensure the accuracy of the polar coordinate data of the foreground object;
[0033] 3. The present invention can obtain the relative position relationship and polar coordinate data of cameras through the conversion between high-definition images and polar coordinates; when there are multiple cameras on the same device, even if the device crashes and restarts, the corresponding camera can be quickly located based on the saved relative position relationship and polar coordinate data, and basic data for coordinate conversion can be provided when these cameras are used for computer vision calculations. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0035] Figure 1 It is a principle block diagram of the present invention. DETAILED DESCRIPTION
[0036] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0037] See also Figure 1 , a multi-camera position positioning method based on a single device, the method comprising the following steps:
[0038] Step 1: Use a camera to capture the same scene and obtain a high-definition image;
[0039] Step 2: Separate the foreground and background in the high-definition image to obtain the foreground image and the background image, and set the center position of the high-definition image as the origin of the polar coordinates;
[0040] Step 3: Extract the foreground object in the foreground image, obtain the polar coordinates of the foreground object in the high-definition image, and convert the closed contour of the foreground object into vector data;
[0041] Step 4: Determine the relative positions and angles between the cameras that shoot the high-definition images based on the polar coordinate data of the same foreground object in different high-definition images;
[0042] Step 5: Save the relative positions of the cameras.
[0043] Furthermore, the specific steps for obtaining the high-definition image in step one are: placing the scene in front of the camera so that all cameras can capture the scene completely; the color of the foreground object is dark; the camera captures the scene multiple times at a fixed position to obtain photos, and each camera selects the photo with the largest resolution as the high-definition image.
[0044] Furthermore, the specific steps of obtaining the foreground image and the background image in step 2 are:
[0045] Step Z1: preprocessing the high-definition image and marking the preprocessed image as a grayscale image; the image preprocessing includes image segmentation, image denoising, image enhancement and grayscale conversion;
[0046] Step Z2: Determine the closed contour of the foreground object in the grayscale image by grayscale value. The specific steps of determining the closed contour are:
[0047] Step Z21: Obtain the grayscale average value of the grayscale image, and mark the grayscale average value as HPZ;
[0048] Step Z22: Obtain the pixel grayscale value of the pixel point in the grayscale image, and mark the pixel grayscale value as XHZ;
[0049] Step Z23: When the pixel grayscale value XHZ satisfies XHZ≥α1×HPZ, mark the pixel as a preliminary selection pixel, obtain the pixels adjacent to the preliminary selection pixel and mark them as adjacent pixels, and mark the grayscale value of the adjacent pixels as LXHZ; where α1 is a preset proportionality coefficient, and α1>1.5;
[0050] Step Z24: When and LXHZ≥HPZ, mark the adjacent pixel as a dark pixel; when and LXHZ<HPZ, mark the adjacent pixel as a light pixel; where is a preset proportionality coefficient, and
[0051] Step Z25: When the adjacent pixels include at least one dark pixel and one light pixel, mark the preliminary selection pixel surrounded by the adjacent pixels as a contour pixel;
[0052] Step Z26: Generate a preliminary contour through the contour pixels, obtain the grayscale average value of the pixels within the preliminary contour and mark it as LHPZ; when LHPZ≥α2×HPZ, mark the preliminary contour as a closed contour; where α2 is a preset proportionality coefficient, and 1<α2≤1.5;
[0053] Step Z3: Perform mask processing on the grayscale image according to the closed contour, and then the foreground image and the background image can be obtained.
[0054] Furthermore, extract the foreground object from the foreground image, determine the centroid position of the foreground object, and obtain the polar coordinates of the centroid position in the corresponding high-definition image; obtain the contour of the foreground object and mark it as the edge contour, obtain the polar coordinates corresponding to the pixels in the edge contour, and at the same time convert the edge contour into vector data.
[0055] Furthermore, the specific determination steps for the relative positions between the cameras in step four are as follows:
[0056] Step X1: Determine the foreground object in the high-definition image corresponding to each camera according to the vector data;
[0057] Step X2: Obtain the shortest distances between the edge contour of the foreground object and the four sides of the high-definition photo, and mark them as the upper side distance SJ, the lower side distance XJ, the left side distance ZJ, and the right side distance YJ respectively; obtain the distance evaluation coefficient JPX through the formula JPX=||SJ-XJ|-|ZJ-YJ||;
[0058] Step X3: Select the one with the smallest distance evaluation coefficient as the target high-definition image, and establish a polar coordinate system with the center position of the target high-definition picture as the pole;
[0059] Step X4: Obtain the polar coordinates of the center position of each high-definition image in the polar coordinate system described in step X3 according to the polar coordinates of the center position of the foreground object and mark them as camera coordinates;
[0060] Step X5: Determine the relative positions of the cameras according to the camera coordinates, and save the relative positions of the cameras.
[0061] Furthermore, the cameras are numbered from left to right and from top to bottom according to the camera coordinates, and the number is represented by i; i = 1, 2, ..., n; the camera number i and the corresponding camera coordinates are saved; when the device crashes and restarts, the positioning of all cameras can be completed quickly and accurately according to the stored camera numbers and corresponding camera coordinates.
[0062] The above formulas are all calculated by removing dimensions and taking numerical values. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.
[0063] Working principle of the present invention:
[0064] The scene is placed in front of the camera so that all cameras can capture the scene completely; the camera takes multiple shots of the scene at a fixed position to obtain photos, and each camera selects the photo with the largest resolution as the high-definition image;
[0065] The high-definition image is preprocessed and the image after the image preprocessing is marked as a grayscale image; the closed contour of the foreground object in the grayscale image is determined by the grayscale value, and the grayscale image is masked according to the closed contour to obtain the foreground image and the background image;
[0066] Determine the foreground object in the high-definition image corresponding to each camera based on the vector data; obtain the shortest distance between the edge contour of the foreground object and the four sides of the high-definition photo, and mark them as the upper distance, lower distance, left distance and right distance respectively; obtain the distance evaluation coefficient; select the one with the smallest distance evaluation coefficient as the target high-definition image, and establish a polar coordinate system with the center position of the target high-definition image as the pole; obtain the polar coordinates of the center position of each high-definition image in the polar coordinate system described in step X3 based on the polar coordinates of the center position of the foreground object and mark them as camera coordinates; determine the relative positions of the cameras based on the camera coordinates, and save the relative positions of the cameras.
[0067] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0068] The above contents are merely examples and explanations of the structure of the present invention. The technicians in this technical field may make various modifications or additions to the specific embodiments described or replace them in a similar manner. As long as they do not deviate from the structure of the invention or exceed the scope defined by the claims, they should all fall within the protection scope of the present invention.
Claims
1. A multi-camera position positioning method based on a single device, characterized in that: The method comprises the following steps: Step 1: Use a camera to capture the same scene and obtain a high-definition image; Step 2: Separate the foreground and background in the high-definition image to obtain the foreground image and the background image, and set the center position of the high-definition image as the origin of the polar coordinates; Step 3: Extract the foreground object in the foreground image, obtain the polar coordinates of the foreground object in the high-definition image, and convert the closed contour of the foreground object into vector data; Step 4: Determine the relative positions and angles between the cameras that shoot the high-definition images based on the polar coordinate data of the same foreground object in different high-definition images; Step 5: Save the relative positions of the cameras.
2. The method for locating multiple cameras based on a single device according to claim 1, characterized in that: The specific steps for obtaining the high-definition image described in step one are: placing the scene in front of the camera so that all cameras can capture the scene completely; the camera takes multiple photos of the scene at a fixed position, and each camera selects the photo with the largest resolution as the high-definition image.
3. The method for locating multiple cameras based on a single device according to claim 1, characterized in that: The specific steps of obtaining the foreground image and the background image in step 2 are: Step Z1: preprocessing the high-definition image and marking the preprocessed image as a grayscale image; the image preprocessing includes image segmentation, image denoising, image enhancement and grayscale conversion; Step Z2: Determine the closed contour of the foreground object in the grayscale image by grayscale value. The specific steps of determining the closed contour are: Step Z21: Obtain the grayscale average value of the grayscale image, and mark the grayscale average value as HPZ; Step Z22: Obtain the pixel grayscale value of the pixel point in the grayscale image, and mark the pixel grayscale value as XHZ; Step Z23: when the pixel gray value XHZ satisfies XHZ≥α1×HPZ, the pixel is marked as a primary pixel, pixels adjacent to the primary pixel are obtained and marked as adjacent pixels, and the gray value of the adjacent pixel is marked as LXHZ; wherein α1 is a preset proportional coefficient, and α1>1.5; Step Z24: When and LXHZ ≥ HPZ, then mark the adjacent pixel as a dark pixel; when and LXHZ < HPZ, then mark the adjacent pixel as a light pixel; where is a preset proportionality coefficient, and Step Z25: When the adjacent pixel points include at least one dark pixel point and one light pixel point, the preliminarily selected pixel points surrounded by the adjacent pixel points are marked as contour pixels; Step Z26: Generate a preliminary contour through contour pixels, obtain the grayscale average value of the pixels in the preliminary contour and mark it as LHPZ; when LHPZ≥α2×HPZ, mark the preliminary contour as a closed contour; where α2 is a preset proportional coefficient, and 1<α2≤1.5; Step Z3: Mask the grayscale image according to the closed contour to obtain the foreground image and the background image.
4. The method for locating multiple cameras based on a single device according to claim 1, characterized in that: Extract the foreground object from the foreground image, determine the center of gravity position of the foreground object, and obtain the polar coordinates of the center of gravity position in the corresponding high-definition image; obtain the outline of the foreground object and mark it as an edge outline, obtain the polar coordinates corresponding to the pixel points in the edge outline, and convert the edge outline into vector data.
