A container positioning method and device of a smart faucet and the smart faucet
By using a fisheye camera and segmentation model combined with a transformation matrix compensation factor, low-cost, high-precision container positioning of smart faucets was achieved, solving the problems of high hardware cost and low positioning efficiency in traditional solutions and improving the automated user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NINGBO FOTILE KITCHEN WARE CO LTD
- Filing Date
- 2026-03-10
- Publication Date
- 2026-06-26
AI Technical Summary
Existing robotic arm positioning solutions for smart faucets rely on depth cameras, resulting in high hardware costs, insufficient field of view coverage, and impact on positioning efficiency and automated user experience.
Two-dimensional images are acquired using a fisheye camera, the center pixel coordinates of the container are obtained through a segmentation model, and coordinate transformation is performed using a transformation matrix and a compensation factor to achieve precise movement of the robotic arm.
It reduced hardware costs, improved positioning accuracy and automation, enhanced user experience, and simplified operation procedures.
Smart Images

Figure CN122289374A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart home appliance technology, and in particular to a container positioning method, device, and smart faucet for a smart faucet. Background Technology
[0002] With the trend of intelligent upgrading in the smart kitchen and bathroom industry, smart faucets have become a research and development hotspot. In order to realize the intelligent function of automatic water dispensing, many smart faucets have integrated planar motion robotic arms. The robotic arms find cups and position containers to achieve precise water dispensing. The precise container positioning of the robotic arms relies on mature hand-eye calibration technology.
[0003] Currently, the eye-in-hand calibration solution used in the robotic arm field is the Eye-in-Hand approach. This involves fixing a camera to the end effector of the robotic arm and capturing multiple images of a stationary calibration plate on a worktable by moving the arm. By combining the changes in the robotic arm's pose with the relative motion of the calibration plate observed by the camera, the fixed spatial transformation relationship between the camera and the end effector can be determined, thus achieving coordination between visual perception and robotic arm execution. However, the Eye-in-Hand approach is originally designed for industrial robotic arm environments. When directly applied to the cup-finding and positioning of a smart faucet, due to differences in scene characteristics, this solution relies on depth information for positioning, requiring the use of a depth camera. The high hardware cost of depth cameras significantly increases the manufacturing cost of smart faucets, hindering their widespread adoption in the civilian market. Furthermore, the cameras used in this solution suffer from limited near-field coverage, affecting container recognition and positioning. Additionally, before cup-finding and positioning, the robotic arm's pose needs to be adjusted to obtain the target container's field of view, increasing operational steps, reducing positioning efficiency, and severely impacting the automated user experience of the smart faucet.
[0004] Therefore, it is particularly important to develop a container positioning method, device, and smart faucet that can effectively reduce hardware costs, improve positioning accuracy, and enhance the automation level and user experience of smart faucets. Summary of the Invention
[0005] To address the aforementioned technical issues, this application provides a container positioning method, device, and smart faucet for smart faucets. By acquiring images of the placement area, segmenting the container edge to obtain the center pixel coordinates, and then performing coordinate transformation and compensation to obtain the center world coordinates, the application guides a robotic arm to precisely move to the target location. This solution addresses the current lack of container positioning methods, devices, and smart faucets for smart faucets that can effectively reduce hardware costs, improve positioning accuracy, and enhance the automation level and user experience of smart faucets.
[0006] The technical solution provided in this application is as follows: On one hand, this application provides a container positioning method for a smart faucet, the smart faucet including a robotic arm, and a container placement area corresponding to the container being provided below the smart faucet. The container positioning method for the smart faucet includes: Acquire target image information within the area where the container is placed; The target image information is subjected to container edge segmentation processing to obtain the center pixel coordinates of the container; The center pixel coordinates are subjected to coordinate transformation and coordinate compensation to obtain the center world coordinates of the container. Control the robotic arm to move to the center world coordinates of the container.
[0007] In some optional implementations, the step of performing container edge segmentation processing on the target image information to obtain the center pixel coordinates of the container includes: Obtain a segmentation model; the segmentation model is obtained by predicting and training the center pixel coordinates of the containers based on historical image information and the center pixel coordinates of the containers corresponding to the historical image information. The target image information is input into the segmentation model, and the target image information is parsed based on the segmentation model to obtain the contour information of the container. The contour center is determined according to the contour information, and the pixel coordinates of the contour center are used as the center pixel coordinates of the container.
[0008] In some optional implementations, the step of performing coordinate transformation and coordinate compensation processing on the center pixel coordinates to obtain the center world coordinates of the container includes: Obtain the transformation matrix and compensation factor; Construct a center pixel coordinate vector based on the center pixel coordinates; Based on the transformation matrix, the center pixel coordinate vector is transformed to obtain the center transformed coordinate vector of the container; Based on the compensation factor, coordinate compensation processing is performed on the center transformation coordinate vector to obtain the center compensation coordinate vector of the container; The center compensation coordinates of the container are obtained by analyzing the center compensation coordinate vector. The center compensation coordinates of the container are used as the center world coordinates of the container.
[0009] In some optional implementations, the method for constructing the transformation matrix includes: Obtain the pixel coordinates of a preset number of reference points and the world coordinates corresponding to each of the reference points; The mapping relationship between the pixel coordinates of the reference points and the world coordinates corresponding to each reference point is analyzed to obtain several transformation coefficients; Based on the aforementioned transformation coefficients, the transformation matrix is constructed.
[0010] In some optional implementations, the method for determining the compensation factor includes: Obtain the baseline pixel coordinates, fixed constants, and distortion compensation coefficients; The target distance is obtained by determining the planar distance between the center pixel coordinates and the reference pixel coordinates. Determine the power of the target distance from the fixed constant to obtain the variable factor; The ratio of the distortion compensation coefficient to the variable factor is determined to obtain the compensation factor.
[0011] In some optional implementations, the step of performing coordinate transformation processing on the center pixel coordinate vector based on the transformation matrix to obtain the center transformed coordinate vector of the container includes: The product of the transformation matrix and the center pixel coordinate vector is determined to obtain the center transformation coordinate vector of the container; The process of performing coordinate compensation processing on the center transformation coordinate vector based on the compensation factor to obtain the center compensation coordinate vector of the container includes: The product of the compensation factor and the center transformation coordinate vector is determined to obtain the center compensation coordinate vector of the container.
[0012] On the other hand, this application provides a container positioning device for a smart faucet, the container positioning device for the smart faucet comprising: The acquisition module is used to acquire target image information within the area where the container is placed; The segmentation module is used to perform container edge segmentation processing on the target image information to obtain the center pixel coordinates of the container; The coordinate transformation module is used to perform coordinate transformation and coordinate compensation processing on the center pixel coordinates to obtain the center world coordinates of the container. The control module is used to control the robotic arm to move to the center world coordinates of the container.
[0013] On the other hand, this application provides a smart faucet, which uses the container positioning method of the smart faucet as described in any of the above embodiments for container positioning.
[0014] On the other hand, this application provides an electronic device including a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement the container positioning method of the smart faucet as described in any of the above embodiments.
[0015] On the other hand, this application provides a computer-readable storage medium storing at least one instruction or at least one program, which is loaded and executed by a processor to implement the container positioning method of the smart faucet as described in any of the above embodiments.
[0016] This application provides a container positioning method for a smart faucet. The smart faucet includes a robotic arm, and a container placement area corresponding to the container is set below the smart faucet. The method includes: acquiring target image information within the container placement area; performing container edge segmentation processing on the target image information to obtain the center pixel coordinates of the container; performing coordinate transformation and coordinate compensation processing on the center pixel coordinates to obtain the center world coordinates of the container; and controlling the robotic arm to move to the center world coordinates of the container. By acquiring an image of the placement area, segmenting the container edges to obtain the center pixel coordinates, and then performing coordinate transformation and compensation to obtain the center world coordinates, the robotic arm is guided to move accurately to the target location, effectively reducing hardware costs, improving positioning accuracy, and enhancing the automation level and user experience of the smart faucet. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a schematic flowchart of a container positioning method for an intelligent faucet according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a container positioning device for an intelligent faucet according to an embodiment of the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0020] The term "an embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of this application. In the description of this application, it should be understood that the terms "upper," "lower," "top," "bottom," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. Moreover, the terms "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein.
[0021] When a numerical range is disclosed herein, the range is considered continuous and includes the minimum and maximum values of the range, as well as every value between the minimum and maximum values. Furthermore, when the range refers to an integer, it includes every integer between the minimum and maximum values of the range. Additionally, when multiple ranges are provided to describe a feature or characteristic, the ranges may be combined. In other words, unless otherwise specified, all ranges disclosed herein should be understood to include any and all subranges to which they are included. For example, a specified range from “1 to 10” should be considered to include any and all subranges between the minimum value 1 and the maximum value 10. Exemplary subranges of the range 1 to 10 include, but are not limited to, 1 to 6.1, 3.5 to 7.8, 5.5 to 10, etc.
[0022] Since the current hand-eye calibration scheme relies on depth information for positioning, it requires the use of a depth camera, which increases the manufacturing cost of smart faucets and hinders their popularization in the civilian market. Insufficient camera field of view affects the recognition and positioning of containers, requiring additional adjustment of the robotic arm pose to obtain the field of view of the target container, reducing positioning efficiency and seriously affecting the automated user experience of smart faucets. Therefore, in order to effectively reduce hardware costs, improve positioning accuracy, and enhance the automation level and user experience of smart faucets, this application provides a container positioning method, device, and smart faucet for smart faucets.
[0023] Please see Figure 1 , Figure 1This is a schematic flowchart of a container positioning method for a smart faucet according to an embodiment of the present invention. In one aspect, this application provides a container positioning method for a smart faucet, wherein the smart faucet includes a robotic arm, and a container placement area corresponding to the container is provided below the smart faucet. The container positioning method for the smart faucet includes: S101. Collect target image information within the area where the container is placed.
[0024] Optionally, the data acquisition process is completed using a fisheye camera, a non-traditional depth camera. This eliminates the need for depth information acquisition, only capturing two-dimensional planar images. This reduces hardware costs and is suitable for planar calibration and positioning of the faucet robotic arm, which does not require depth information. The fisheye camera is fixedly mounted below the robotic arm of the smart faucet, with a vertically downward shooting angle, precisely aligned with the pre-defined container placement area below the faucet—specifically, the designated area on the tabletop for placing containers such as water cups. The robotic arm moves only in a plane parallel to the tabletop. The acquired target image information is a complete visual image of the container placement area, fully covering the area and clearly showing the overall outline of the container to be positioned, such as a water cup, especially the container opening, providing a basis for subsequent container edge segmentation. Leveraging the wide-angle characteristic of the fisheye camera overcomes the limitations of the overall height of the faucet robotic arm and the low camera mounting position, allowing for the simultaneous acquisition of images of a large container placement area without additional adjustments to the robotic arm's pose to obtain the target container's field of view, ensuring both efficiency and completeness of image acquisition.
[0025] S102. Perform container edge segmentation processing on the target image information to obtain the center pixel coordinates of the container.
[0026] In an optional embodiment, the step of performing container edge segmentation processing on the target image information to obtain the center pixel coordinates of the container includes: Obtain a segmentation model; the segmentation model is obtained by predicting and training the center pixel coordinates of the containers based on historical image information and the center pixel coordinates of the containers corresponding to the historical image information. The target image information is input into the segmentation model, and the target image information is parsed based on the segmentation model to obtain the contour information of the container. The contour center is determined according to the contour information, and the pixel coordinates of the contour center are used as the center pixel coordinates of the container.
[0027] Optionally, the segmentation model is a machine learning model customized and trained for the smart faucet container positioning scenario. Based on labeled historical sample data, the preset basic model is trained in a targeted manner, enabling the model to identify containers from images, extract contours, and predict the coordinates of the center pixel.
[0028] Optionally, historical image information of the container placement area under the smart faucet is collected, including images of containers of different types, sizes, and placement angles, covering various actual situations in faucet usage scenarios. Simultaneously, the corresponding container center pixel coordinates are labeled for each historical image, i.e., the pixel grid coordinates of the actual center position of the container in the image. The pixel coordinate system has the upper left corner of the image as the origin, and the coordinate form is (u,v), forming a labeled training dataset. The labeled historical image information and the corresponding container center pixel coordinates are used as training input to train a selected preset base model to predict the container center pixel coordinates, allowing the model to learn the mapping relationship between image features and container center pixel coordinates. This enables the trained segmentation model to autonomously parse images, segment container edges, extract container contours, and locate the contour center pixel coordinates, adapting to the practical application scenario of a robotic arm finding cups under a faucet.
[0029] Optionally, after the segmentation model is trained and deployed, the target image of the container placement area acquired in real time is processed to obtain the center pixel coordinates of the container. The target image information of the container placement area acquired by the smart faucet is directly input into the segmentation model that has been trained. The segmentation model performs container edge segmentation processing on the target image, accurately identifies the container area in the image, and segments the complete contour information of the container from the background. Based on the container contour information output by the segmentation model, the geometric center of the contour is calculated. For example, the center of a circular cup contour is taken as the center, and the intersection of the diagonals of a square container contour is taken as the center, etc., which are general geometric center calculation rules adapted to different shaped containers. The coordinate value of the geometric center of the contour in the image pixel coordinate system is directly used as the center pixel coordinates of the container to be located.
[0030] The trained segmentation model automates the process from container image acquisition to edge segmentation, contour extraction, and center pixel coordinate determination, providing accurate initial coordinate data for subsequent pixel coordinate to world coordinate conversion and laying the foundation for container positioning by the intelligent faucet robotic arm.
[0031] S103. Perform coordinate transformation and coordinate compensation processing on the center pixel coordinates to obtain the center world coordinates of the container.
[0032] In an optional embodiment, the step of performing coordinate transformation and coordinate compensation processing on the center pixel coordinates to obtain the center world coordinates of the container includes: Obtain the transformation matrix and compensation factor; Construct a center pixel coordinate vector based on the center pixel coordinates; Based on the transformation matrix, the center pixel coordinate vector is transformed to obtain the center transformed coordinate vector of the container; Based on the compensation factor, coordinate compensation processing is performed on the center transformation coordinate vector to obtain the center compensation coordinate vector of the container; The center compensation coordinates of the container are obtained by analyzing the center compensation coordinate vector. The center compensation coordinates of the container are used as the center world coordinates of the container.
[0033] In an optional embodiment, the step of performing coordinate transformation processing on the center pixel coordinate vector based on the transformation matrix to obtain the center transformed coordinate vector of the container includes: The product of the transformation matrix and the center pixel coordinate vector is determined to obtain the center transformation coordinate vector of the container; The process of performing coordinate compensation processing on the center transformation coordinate vector based on the compensation factor to obtain the center compensation coordinate vector of the container includes: The product of the compensation factor and the center transformation coordinate vector is determined to obtain the center compensation coordinate vector of the container.
[0034] Optionally, the formula for calculating the mapping from pixel coordinates to world coordinates is: ; Optionally, the center pixel coordinates of the container are in the form of two-dimensional coordinates (u, v) obtained from the segmentation model, where u is the horizontal pixel value and v is the vertical pixel value, and the pixel coordinate system takes the upper left corner of the image as the origin; according to the homogeneous coordinate rule, a constant term 1 is added to the two-dimensional pixel coordinates to construct a three-dimensional center pixel coordinate vector in the form of a column vector.
[0035] Optionally, the transformation matrix is a 3×3 matrix that realizes a two-dimensional mapping from the camera pixel coordinate system to the desktop world coordinate system. This structure is designed to accommodate the subsequent transformation from the center pixel coordinates to a three-dimensional homogeneous coordinate vector, satisfying the rules of matrix and vector multiplication. The row and column structure of the matrix is fixed, only the transformation coefficients to be solved are variables. The transformation coefficients are obtained by collecting the pixel coordinates of a preset reference point on the desktop and the actual world coordinates, analyzing the mapping relationship, and then combining them to realize the basic mapping from pixel coordinates to world coordinates. The compensation factor is a scalar compensation coefficient for the imaging distortion of the fisheye camera. It is calculated by combining the camera reference pixel coordinates, the distortion compensation coefficients obtained from experimental parameter tuning, and the planar distance between the center pixel coordinates of the target container and the reference point. It is used to correct the imaging distortion of the fisheye camera in the region far from the center, improving positioning accuracy. The transformation matrix is multiplied by the constructed three-dimensional center pixel coordinate vector; the product is the center transformed coordinate vector of the container.
[0036] Optionally, the obtained scalar compensation factor is multiplied by the center transformation coordinate vector. The product is the center compensation coordinate vector of the container. The center compensation coordinate vector is a three-dimensional homogeneous column vector, where the third element is a fixed constant term of homogeneous coordinates, 1, which has no actual spatial coordinate meaning. This three-dimensional vector is analyzed to extract the values of the first two dimensions, which are then combined to obtain the two-dimensional center compensation coordinates (x, y) of the container. These coordinates are the center world coordinates after distortion compensation. Since the robotic arm of the smart faucet only moves in a two-dimensional plane parallel to the table, and the planar calibration method ignores the coordinate change of the z-axis, it is only necessary to achieve (x, y) positioning in the table plane to meet the requirement of aligning the water outlet with the center of the container. Therefore, the two-dimensional center compensation coordinates (x, y) are used as the center world coordinates of the container, which are the final target coordinates of the robotic arm's movement. This process achieves a precise conversion from camera pixel coordinates to table world coordinates, which not only solves the problem of traditional hand-eye calibration requiring depth information but also corrects the imaging distortion of fisheye cameras, ultimately providing reliable target world coordinates for the precise movement of the robotic arm.
[0037] In an optional embodiment, the method for constructing the transformation matrix includes: Obtain the pixel coordinates of a preset number of reference points and the world coordinates corresponding to each of the reference points; The mapping relationship between the pixel coordinates of the reference points and the world coordinates corresponding to each reference point is analyzed to obtain several transformation coefficients; Based on the aforementioned transformation coefficients, the transformation matrix is constructed.
[0038] Optionally, the reference points need to be preset within the container placement area under the faucet, i.e., the desktop area covered by the robotic arm's movement. To ensure calibration accuracy, they can be distributed throughout the placement area. At least six sets of reference points are required, but in actual calibration, around 15 sets are typically collected. Images containing all reference points are captured using a fisheye camera mounted on the smart faucet. After image recognition processing, the two-dimensional coordinates (u, v) of each reference point in the camera's pixel coordinate system are extracted, which are the pixel coordinates of each reference point. A two-dimensional world coordinate system is established in the desktop container placement area. The actual two-dimensional coordinates (x, y) of each reference point in this world coordinate system are accurately measured using physical measurement tools, which are the corresponding world coordinates of each reference point. These world coordinates serve as the reference coordinates for the robotic arm's movement, directly determining the robotic arm's movement accuracy. Each reference point's pixel coordinates are mapped one-to-one with its world coordinates, forming multiple sets of calibration data pairs, which serve as the initial input for subsequent analysis of the mapping relationship.
[0039] Optionally, in this invention, the camera shoots the tabletop vertically downwards, and the robotic arm's motion plane is parallel to the tabletop plane. Therefore, the mapping from pixel coordinates to world coordinates is a homogeneous transformation relationship in a two-dimensional plane, and the transformation coefficient to be solved is a. 11 a 12 a 21 a 22 t x t y There are a total of 6 coefficients; these 6 transformation coefficients are divided into two categories, each corresponding to the core action of planar coordinate transformation, adapting to the planar motion requirements of the faucet robotic arm. 11 a 12 a 21 a 22 It is the product of the rotation and scaling matrices between the camera pixel coordinate system and the desktop world coordinate system, used to correct for angular and scale deviations between the two coordinate systems. x t y It is a translation coefficient used to correct the origin deviation between two coordinate systems, thereby achieving a positional translation from the origin of the pixel coordinate system to the origin of the world coordinate system.
[0040] Optionally, multiple sets of calibration data are substituted into the homogeneous transformation formula described above, and the least squares method is used for data fitting and solution. The least squares method minimizes the sum of squared errors between the world coordinates of the reference point calculated by the formula and the world coordinates of the actual physical measurement, thus obtaining the optimal approximation values of the six transformation coefficients. This solution method is suitable for fitting multiple sets of calibration data, effectively reducing the impact of single reference point measurement errors on the transformation coefficients and improving the overall accuracy of subsequent coordinate transformations. The six transformation coefficients obtained are filled into the transformation matrix, and the final transformation matrix is as follows: ; This transformation matrix is a fixed parameter matrix for the current faucet camera and desktop scene. Once calibrated, it can be used for a long time without repeated construction. It is the basic mapping to realize the camera pixel coordinate vector to the desktop world coordinate vector, and is the basis for subsequent calculation of the center pixel coordinate to the center transformed coordinate vector.
[0041] The transformation matrix is designed to fully adapt to the planar motion scenario of the faucet robotic arm. Compared with the traditional hand-eye calibration spatial transformation matrix, the coefficients related to the z-axis depth are omitted, which simplifies the calibration process and calculation logic, and avoids the dependence on depth cameras in traditional solutions. This achieves the effects of cost reduction and adaptation to the planar motion of the robotic arm. At the same time, the uniform distribution of reference points in the container placement area ensures the coordinate transformation accuracy of all positions within the robotic arm's motion range, laying the foundation for the accuracy of subsequent cup-finding and positioning.
[0042] In an optional embodiment, the method for determining the compensation factor includes: Obtain the baseline pixel coordinates, fixed constants, and distortion compensation coefficients; The target distance is obtained by determining the planar distance between the center pixel coordinates and the reference pixel coordinates. Determine the power of the target distance from the fixed constant to obtain the variable factor; The ratio of the distortion compensation coefficient to the variable factor is determined to obtain the compensation factor.
[0043] Optionally, the reference pixel coordinates refer to the center pixel coordinates of the fisheye camera's image, denoted as (u0, v0). This is the origin point of the fisheye camera's image distortion. The distortion spreads outwards from this point, becoming more severe with distance. These coordinates are inherent parameters of the camera. The fixed constant is the natural constant e, a fixed mathematical constant set in the scheme to match the exponential variation law of the fisheye camera's distortion. The degree of image distortion of the fisheye camera is exponentially related to the distance to the distortion center. Using the natural constant e as the base allows for accurate fitting of this distortion law, improving compensation accuracy. The distortion compensation coefficient is denoted as k, a specific compensation parameter obtained through experimental parameter tuning for the currently used fisheye camera. Different fisheye cameras have different lens distortion degrees, requiring multiple sets of actual positioning experiments for testing and adjustment to determine the optimal k value.
[0044] Optionally, the center pixel coordinates of the container to be located are (u, v) obtained from the segmentation model, and the reference pixel coordinates are (u0, v0) obtained in advance. Both are two-dimensional coordinates in the pixel coordinate system, and the planar distance can be directly calculated. The straight-line distance between two points is calculated using the two-dimensional planar Euclidean distance formula, which is: The calculated target distance l is a scalar in pixels and serves as the input for subsequent variable factors. Its value is positively correlated with the distortion degree of the fisheye camera, providing a quantitative basis for distortion compensation.
[0045] Optionally, the imaging distortion of a fisheye camera does not change linearly, but rather increases exponentially with increasing distance from the distortion center. Therefore, the variable factor obtained through exponential calculation can accurately match the variation law of distortion; the larger the target distance l, the greater the variable factor e. l The larger the value, the greater the correction magnitude during subsequent compensation, achieving a dynamic match between the degree of distortion and the correction magnitude. The distortion compensation coefficient is the dividend, and the variable factor is the divisor; the ratio of the two is... This is the compensation factor, a scalar whose value dynamically changes with the target distance *l*. When the container's center pixel coordinates are close to the reference pixel coordinates, a smaller *l* results in a larger compensation factor, indicating lower distortion and requiring only minor compensation. Conversely, when the container's center pixel coordinates are far from the reference pixel coordinates, a larger *l* results in a smaller compensation factor, indicating higher distortion and requiring significant compensation. This dynamically changing compensation factor enables precise distortion correction across the entire area of the fisheye camera's image, resolving issues such as container deformation and insufficient positioning accuracy caused by distortion correction.
[0046] S104. Control the robotic arm to move to the center world coordinates of the container.
[0047] Optionally, the control module of the smart faucet receives the world coordinates (x, y) of the container's center and parses the coordinate command to confirm that the coordinates are within the movement range of the robotic arm. Using a planar calibration method, only the x and y axis motion parameters of the two-dimensional plane are extracted after parsing, without needing to process the pose adjustment in the z-axis depth direction. Based on the center world coordinates combined with the kinematic parameters of the robotic arm, a precise motion control signal adapted to the robotic arm's drive mechanism is generated. Since the robotic arm only moves in a two-dimensional plane parallel to the table, the control signal only needs to specify the movement distance and direction of the robotic arm in the x and y directions, eliminating the need for complex spatial rotation and lifting commands, greatly simplifying the control logic. The generated motion control signal is transmitted to the robotic arm's drive mechanism, which, according to the signal, drives the outlet end of the robotic arm to perform a two-dimensional planar translational movement, ensuring that the physical position of the outlet precisely coincides with the center world coordinates of the container.
[0048] The entire process, from image recognition of the container to the robotic arm aligning with the container, is automated, eliminating the need for manual adjustment of the container or faucet position and improving the ease of use of smart faucets. The robotic arm moves based on precise global coordinates, aligning the water outlet with the center of the container to ensure that the water falls accurately into the container and avoids resource waste.
[0049] On the other hand, this application provides a container positioning device for a smart faucet; please refer to [link / reference]. Figure 2 , Figure 2 This is a schematic diagram of a container positioning device for a smart faucet according to an embodiment of the present invention. The container positioning device for the smart faucet includes: Acquisition module 201 is used to acquire target image information within the area where the container is placed; The segmentation module 202 is used to perform container edge segmentation processing on the target image information to obtain the center pixel coordinates of the container; The coordinate transformation module 203 is used to perform coordinate transformation and coordinate compensation processing on the coordinates of the center pixel to obtain the center world coordinates of the container. The control module 204 is used to control the robotic arm to move to the center world coordinates of the container.
[0050] In an optional embodiment, the segmentation module 202 includes: The model acquisition unit is used to acquire a segmentation model; the segmentation model is obtained by predicting and training the center pixel coordinates of the container based on historical image information and the center pixel coordinates of the container corresponding to the historical image information. The center pixel coordinate determination unit is used to input the target image information into the segmentation model, parse the target image information based on the segmentation model to obtain the contour information of the container, determine the contour center according to the contour information, and use the pixel coordinates of the contour center as the center pixel coordinates of the container.
[0051] In an optional embodiment, the coordinate transformation module 203 includes: The first coefficient acquisition unit is used to acquire the transformation matrix and compensation factor; A center pixel coordinate vector construction unit is used to construct a center pixel coordinate vector based on the center pixel coordinates; The center transformation coordinate vector determination unit is used to perform coordinate transformation processing on the center pixel coordinate vector based on the transformation matrix to obtain the center transformation coordinate vector of the container; The center compensation coordinate vector determination unit is used to perform coordinate compensation processing on the center transformation coordinate vector based on the compensation factor to obtain the center compensation coordinate vector of the container. A center compensation coordinate determination unit is used to parse the center compensation coordinate vector to obtain the center compensation coordinates of the container; and to use the center compensation coordinates of the container as the center world coordinates of the container.
[0052] In an optional embodiment, the coordinate transformation module 203 further includes: The reference point acquisition unit is used to acquire the pixel coordinates of a preset number of reference points and the world coordinates corresponding to each of the reference points; The conversion coefficient determination unit is used to analyze the mapping relationship between the pixel coordinates of the plurality of reference points and the world coordinates corresponding to each of the plurality of reference points to obtain a plurality of conversion coefficients; A transformation matrix construction unit is used to construct the transformation matrix based on the plurality of transformation coefficients.
[0053] In an optional embodiment, the coordinate transformation module 203 further includes: The second coefficient acquisition unit is used to acquire the reference pixel coordinates, fixed constants, and distortion compensation coefficients. The target distance determination unit is used to determine the planar distance between the center pixel coordinates and the reference pixel coordinates to obtain the target distance; A variable factor determination unit is used to determine the target distance power of the fixed constant to obtain the variable factor; The compensation factor determination unit is used to determine the ratio of the distortion compensation coefficient to the variable factor to obtain the compensation factor.
[0054] On the other hand, this application provides a smart faucet, which uses the container positioning method of the smart faucet as described in any of the above embodiments for container positioning.
[0055] The container positioning method for a smart faucet provided in this application includes a robotic arm and a container placement area corresponding to the container below the smart faucet. The method includes: acquiring target image information within the container placement area; performing container edge segmentation processing on the target image information to obtain the center pixel coordinates of the container; performing coordinate transformation and coordinate compensation processing on the center pixel coordinates to obtain the center world coordinates of the container; and controlling the robotic arm to move to the center world coordinates of the container. The container positioning method for a smart faucet provided in this application has the following beneficial effects: (1) The container positioning is achieved by using the planar calibration method, which does not rely on depth information. It uses a low-cost fisheye camera to reduce costs while having good versatility and scene adaptability. Furthermore, the planar calibration only needs to collect the two-dimensional pixel coordinates and world coordinates of the desktop reference point, without having to carry out a complex depth space calibration process, which also reduces the manpower and time costs in the calibration process. (2) By calibrating the relative relationship between the motion plane of the robotic arm and the table, the influence of the depth change of the z-axis can be ignored. There is no need to design a complex three-dimensional motion structure for the robotic arm, nor is there a need to reserve motion space in the depth direction. This makes the structural design of the robotic arm more compact and integrated, and adapts to the layout requirements of the faucet with limited overall height. At the same time, the robotic arm only needs to complete a two-dimensional translational motion parallel to the table, which improves the overall response speed from image acquisition to robotic arm positioning. (3) By calculating the plane distance between the center pixel coordinates of the container and the center of the camera, a compensation factor is obtained, and the coordinate transformation result is targeted to correct the distortion. The accuracy of the center world coordinates after distortion compensation is greatly improved, which can enable the robotic arm to move precisely to the center of the container, ensure that the water outlet of the faucet is precisely aligned with the center of the container, and the water can fall accurately into the container, avoiding waste of resources. (4) The container positioning process does not require manual intervention. Users do not need to deliberately adjust the placement of the container or manually operate the faucet, which improves the user's convenience and experience.
[0056] In an optional embodiment, this application provides an electronic device including a processor and a memory, wherein the memory stores at least one instruction or at least one program, the at least one instruction or at least one program being loaded and executed by the processor to implement the container positioning method of the smart faucet as described in any of the above embodiments.
[0057] In an optional embodiment, this application provides a computer-readable storage medium storing at least one instruction or at least one program segment, which is loaded and executed by a processor to implement the container positioning method of the smart faucet as described in any of the above embodiments.
[0058] The above description is only an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A container positioning method for a smart faucet, characterized in that, The smart faucet includes a robotic arm, and a container placement area corresponding to a container is provided below the smart faucet. The container positioning method of the smart faucet includes: Acquire target image information within the area where the container is placed; The target image information is subjected to container edge segmentation processing to obtain the center pixel coordinates of the container; The center pixel coordinates are subjected to coordinate transformation and coordinate compensation to obtain the center world coordinates of the container. Control the robotic arm to move to the center world coordinates of the container.
2. The container positioning method for a smart faucet according to claim 1, characterized in that, The step of performing container edge segmentation processing on the target image information to obtain the center pixel coordinates of the container includes: Obtain a segmentation model; the segmentation model is obtained by predicting and training the center pixel coordinates of the containers based on historical image information and the center pixel coordinates of the containers corresponding to the historical image information. The target image information is input into the segmentation model, and the target image information is parsed based on the segmentation model to obtain the contour information of the container. The contour center is determined according to the contour information, and the pixel coordinates of the contour center are used as the center pixel coordinates of the container.
3. The container positioning method for a smart faucet according to claim 1, characterized in that, The process of performing coordinate transformation and coordinate compensation on the center pixel coordinates to obtain the center world coordinates of the container includes: Obtain the transformation matrix and compensation factor; Construct a center pixel coordinate vector based on the center pixel coordinates; Based on the transformation matrix, the center pixel coordinate vector is transformed to obtain the center transformed coordinate vector of the container; Based on the compensation factor, coordinate compensation processing is performed on the center transformation coordinate vector to obtain the center compensation coordinate vector of the container; The center compensation coordinates of the container are obtained by analyzing the center compensation coordinate vector. The center compensation coordinates of the container are used as the center world coordinates of the container.
4. The container positioning method for a smart faucet according to claim 3, characterized in that, The method for constructing the transformation matrix includes: Obtain the pixel coordinates of a preset number of reference points and the world coordinates corresponding to each of the reference points; The mapping relationship between the pixel coordinates of the reference points and the world coordinates corresponding to each reference point is analyzed to obtain several transformation coefficients; Based on the aforementioned transformation coefficients, the transformation matrix is constructed.
5. The container positioning method for a smart faucet according to claim 3, characterized in that, The method for determining the compensation factor includes: Obtain the baseline pixel coordinates, fixed constants, and distortion compensation coefficients; The target distance is obtained by determining the planar distance between the center pixel coordinates and the reference pixel coordinates. Determine the power of the target distance from the fixed constant to obtain the variable factor; The ratio of the distortion compensation coefficient to the variable factor is determined to obtain the compensation factor.
6. The container positioning method for a smart faucet according to claim 3, characterized in that, The step of performing coordinate transformation processing on the center pixel coordinate vector based on the transformation matrix to obtain the center transformed coordinate vector of the container includes: The product of the transformation matrix and the center pixel coordinate vector is determined to obtain the center transformation coordinate vector of the container; The process of performing coordinate compensation processing on the center transformation coordinate vector based on the compensation factor to obtain the center compensation coordinate vector of the container includes: The product of the compensation factor and the center transformation coordinate vector is determined to obtain the center compensation coordinate vector of the container.
7. A container positioning device for an intelligent faucet, characterized in that, The container positioning device of the smart faucet includes: The acquisition module is used to acquire target image information within the area where the container is placed; The segmentation module is used to perform container edge segmentation processing on the target image information to obtain the center pixel coordinates of the container; The coordinate transformation module is used to perform coordinate transformation and coordinate compensation processing on the center pixel coordinates to obtain the center world coordinates of the container. The control module is used to control the robotic arm to move to the center world coordinates of the container.
8. A smart faucet, characterized in that, The smart faucet uses the container positioning method of the smart faucet as described in any one of claims 1-6 for container positioning.
9. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or at least one program being loaded and executed by the processor to implement the container positioning method of the smart faucet as described in any one of claims 1-6.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one instruction or at least one program, which is loaded and executed by a processor to implement the container positioning method of the smart faucet as described in any one of claims 1-6.