WO2024041181A1 - Image processing method and apparatus, and storage medium - Google Patents

Image processing method and apparatus, and storage medium Download PDF

Info

Publication number
WO2024041181A1
WO2024041181A1 PCT/CN2023/103359 CN2023103359W WO2024041181A1 WO 2024041181 A1 WO2024041181 A1 WO 2024041181A1 CN 2023103359 W CN2023103359 W CN 2023103359W WO 2024041181 A1 WO2024041181 A1 WO 2024041181A1
Authority
WO
WIPO (PCT)
Prior art keywords
spatial distribution
distribution map
target
map
target area
Prior art date
Application number
PCT/CN2023/103359
Other languages
French (fr)
Chinese (zh)
Inventor
杜明
郑佳
周子寒
Original Assignee
杭州群核信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 杭州群核信息技术有限公司 filed Critical 杭州群核信息技术有限公司
Publication of WO2024041181A1 publication Critical patent/WO2024041181A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/60Shadow generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/35Categorising the entire scene, e.g. birthday party or wedding scene
    • G06V20/36Indoor scenes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/70Labelling scene content, e.g. deriving syntactic or semantic representations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/04Architectural design, interior design
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/62Semi-transparency
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2215/00Indexing scheme for image rendering
    • G06T2215/12Shadow map, environment map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2215/00Indexing scheme for image rendering
    • G06T2215/16Using real world measurements to influence rendering

Definitions

  • the present disclosure relates to an image processing method, device and storage medium, and belongs to the technical field of image processing.
  • Related technical processing methods include: obtaining a floor plan, and using three-dimensional modeling and rendering based on the floor plan to simulate the display effects of floors of different materials and textures in the user's room.
  • a first aspect of an embodiment of the present disclosure provides an image processing method, including: obtaining a spatial distribution map of a target space collected by an image acquisition device; identifying a target area in the spatial distribution map, wherein the target area is The areas to be designed in the space are associated; the target pattern is obtained; and the pattern of the target area is replaced with the target pattern.
  • identifying the target area in the spatial distribution map includes: inputting the spatial distribution map to a semantic segmentation network to identify, through the semantic segmentation network, a region category to which at least one pixel in the spatial distribution map belongs; and , determine the pixels belonging to the target area according to the area category to which the at least one pixel belongs.
  • replacing the pattern of the target area with the target pattern includes: obtaining the correspondence between the three-dimensional spatial coordinates of the area to be designed in the target space and the two-dimensional image coordinates of the target area in the spatial distribution map; and, According to the corresponding relationship, the target pattern is projected to the target area in the spatial distribution map.
  • obtaining the correspondence between the three-dimensional spatial coordinates of the area to be designed in the target space and the two-dimensional image coordinates of the target area in the spatial distribution map includes: detecting the coordinates of the target area in the spatial distribution map through a vanishing point detection algorithm. the vanishing point; determine the focal length of the image acquisition device and the rotation matrix of the camera coordinate system and the world coordinate system based on the detected vanishing point; and determine the corresponding relationship based on the focal length and rotation matrix.
  • projecting the target pattern to the target area in the spatial distribution map according to the corresponding relationship includes: performing projection transformation on the target pattern according to the corresponding relationship to obtain the texture foreground of the target area; converting the spatial distribution map The brightness information is synthesized into the texture foreground; and the texture foreground after the brightness information is synthesized is synthesized with the spatial distribution map to obtain the target spatial distribution map.
  • synthesizing the texture foreground after synthesizing the brightness information and the spatial distribution map includes: determining the proportional relationship between the foreground and the background in the spatial distribution map; and, according to the proportional relationship, synthesizing the brightness information into the texture foreground.
  • the texture foreground is synthesized with the spatial distribution map.
  • determining the proportional relationship between the foreground and the background in the spatial distribution map includes: obtaining a pixel mask map of the spatial distribution map; and inputting the spatial distribution map and the pixel mask map into a matting neural network. , to determine the proportional relationship through the matting neural network.
  • inputting the spatial distribution map and the pixel mask map to the matting neural network includes: performing image enhancement on the pixel mask map; and inputting the spatial distribution map and the enhanced pixel mask map into Cutout neural network.
  • performing image enhancement on the pixel mask map includes: extracting the topological skeleton of the pixel mask map; performing dilation and erosion on the pixel mask map; and superimposing the topological skeleton and the pixel mask map after dilation and erosion. , to obtain the enhanced pixel mask map.
  • a second aspect of the embodiment of the present disclosure provides an image processing device, including a memory and a processor.
  • the memory stores at least one program instruction.
  • the processor loads and executes the at least one program instruction to implement the third embodiment of the present disclosure.
  • An aspect provides image processing methods.
  • a third aspect of an embodiment of the present disclosure provides a computer-readable storage medium.
  • the computer-readable storage medium stores at least one program instruction.
  • the third embodiment of the present disclosure is implemented.
  • An aspect provides image processing methods.
  • Figure 1 is a schematic flowchart of an image processing method provided by an embodiment of the present disclosure.
  • Figure 2 is a possible schematic diagram of the obtained spatial distribution map provided by the embodiment of the present disclosure.
  • Figure 3 is a mask map generated based on the spatial distribution map shown in Figure 2 provided by an embodiment of the present disclosure.
  • FIG. 4 is a possible schematic diagram of a user-selected target pattern provided by an embodiment of the present disclosure.
  • FIG. 5 is a possible schematic diagram of a texture foreground obtained by projecting the target pattern shown in FIG. 4 provided by an embodiment of the present disclosure.
  • FIG. 6 is a schematic diagram of the principle of the proportional relationship between the foreground and the background provided by an embodiment of the present disclosure.
  • FIG. 7 is a schematic diagram of the proportional relationship between the foreground and the background of the spatial distribution diagram shown in FIG. 2 provided by an embodiment of the present disclosure.
  • FIG. 8 is a target spatial distribution diagram obtained by replacing the ground in the spatial distribution diagram shown in FIG. 2 with the target pattern shown in FIG. 4 provided by an embodiment of the present disclosure.
  • connection should be understood in a broad sense.
  • it can be a fixed connection or a detachable connection.
  • To connect, or to join in one piece; may be mechanical, It can also be an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be an internal connection between two components.
  • connection should be understood in a broad sense.
  • it can be a fixed connection or a detachable connection.
  • connection can be a fixed connection or a detachable connection.
  • To connect, or to join in one piece may be mechanical, It can also be an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be an internal connection between two components.
  • the display effect of floors/walls of different materials and textures in the user's room is usually simulated through three-dimensional modeling and rendering based on the floor plan.
  • this method is difficult to display the effect of existing soft furnishings in the user's home. Users can only imagine the effect of the actual floor/wall combined with soft furnishings through inaccurate display effects, which often leads to the failure of the actual decoration after completion. It was found that the situation was inconsistent with the original expectations, that is, the accuracy of the replacement effect generated by the above method was poor.
  • FIG. 1 a schematic flowchart of an image processing method provided by an embodiment of the present disclosure is shown.
  • the image processing method includes S101, S102, S103, and S104.
  • the user can take photos of the target space through an image acquisition device to obtain a spatial distribution map.
  • the user can take a picture including the floor of the room; and for example, when the user wants to change the style of wall covering in the living room, the user can take a picture including the wall of the living room, etc.
  • this disclosure The embodiment does not limit this.
  • the image acquisition device can be a digital camera, a camera in a mobile phone, a camera in a computer, etc. That is to say, the image acquisition device in the embodiment of the present disclosure can be any form of device that can collect pictures.
  • the embodiment of the present disclosure is specific to it. The form is not limited.
  • the image processing device can obtain the captured room picture.
  • the spatial distribution map may also be a locally pre-stored photo or a photo from the Internet, which is not limited in this embodiment of the disclosure.
  • the target area in the spatial distribution map is identified, and the target area is related to the target area. associated with the area to be designed in the target space.
  • the target area in the spatial distribution map can be identified.
  • the target area is an area where the design pattern needs to be changed, that is, the area to be designed associated with the target area can be the floor and/or wall surface in the target space that needs to be transformed, etc.
  • the design pattern may include the color, texture, and/or pattern of the ceramic tiles, or may include the color and/or pattern of the wall covering, etc., which is not limited in the embodiments of the present disclosure.
  • identifying the target area in the spatial distribution map may include: inputting the spatial distribution map to a semantic segmentation network to identify, through the semantic segmentation network, a region category to which at least one pixel in the spatial distribution map belongs; and , determine the pixels belonging to the target area according to the area category to which the at least one pixel belongs.
  • the spatial distribution map can be input to the semantic segmentation network, and the regional category to which each pixel in the spatial distribution map belongs is identified through the semantic segmentation network.
  • the semantic segmentation network is a pre-trained and stored network model. After inputting the spatial distribution map into the semantic segmentation network, the semantic segmentation network can output a matrix of H*W*L, where W and H represent the length and width of the matrix, corresponding to each pixel in the spatial distribution map. . There is a vector V of length L at each pixel position, which represents the probability that the pixel belongs to L categories.
  • the L categories are L objects included in the spatial distribution map, and L is a positive integer greater than or equal to 1.
  • the L categories can be floor, wall, cabinet, and table. In practical applications, the L categories can also include target areas and non-target areas.
  • the L categories can include ground and non-ground.
  • each pixel belonging to the target area can be determined according to the area category to which each pixel belongs, and then the target area can be identified.
  • each pixel belonging to the target area can be determined according to the area category to which each pixel belongs, and then the area composed of each determined pixel is identified as the target area.
  • the area category corresponding to the maximum probability value in the corresponding vector V of length L can be determined to the area category to which the pixel belongs. For example, for a certain pixel, the vector V in the matrix is (ground: 0.7; non-ground: 0.3), then the pixel can be identified as a pixel on the ground.
  • a mask map can be generated based on the above matrix.
  • the mask map shown in Figure 3 can be generated.
  • the target pattern can be a graphic, pattern and/or pattern set by the user.
  • the user can select the target pattern from the pattern library, or upload the target pattern through a local file, which is not limited in the embodiment of the present disclosure.
  • FIG. 4 shows a possible schematic diagram of a target pattern selected by the user.
  • the content in the target area can be replaced with the target pattern.
  • replacing the pattern of the target area with the target pattern may include: obtaining the correspondence between the three-dimensional spatial coordinates of the area to be designed in the target space and the two-dimensional image coordinates of the target area in the spatial distribution map; and , according to the corresponding relationship, project the target pattern to the target area in the spatial distribution map.
  • embodiments of the present disclosure can obtain the corresponding relationship between the three-dimensional spatial coordinates of the area to be designed and the two-dimensional image coordinates of the target area.
  • obtaining the corresponding relationship between the three-dimensional spatial coordinates of the area to be designed in the target space and the two-dimensional image coordinates of the target area in the spatial distribution map may include: detecting the spatial distribution map through a vanishing point detection algorithm. the vanishing point in; determine the focal length of the image acquisition device and the rotation matrix of the camera coordinate system and the world coordinate system based on the detected vanishing point; and determine the corresponding relationship based on the focal length and rotation matrix.
  • the vanishing point in the spatial distribution map can be detected through the vanishing point detection algorithm, and then the focal length of the image acquisition device and the rotation matrix of the camera coordinate system and the world coordinate system are calculated based on the detected vanishing point; and then based on the calculated The focal length and rotation matrix determine the correspondence.
  • the focal length of the image capture device may be calculated based on the detected first vanishing point and the second vanishing point that is perpendicular to it (for example, a horizontal vanishing point and a vanishing point that is perpendicular to it).
  • r 2 and r 3 can be calculated using similar calculation methods, and then the rotation matrix can be restored.
  • the target pattern can be projected to the target area in the spatial distribution map.
  • projecting the target pattern to the target area in the spatial distribution map according to the corresponding relationship may include: performing projection transformation on the target pattern according to the corresponding relationship to obtain the texture foreground of the target area; converting the spatial distribution into The brightness information of the image is synthesized into the texture foreground; and the texture foreground after synthesizing the brightness information is synthesized with the spatial distribution map to obtain the target spatial distribution map.
  • the target pattern is projected and transformed according to the corresponding relationship to obtain the texture foreground of the target area. That is, the target pattern is projected and transformed according to the above corresponding relationship to obtain the texture foreground of the target area that conforms to the perspective relationship.
  • the texture foreground shown in Figure 5 can be obtained.
  • synthesizing the brightness information of the spatial distribution map into the texture foreground may include: synthesizing the brightness information of the spatial distribution map into the texture foreground obtained through projection transformation according to transparency (alpha channel) to simulate illumination and shadow.
  • the texture foreground after synthesizing the brightness information is synthesized with the spatial distribution map to obtain the target spatial distribution map, which may include: determining the The proportional relationship between the foreground and the background; and, according to the proportional relationship, the texture foreground and the spatial distribution map after synthesizing the brightness information are synthesized.
  • determining the proportional relationship between the foreground and the background in the spatial distribution map may include: obtaining a pixel mask map of the spatial distribution map; and inputting the spatial distribution map and the pixel mask map to the matting neural network. network to determine proportional relationships through matting neural networks.
  • the pixel mask map may be the mask map obtained through the semantic segmentation network in S102. That is, obtaining the pixel mask map of the spatial distribution map may include: reading the mask obtained in S102. Code map.
  • inputting the spatial distribution map and the pixel mask map into the matting neural network may include: performing image enhancement on the pixel mask map; and inputting the spatial distribution map and the enhanced pixel mask map. To the cutout neural network.
  • the pixel mask map before inputting the spatial distribution map and pixel mask map into the matting neural network, the pixel mask map can be image enhanced first, and then the enhanced pixel mask map and spatial The distribution map is input to the matting neural network.
  • performing image enhancement on the pixel mask map may include: extracting the topological skeleton of the pixel mask map; performing dilation and erosion on the pixel mask map; and superimposing the topological skeleton and the pixel mask map after dilation and erosion to obtain Enhanced pixel mask image.
  • the pixel mask map can also be image enhanced through other image enhancement methods, and the embodiments of the present disclosure do not limit its specific implementation.
  • any picture C can be regarded as the linear addition of two images, foreground F and background B, through the alpha channel.
  • the proportional relationship between the foreground and the background refers to the value of ⁇ , which determines the proportion of foreground pixels and background pixels that each pixel of the picture is synthesized from.
  • the proportional relationship between the foreground and the background as shown in Figure 7 can be output.
  • the target spatial distribution map After synthesizing the texture foreground and spatial distribution map after synthesizing the brightness information according to the proportional relationship, the target spatial distribution map can be obtained.
  • the target spatial distribution map shown in Figure 8 After replacing the ground of the spatial distribution map shown in Figure 2 with the target pattern shown in Figure 4 (that is, the texture foreground shown in Figure 5 after synthesizing the brightness information), you can The target spatial distribution map shown in Figure 8 is obtained.
  • the related technology is solved
  • the replacement can be combined with the spatial distribution map obtained by shooting to improve the accuracy of the replacement result.
  • the embodiment of the present disclosure performs replacement through the photographed spatial distribution map, the user can intuitively view the overall effect of the replacement result, which improves the user experience.
  • the embodiment of the present disclosure uses a semantic segmentation network to identify the target area, so that the replacement result can be obtained in a short time, shortening the time consumption of pattern replacement, and improving the efficiency of replacement.
  • An embodiment of the present disclosure also provides an image processing device, including a memory and a processor. At least one program instruction is stored in the memory, and the processor loads and executes the at least one program instruction to implement the method as described above.
  • Embodiments of the present disclosure also provide a non-transitory computer-readable storage medium, in which at least one program instruction is stored, and the at least one program instruction is loaded and executed by the processor to implement the method as described above.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Computer Graphics (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Geometry (AREA)
  • Computational Linguistics (AREA)
  • Image Processing (AREA)

Abstract

The present disclosure relates to the technical field of image processing, and provides an image processing method and apparatus, and a storage medium. The image processing method comprises: obtaining a spatial distribution map of a target space acquired by an image acquisition device; identifying a target region in the spatial distribution map, wherein the target region is associated with a region to be designed in the target space; obtaining a target pattern; and replacing the pattern of the target region with the target pattern.

Description

图像处理方法、装置和存储介质Image processing method, device and storage medium 技术领域Technical field
本公开涉及一种图像处理方法、装置和存储介质,属于图像处理技术领域。The present disclosure relates to an image processing method, device and storage medium, and belongs to the technical field of image processing.
背景技术Background technique
在旧房改造、房屋局部设计、地毯瓷砖销售的场景下,客户往往希望替换房间局部的纹理材质,期望快速得到替换后的效果图。相关技术的处理方法包括:获取户型图,根据户型图通过三维建模再渲染的方式来模拟不同材质、纹理的地面在用户房间内的展示效果。In the scenarios of old house renovation, partial house design, and carpet and tile sales, customers often want to replace the texture materials of parts of the room and expect to quickly get the replacement renderings. Related technical processing methods include: obtaining a floor plan, and using three-dimensional modeling and rendering based on the floor plan to simulate the display effects of floors of different materials and textures in the user's room.
发明内容Contents of the invention
本公开实施例的第一个方面提供一种图像处理方法,包括:获取通过图像采集设备采集到的目标空间的空间分布图;识别在空间分布图中的目标区域,其中,目标区域与在目标空间中的待设计区域相关联;获取目标图样;以及,将目标区域的图样替换为目标图样。A first aspect of an embodiment of the present disclosure provides an image processing method, including: obtaining a spatial distribution map of a target space collected by an image acquisition device; identifying a target area in the spatial distribution map, wherein the target area is The areas to be designed in the space are associated; the target pattern is obtained; and the pattern of the target area is replaced with the target pattern.
在一种实施方式中,识别在空间分布图中的目标区域,包括:将空间分布图输入至语义分割网络,以通过语义分割网络识别在空间分布图中的至少一个像素所属的区域类别;以及,根据该至少一个像素所属的区域类别,确定属于目标区域的像素。In one embodiment, identifying the target area in the spatial distribution map includes: inputting the spatial distribution map to a semantic segmentation network to identify, through the semantic segmentation network, a region category to which at least one pixel in the spatial distribution map belongs; and , determine the pixels belonging to the target area according to the area category to which the at least one pixel belongs.
在一种实施方式中,将目标区域的图样替换为目标图样,包括:获取待设计区域在目标空间中的三维空间坐标与目标区域在空间分布图中的二维图像坐标的对应关系;以及,根据对应关系,将目标图样投影至在空间分布图中的目标区域。In one embodiment, replacing the pattern of the target area with the target pattern includes: obtaining the correspondence between the three-dimensional spatial coordinates of the area to be designed in the target space and the two-dimensional image coordinates of the target area in the spatial distribution map; and, According to the corresponding relationship, the target pattern is projected to the target area in the spatial distribution map.
在一种实施方式中,获取待设计区域在目标空间中的三维空间坐标与目标区域在空间分布图中的二维图像坐标的对应关系,包括:通过消失点检测算法,检测在空间分布图中的消失点;根据检测得到的消失点,确定图像采集设备的焦距以及相机坐标系和世界坐标系的旋转矩阵;以及,根据焦距和旋转矩阵,确定对应关系。 In one implementation, obtaining the correspondence between the three-dimensional spatial coordinates of the area to be designed in the target space and the two-dimensional image coordinates of the target area in the spatial distribution map includes: detecting the coordinates of the target area in the spatial distribution map through a vanishing point detection algorithm. the vanishing point; determine the focal length of the image acquisition device and the rotation matrix of the camera coordinate system and the world coordinate system based on the detected vanishing point; and determine the corresponding relationship based on the focal length and rotation matrix.
在一种实施方式中,根据对应关系,将目标图样投影至在空间分布图中的目标区域,包括:根据对应关系,对目标图样进行投影变换,以得到目标区域的纹理前景;将空间分布图的亮度信息合成至纹理前景;以及,将合成亮度信息后的纹理前景与空间分布图进行合成,以得到目标空间分布图。In one embodiment, projecting the target pattern to the target area in the spatial distribution map according to the corresponding relationship includes: performing projection transformation on the target pattern according to the corresponding relationship to obtain the texture foreground of the target area; converting the spatial distribution map The brightness information is synthesized into the texture foreground; and the texture foreground after the brightness information is synthesized is synthesized with the spatial distribution map to obtain the target spatial distribution map.
在一种实施方式中,将合成亮度信息后的纹理前景与空间分布图进行合成,包括:确定在空间分布图中的前景和背景的比例关系;以及,根据比例关系,将合成亮度信息后的纹理前景与空间分布图进行合成。In one embodiment, synthesizing the texture foreground after synthesizing the brightness information and the spatial distribution map includes: determining the proportional relationship between the foreground and the background in the spatial distribution map; and, according to the proportional relationship, synthesizing the brightness information into the texture foreground. The texture foreground is synthesized with the spatial distribution map.
在一种实施方式中,确定在空间分布图中的前景和背景的比例关系,包括:获取空间分布图的像素掩码图;以及,将空间分布图以及像素掩码图输入至抠图神经网络,以通过抠图神经网络确定比例关系。In one implementation, determining the proportional relationship between the foreground and the background in the spatial distribution map includes: obtaining a pixel mask map of the spatial distribution map; and inputting the spatial distribution map and the pixel mask map into a matting neural network. , to determine the proportional relationship through the matting neural network.
在一种实施方式中,将空间分布图以及像素掩码图输入至抠图神经网络,包括:对像素掩码图进行图像增强;以及,将空间分布图以及增强后的像素掩码图输入至抠图神经网络。In one implementation, inputting the spatial distribution map and the pixel mask map to the matting neural network includes: performing image enhancement on the pixel mask map; and inputting the spatial distribution map and the enhanced pixel mask map into Cutout neural network.
在一种实施方式中,对像素掩码图进行图像增强,包括:提取像素掩码图的拓扑骨架;对像素掩码图进行膨胀腐蚀;以及,叠加拓扑骨架和膨胀腐蚀后的像素掩码图,以得到增强后的像素掩码图。In one embodiment, performing image enhancement on the pixel mask map includes: extracting the topological skeleton of the pixel mask map; performing dilation and erosion on the pixel mask map; and superimposing the topological skeleton and the pixel mask map after dilation and erosion. , to obtain the enhanced pixel mask map.
本公开实施例的第二个方面提供一种图像处理装置,包括存储器和处理器,存储器中存储有至少一条程序指令,处理器通过加载并执行该至少一条程序指令以实现本公开实施例的第一个方面提供的图像处理方法。A second aspect of the embodiment of the present disclosure provides an image processing device, including a memory and a processor. The memory stores at least one program instruction. The processor loads and executes the at least one program instruction to implement the third embodiment of the present disclosure. An aspect provides image processing methods.
本公开实施例的第三个方面提供一种计算机可读存储介质,计算机可读存储介质中存储有至少一条程序指令,该至少一条程序指令被处理器加载并执行时实现本公开实施例的第一个方面提供的图像处理方法。A third aspect of an embodiment of the present disclosure provides a computer-readable storage medium. The computer-readable storage medium stores at least one program instruction. When the at least one program instruction is loaded and executed by a processor, the third embodiment of the present disclosure is implemented. An aspect provides image processing methods.
附图说明Description of drawings
图1为本公开实施例提供的图像处理方法的流程示意图。 Figure 1 is a schematic flowchart of an image processing method provided by an embodiment of the present disclosure.
图2为本公开实施例提供的获取到的空间分布图的一种可能的示意图。Figure 2 is a possible schematic diagram of the obtained spatial distribution map provided by the embodiment of the present disclosure.
图3为本公开实施例提供的基于图2所示的空间分布图生成的掩码图。Figure 3 is a mask map generated based on the spatial distribution map shown in Figure 2 provided by an embodiment of the present disclosure.
图4为本公开实施例提供的用户选择的目标图样的一种可能的示意图。FIG. 4 is a possible schematic diagram of a user-selected target pattern provided by an embodiment of the present disclosure.
图5为本公开实施例提供的对图4所示的目标图样进行投影得到的纹理前景的一种可能的示意图。FIG. 5 is a possible schematic diagram of a texture foreground obtained by projecting the target pattern shown in FIG. 4 provided by an embodiment of the present disclosure.
图6为本公开实施例提供的前景和背景的比例关系的原理示意图。FIG. 6 is a schematic diagram of the principle of the proportional relationship between the foreground and the background provided by an embodiment of the present disclosure.
图7为本公开实施例提供的图2所示的空间分布图的前景和背景的比例关系的示意图。FIG. 7 is a schematic diagram of the proportional relationship between the foreground and the background of the spatial distribution diagram shown in FIG. 2 provided by an embodiment of the present disclosure.
图8为本公开实施例提供的将图2所示的空间分布图中的地面替换为图4所示的目标图样得到的目标空间分布图。FIG. 8 is a target spatial distribution diagram obtained by replacing the ground in the spatial distribution diagram shown in FIG. 2 with the target pattern shown in FIG. 4 provided by an embodiment of the present disclosure.
具体实施方式Detailed ways
下面将结合附图对本公开的技术方案进行清楚、完整地描述,显然,所描述的实施例是本公开的一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本公开的保护范围。The technical solutions of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are some of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the protection scope of the present disclosure.
在本公开的描述中,需要说明的是,术语“中心”、“上”、“下”、“左”、“右”、“竖直”、“水平”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本公开和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本公开的限制。此外,术语“第一”、“第二”、“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性。In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. The indicated orientation or positional relationship is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present disclosure and simplifying the description. It does not indicate or imply that the indicated device or element must have a specific orientation or a specific orientation. construction and operation, and therefore should not be construed as limitations on the present disclosure. Furthermore, the terms “first”, “second” and “third” are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
在本公开的描述中,需要说明的是,除非另有明确的规定和限定,术语“安装”、“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接, 也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,可以是两个元件内部的连通。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本公开中的具体含义。In the description of the present disclosure, it should be noted that, unless otherwise clearly stated and limited, the terms "installation", "connection" and "connection" should be understood in a broad sense. For example, it can be a fixed connection or a detachable connection. To connect, or to join in one piece; may be mechanical, It can also be an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be an internal connection between two components. For those of ordinary skill in the art, the specific meanings of the above terms in this disclosure can be understood on a case-by-case basis.
此外,下面所描述的本公开不同实施方式中所涉及的技术特征只要彼此之间未构成冲突就可以相互结合。In addition, the technical features involved in different embodiments of the present disclosure described below can be combined with each other as long as they do not conflict with each other.
在相关技术中,通常根据户型图通过三维建模再渲染的方式来模拟不同材质、纹理的地/墙面等在用户房间内的展示效果。但该方法很难展示用户家中已有的软装家具的效果,用户只能通过不精确的展示效果去想象实际的地/墙面结合软装家具之后的效果,这往往导致了实际装修完成之后发现与当初预期不符的情况,也即上述方法中生成的替换效果的准确率较差。In related technologies, the display effect of floors/walls of different materials and textures in the user's room is usually simulated through three-dimensional modeling and rendering based on the floor plan. However, this method is difficult to display the effect of existing soft furnishings in the user's home. Users can only imagine the effect of the actual floor/wall combined with soft furnishings through inaccurate display effects, which often leads to the failure of the actual decoration after completion. It was found that the situation was inconsistent with the original expectations, that is, the accuracy of the replacement effect generated by the above method was poor.
为解决上述技术问题,本公开实施例提供一种图像处理方法。参考图1,其示出了本公开实施例提供的图像处理方法的流程示意图,该图像处理方法包括S101、S102、S103和S104。In order to solve the above technical problems, embodiments of the present disclosure provide an image processing method. Referring to FIG. 1 , a schematic flowchart of an image processing method provided by an embodiment of the present disclosure is shown. The image processing method includes S101, S102, S103, and S104.
在S101中,获取通过图像采集设备采集到的目标空间的空间分布图。In S101, obtain the spatial distribution map of the target space collected by the image acquisition device.
在用户需要更改某一空间的装修设计进而预览更改后的设计效果时,用户可以通过图像采集设备拍摄该目标空间的照片,进而得到空间分布图。比如,在用户想要更改房间的地砖款式时,用户可以拍摄包括房间地面的图片;又比如,在用户想要更改客厅墙布款式时,用户可以拍摄包括客厅墙面的图片等等,本公开实施例对此不作限定。When the user needs to change the decoration design of a certain space and preview the changed design effect, the user can take photos of the target space through an image acquisition device to obtain a spatial distribution map. For example, when the user wants to change the style of floor tiles in the room, the user can take a picture including the floor of the room; and for example, when the user wants to change the style of wall covering in the living room, the user can take a picture including the wall of the living room, etc., this disclosure The embodiment does not limit this.
图像采集设备可以为数码相机、手机中的相机、电脑中的摄像头等等,也即在本公开实施例中的图像采集设备可以为任意形式的可以采集图片的装置,本公开实施例对其具体形式不作限定。The image acquisition device can be a digital camera, a camera in a mobile phone, a camera in a computer, etc. That is to say, the image acquisition device in the embodiment of the present disclosure can be any form of device that can collect pictures. The embodiment of the present disclosure is specific to it. The form is not limited.
例如,若用户想要更改房间的地砖纹理,则用户可以拍摄得到如图2所示的房间图片。相应地,图像处理装置可以获取该拍摄得到的房间图片。For example, if the user wants to change the floor tile texture of the room, the user can take a picture of the room as shown in Figure 2. Correspondingly, the image processing device can obtain the captured room picture.
在一种实施方式中,空间分布图也可以为本地预先存储的照片,也可以为来自互联网的照片,本公开实施例对此不作限定。In one implementation, the spatial distribution map may also be a locally pre-stored photo or a photo from the Internet, which is not limited in this embodiment of the disclosure.
在S102中,识别在空间分布图中的目标区域,目标区域与在目 标空间中的待设计区域相关联。In S102, the target area in the spatial distribution map is identified, and the target area is related to the target area. associated with the area to be designed in the target space.
在获取得到空间分布图之后,可以识别在空间分布图中的目标区域。目标区域为需要更改设计图样的区域,也即与目标区域相关联的待设计区域可以为在目标空间中的需要改造的地面和/或墙面等等。设计图样可以包括瓷砖的颜色、纹理,和/或花色,或者可以包括墙布的颜色和/或花色等等,本公开实施例对此不作限定。After obtaining the spatial distribution map, the target area in the spatial distribution map can be identified. The target area is an area where the design pattern needs to be changed, that is, the area to be designed associated with the target area can be the floor and/or wall surface in the target space that needs to be transformed, etc. The design pattern may include the color, texture, and/or pattern of the ceramic tiles, or may include the color and/or pattern of the wall covering, etc., which is not limited in the embodiments of the present disclosure.
在一种实施方式中,识别在空间分布图中的目标区域可以包括:将空间分布图输入至语义分割网络,以通过语义分割网络识别在空间分布图中的至少一个像素所属的区域类别;以及,根据该至少一个像素所属的区域类别,确定属于目标区域的像素。In one embodiment, identifying the target area in the spatial distribution map may include: inputting the spatial distribution map to a semantic segmentation network to identify, through the semantic segmentation network, a region category to which at least one pixel in the spatial distribution map belongs; and , determine the pixels belonging to the target area according to the area category to which the at least one pixel belongs.
也就是说,可以将空间分布图输入至语义分割网络,通过语义分割网络识别空间分布图中的各个像素所属的区域类别。That is to say, the spatial distribution map can be input to the semantic segmentation network, and the regional category to which each pixel in the spatial distribution map belongs is identified through the semantic segmentation network.
语义分割网络为预先训练并存储的网络模型。在将空间分布图输入至语义分割网络之后,语义分割网络即可输出得到H*W*L的矩阵,其中,W和H代表矩阵的长和宽,与在空间分布图中的各个像素点对应。每个像素点位置上有一个长度为L的向量V,该向量V表示该像素分别属于L个类别的概率大小。L个类别为在空间分布图中包括的L个对象,L为大于等于1的正整数。比如,对于图2所示的空间分布图,L个类别可以为地面、墙面、柜子和桌子。在实际应用中,L个类别还可以包括目标区域和非目标区域。比如,对于图2所示的空间分布图,L个类别可以包括地面和非地面。The semantic segmentation network is a pre-trained and stored network model. After inputting the spatial distribution map into the semantic segmentation network, the semantic segmentation network can output a matrix of H*W*L, where W and H represent the length and width of the matrix, corresponding to each pixel in the spatial distribution map. . There is a vector V of length L at each pixel position, which represents the probability that the pixel belongs to L categories. The L categories are L objects included in the spatial distribution map, and L is a positive integer greater than or equal to 1. For example, for the spatial distribution map shown in Figure 2, the L categories can be floor, wall, cabinet, and table. In practical applications, the L categories can also include target areas and non-target areas. For example, for the spatial distribution map shown in Figure 2, the L categories can include ground and non-ground.
之后,可以根据各个像素所属的区域类别,确定属于目标区域的各个像素,进而识别得到目标区域。在语义分割网络输出上述矩阵之后,即可根据各个像素点所属的区域类别确定属于目标区域的各个像素点,进而将确定的各个像素点所组成的区域识别为目标区域。Afterwards, each pixel belonging to the target area can be determined according to the area category to which each pixel belongs, and then the target area can be identified. After the semantic segmentation network outputs the above matrix, each pixel belonging to the target area can be determined according to the area category to which each pixel belongs, and then the area composed of each determined pixel is identified as the target area.
在一种实施方式中,针对任一像素,可以确定在与之对应的长度为L的向量V中的最大概率值所对应的区域类别为该像素点所属的区域类别。比如,对于某一像素点,矩阵中的向量V为(地面:0.7;非地面:0.3),则可以将该像素点识别为地面中的像素点。In one implementation, for any pixel, the area category corresponding to the maximum probability value in the corresponding vector V of length L can be determined to the area category to which the pixel belongs. For example, for a certain pixel, the vector V in the matrix is (ground: 0.7; non-ground: 0.3), then the pixel can be identified as a pixel on the ground.
在一种实施方式中,可以根据上述矩阵生成掩码图,掩码图中 包括经过上述识别后的各个区域。比如,对于图2所示的空间分布图,可以生成图3所示的掩码图。In one implementation, a mask map can be generated based on the above matrix. In the mask map Including each area after the above identification. For example, for the spatial distribution map shown in Figure 2, the mask map shown in Figure 3 can be generated.
在S103中,获取目标图样。In S103, the target pattern is obtained.
目标图样可以为用户设置的图形、图案和/或图样等。在一种实施方式中,用户可以从图样库中选择目标图样,或者通过本地文件上传该目标图样,本公开实施例对此不作限定。例如,请参考图4,其示出了用户选择的目标图样的一种可能的示意图。The target pattern can be a graphic, pattern and/or pattern set by the user. In one implementation, the user can select the target pattern from the pattern library, or upload the target pattern through a local file, which is not limited in the embodiment of the present disclosure. For example, please refer to FIG. 4 , which shows a possible schematic diagram of a target pattern selected by the user.
在S104中,将目标区域的图样替换为目标图样。In S104, the pattern of the target area is replaced with the target pattern.
在确定目标区域以及目标区域的目标图样后,即可将目标区域中的内容替换为目标图样。After determining the target area and the target pattern of the target area, the content in the target area can be replaced with the target pattern.
在一种实施方式中,将目标区域的图样替换为目标图样,可以包括:获取待设计区域在目标空间中的三维空间坐标与目标区域在空间分布图中的二维图像坐标的对应关系;以及,根据对应关系,将目标图样投影至在空间分布图中的目标区域。In one embodiment, replacing the pattern of the target area with the target pattern may include: obtaining the correspondence between the three-dimensional spatial coordinates of the area to be designed in the target space and the two-dimensional image coordinates of the target area in the spatial distribution map; and , according to the corresponding relationship, project the target pattern to the target area in the spatial distribution map.
针对获取待设计区域的三维空间坐标与目标区域在空间分布图中的二维图像坐标的对应关系,由于图像采集设备获取空间分布图的相机坐标系和在三维空间中的世界坐标系不同,因此,本公开实施例为了保证替换后的目标空间分布图的精度,可以获取待设计区域的三维空间坐标与目标区域的二维图像坐标的对应关系。In order to obtain the corresponding relationship between the three-dimensional spatial coordinates of the area to be designed and the two-dimensional image coordinates of the target area in the spatial distribution map, since the camera coordinate system of the image acquisition device to obtain the spatial distribution map is different from the world coordinate system in the three-dimensional space, therefore In order to ensure the accuracy of the replaced target space distribution map, embodiments of the present disclosure can obtain the corresponding relationship between the three-dimensional spatial coordinates of the area to be designed and the two-dimensional image coordinates of the target area.
在一种实施方式中,获取待设计区域在目标空间中的三维空间坐标与目标区域在空间分布图中的二维图像坐标的对应关系,可以包括:通过消失点检测算法,检测在空间分布图中的消失点;根据检测得到的消失点,确定图像采集设备的焦距以及相机坐标系和世界坐标系的旋转矩阵;以及,根据焦距和旋转矩阵,确定对应关系。In one embodiment, obtaining the corresponding relationship between the three-dimensional spatial coordinates of the area to be designed in the target space and the two-dimensional image coordinates of the target area in the spatial distribution map may include: detecting the spatial distribution map through a vanishing point detection algorithm. the vanishing point in; determine the focal length of the image acquisition device and the rotation matrix of the camera coordinate system and the world coordinate system based on the detected vanishing point; and determine the corresponding relationship based on the focal length and rotation matrix.
也就是说,可以通过消失点检测算法检测在空间分布图中的消失点,再根据检测得到的消失点计算图像采集设备的焦距以及相机坐标系和世界坐标系的旋转矩阵;再根据计算得到的焦距和旋转矩阵确定对应关系。That is to say, the vanishing point in the spatial distribution map can be detected through the vanishing point detection algorithm, and then the focal length of the image acquisition device and the rotation matrix of the camera coordinate system and the world coordinate system are calculated based on the detected vanishing point; and then based on the calculated The focal length and rotation matrix determine the correspondence.
在一种实施方式中,可以根据检测得到的第一消失点和与之相互垂直的第二消失点(例如,水平消失点和与之相互垂直的消失点)来计算图像采集设备的焦距。具体地,假设相机坐标系的原点与世界 坐标系的原点重合,相机内参矩阵为相机坐标系与世界坐标系的旋转矩阵为R=[r1r2r3],位移为T=0,以第一消失点v1为例,其满足: In one implementation, the focal length of the image capture device may be calculated based on the detected first vanishing point and the second vanishing point that is perpendicular to it (for example, a horizontal vanishing point and a vanishing point that is perpendicular to it). Specifically, it is assumed that the origin of the camera coordinate system is The origins of the coordinate system coincide with each other, and the camera internal parameter matrix is The rotation matrix between the camera coordinate system and the world coordinate system is R=[r 1 r 2 r 3 ], and the displacement is T=0. Taking the first vanishing point v 1 as an example, it satisfies:
利用旋转矩阵的正交性,选取两个相互垂直的消失点vi和vj,由ri Trj=0,可推导出即可求解得到图像采集设备的焦距f。Using the orthogonality of the rotation matrix, two mutually perpendicular vanishing points v i and v j are selected. From r i T r j = 0, it can be derived The focal length f of the image acquisition device can be obtained by solving the problem.
对于旋转矩阵,则可以通过至少两个消失点进行恢复,本公开实施例对此不作限定。具体地,由上述公式即可得知:r1=K-1v1For the rotation matrix, it can be restored through at least two vanishing points, which is not limited in this embodiment of the disclosure. Specifically, it can be known from the above formula: r 1 =K -1 v 1 .
此后,采用类似计算方式即可计算得到r2和r3,进而恢复得到旋转矩阵。After that, r 2 and r 3 can be calculated using similar calculation methods, and then the rotation matrix can be restored.
在一种实施方式中,待设计区域(例如,地面)的三维空间坐标P与目标区域在空间分布图中的2D像素坐标(也即,二维图像坐标)p之间的对应关系为:p=K[R T]P=K[r1r2r3]P。In one implementation, the corresponding relationship between the three-dimensional spatial coordinate P of the area to be designed (for example, the ground) and the 2D pixel coordinate (that is, the two-dimensional image coordinate) p of the target area in the spatial distribution map is: p =K[RT]P=K[r 1 r 2 r 3 ]P.
在得到上述对应关系之后,即可将目标图样投影至在空间分布图中的目标区域。After obtaining the above corresponding relationship, the target pattern can be projected to the target area in the spatial distribution map.
在一种实施方式中,根据对应关系,将目标图样投影至在空间分布图中的目标区域,可以包括:根据对应关系,对目标图样进行投影变换,以得到目标区域的纹理前景;将空间分布图的亮度信息合成至纹理前景;以及,将合成亮度信息后的纹理前景与空间分布图进行合成,以得到目标空间分布图。In one embodiment, projecting the target pattern to the target area in the spatial distribution map according to the corresponding relationship may include: performing projection transformation on the target pattern according to the corresponding relationship to obtain the texture foreground of the target area; converting the spatial distribution into The brightness information of the image is synthesized into the texture foreground; and the texture foreground after synthesizing the brightness information is synthesized with the spatial distribution map to obtain the target spatial distribution map.
将目标图样根据对应关系进行投影变换,得到目标区域的纹理前景,也即将目标图样按照上述对应关系进行投影变换,得到符合透视关系的目标区域的纹理前景。比如,请参考图5,将对图4所示的目标图样进行投影变换之后,即可得到图5所示的纹理前景。The target pattern is projected and transformed according to the corresponding relationship to obtain the texture foreground of the target area. That is, the target pattern is projected and transformed according to the above corresponding relationship to obtain the texture foreground of the target area that conforms to the perspective relationship. For example, please refer to Figure 5. After projecting the target pattern shown in Figure 4, the texture foreground shown in Figure 5 can be obtained.
在一种实施方式中,将空间分布图的亮度信息合成至纹理前景,可以包括:将空间分布图的亮度信息按照透明度(alpha通道)合成至通过投影变换得到的纹理前景中,以模拟光照与阴影。 In one implementation, synthesizing the brightness information of the spatial distribution map into the texture foreground may include: synthesizing the brightness information of the spatial distribution map into the texture foreground obtained through projection transformation according to transparency (alpha channel) to simulate illumination and shadow.
在一种实施方式中,为了进一步提高目标空间分布图的替换效果,将合成亮度信息后的纹理前景与空间分布图进行合成,以得到目标空间分布图,可以包括:确定在空间分布图中的前景和背景的比例关系;以及,根据比例关系,将合成亮度信息后的纹理前景与空间分布图进行合成。In one embodiment, in order to further improve the replacement effect of the target spatial distribution map, the texture foreground after synthesizing the brightness information is synthesized with the spatial distribution map to obtain the target spatial distribution map, which may include: determining the The proportional relationship between the foreground and the background; and, according to the proportional relationship, the texture foreground and the spatial distribution map after synthesizing the brightness information are synthesized.
在一种实施方式中,确定在空间分布图中的前景和背景的比例关系,可以包括:获取空间分布图的像素掩码图;以及,将空间分布图以及像素掩码图输入至抠图神经网络,以通过抠图神经网络确定比例关系。In one embodiment, determining the proportional relationship between the foreground and the background in the spatial distribution map may include: obtaining a pixel mask map of the spatial distribution map; and inputting the spatial distribution map and the pixel mask map to the matting neural network. network to determine proportional relationships through matting neural networks.
在一种实施方式中,像素掩码图可以为在S102中通过语义分割网络得到的掩码图,也即,获取空间分布图的像素掩码图可以包括:读取在S102中获取得到的掩码图。In one implementation, the pixel mask map may be the mask map obtained through the semantic segmentation network in S102. That is, obtaining the pixel mask map of the spatial distribution map may include: reading the mask obtained in S102. Code map.
在一种实施方式中,将空间分布图以及像素掩码图输入至抠图神经网络,可以包括:对像素掩码图进行图像增强;以及,将空间分布图以及增强后的像素掩码图输入至抠图神经网络。In one implementation, inputting the spatial distribution map and the pixel mask map into the matting neural network may include: performing image enhancement on the pixel mask map; and inputting the spatial distribution map and the enhanced pixel mask map. To the cutout neural network.
也就是说,在实际应用中,在将空间分布图以及像素掩码图输入至抠图神经网络之前,可以先对像素掩码图进行图像增强,再将图像增强后的像素掩码图和空间分布图输入至抠图神经网络。That is to say, in practical applications, before inputting the spatial distribution map and pixel mask map into the matting neural network, the pixel mask map can be image enhanced first, and then the enhanced pixel mask map and spatial The distribution map is input to the matting neural network.
具体地,对像素掩码图进行图像增强,可以包括:提取像素掩码图的拓扑骨架;对像素掩码图进行膨胀腐蚀;以及,叠加拓扑骨架和膨胀腐蚀后的像素掩码图,以得到增强后的像素掩码图。Specifically, performing image enhancement on the pixel mask map may include: extracting the topological skeleton of the pixel mask map; performing dilation and erosion on the pixel mask map; and superimposing the topological skeleton and the pixel mask map after dilation and erosion to obtain Enhanced pixel mask image.
在实际应用中,还可以通过其它图像增强方式对像素掩码图进行图像增强,本公开实施例对其具体实现不作限定。In practical applications, the pixel mask map can also be image enhanced through other image enhancement methods, and the embodiments of the present disclosure do not limit its specific implementation.
任意一张图片C可以看作是由前景F和背景B两张图像经过alpha通道线性相加得到。比如,请参考图6,在本公开实施例中的前景和背景的比例关系指的是α的值,该值决定了图片的每个像素是由多少比例的前景像素和背景像素合成得到的。Any picture C can be regarded as the linear addition of two images, foreground F and background B, through the alpha channel. For example, please refer to Figure 6. In the embodiment of the present disclosure, the proportional relationship between the foreground and the background refers to the value of α, which determines the proportion of foreground pixels and background pixels that each pixel of the picture is synthesized from.
比如,在将如图3所示的掩码图的增强结果以及如图2所示的空间分布图输入至抠图神经网络之后,即可输出如图7所示的前景和背景的比例关系。 For example, after inputting the enhanced result of the mask map as shown in Figure 3 and the spatial distribution map as shown in Figure 2 to the matting neural network, the proportional relationship between the foreground and the background as shown in Figure 7 can be output.
将合成亮度信息后的纹理前景与空间分布图按照比例关系进行合成后,即可得到目标空间分布图。在上述举例中,在将如图2所示的空间分布图的地面替换为如图4所示的目标图样(也即,合成亮度信息后的、图5所示的纹理前景)之后,即可得到图8所示的目标空间分布图。After synthesizing the texture foreground and spatial distribution map after synthesizing the brightness information according to the proportional relationship, the target spatial distribution map can be obtained. In the above example, after replacing the ground of the spatial distribution map shown in Figure 2 with the target pattern shown in Figure 4 (that is, the texture foreground shown in Figure 5 after synthesizing the brightness information), you can The target spatial distribution map shown in Figure 8 is obtained.
综上所述,通过获取通过图像采集设备采集到的目标空间的空间分布图,识别在空间分布图中的目标区域,获取目标图样,以及将目标区域的图样替换为目标图样,解决了相关技术中由于缺少实际的场景信息进而导致替换效果较差的问题,实现了可以结合拍摄得到的空间分布图进行替换进而提高替换结果的准确率的效果。另外,由于本公开实施例通过拍摄得到的空间分布图进行替换,使得用户可以直观地查看替换结果的整体效果,提高了用户的体验。To sum up, by obtaining the spatial distribution map of the target space collected through the image acquisition device, identifying the target area in the spatial distribution map, obtaining the target pattern, and replacing the pattern of the target area with the target pattern, the related technology is solved In order to solve the problem of poor replacement effect due to the lack of actual scene information, the replacement can be combined with the spatial distribution map obtained by shooting to improve the accuracy of the replacement result. In addition, since the embodiment of the present disclosure performs replacement through the photographed spatial distribution map, the user can intuitively view the overall effect of the replacement result, which improves the user experience.
此外,本公开实施例通过语义分割网络来识别目标区域,从而可以在短时间内得到替换结果,缩短了图样替换的耗时,提高了替换的效率。In addition, the embodiment of the present disclosure uses a semantic segmentation network to identify the target area, so that the replacement result can be obtained in a short time, shortening the time consumption of pattern replacement, and improving the efficiency of replacement.
本公开实施例还提供了一种图像处理装置,包括存储器和处理器,存储器中存储有至少一条程序指令,处理器通过加载并执行该至少一条程序指令以实现如上所述的方法。An embodiment of the present disclosure also provides an image processing device, including a memory and a processor. At least one program instruction is stored in the memory, and the processor loads and executes the at least one program instruction to implement the method as described above.
本公开实施例还提供了一种非瞬时计算机可读存储介质,计算机可读存储介质中存储有至少一条程序指令,该至少一条程序指令被处理器加载并执行以实现如上所述的方法。Embodiments of the present disclosure also provide a non-transitory computer-readable storage medium, in which at least one program instruction is stored, and the at least one program instruction is loaded and executed by the processor to implement the method as described above.
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above-described embodiments can be combined in any way. To simplify the description, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, All should be considered to be within the scope of this manual.
以上所述实施例仅表达了本公开的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本公开的保护范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本公开的保护范围。因此,本公开的保护范围应以所附权利要求为准。 The above-described embodiments only express several implementation modes of the present disclosure, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present disclosure. It should be noted that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all fall within the protection scope of the present disclosure. Therefore, the scope of protection of the present disclosure should be determined by the appended claims.

Claims (11)

  1. 一种图像处理方法,包括:An image processing method including:
    获取通过图像采集设备采集到的目标空间的空间分布图;Obtain the spatial distribution map of the target space collected by the image acquisition device;
    识别在所述空间分布图中的目标区域,其中,所述目标区域与在所述目标空间中的待设计区域相关联;identifying a target area in the spatial distribution map, wherein the target area is associated with an area to be designed in the target space;
    获取目标图样;以及Obtain the target pattern; and
    将所述目标区域的图样替换为所述目标图样。Replace the pattern of the target area with the target pattern.
  2. 根据权利要求1所述的方法,其中,识别在所述空间分布图中的所述目标区域,包括:The method of claim 1, wherein identifying the target area in the spatial distribution map includes:
    将所述空间分布图输入至语义分割网络,以通过所述语义分割网络识别在所述空间分布图中的至少一个像素所属的区域类别;以及inputting the spatial distribution map to a semantic segmentation network to identify, through the semantic segmentation network, a region category to which at least one pixel in the spatial distribution map belongs; and
    根据所述至少一个像素所属的区域类别,确定属于所述目标区域的像素。The pixels belonging to the target area are determined according to the area category to which the at least one pixel belongs.
  3. 根据权利要求1所述的方法,其中,将所述目标区域的图样替换为所述目标图样,包括:The method according to claim 1, wherein replacing the pattern of the target area with the target pattern includes:
    获取所述待设计区域在所述目标空间中的三维空间坐标与所述目标区域在所述空间分布图中的二维图像坐标的对应关系;以及Obtain the corresponding relationship between the three-dimensional spatial coordinates of the area to be designed in the target space and the two-dimensional image coordinates of the target area in the spatial distribution map; and
    根据所述对应关系,将所述目标图样投影至在所述空间分布图中的所述目标区域。According to the corresponding relationship, the target pattern is projected to the target area in the spatial distribution map.
  4. 根据权利要求3所述的方法,其中,获取所述待设计区域在所述目标空间中的三维空间坐标与所述目标区域在所述空间分布图中的二维图像坐标的对应关系,包括:The method according to claim 3, wherein obtaining the corresponding relationship between the three-dimensional spatial coordinates of the area to be designed in the target space and the two-dimensional image coordinates of the target area in the spatial distribution map includes:
    通过消失点检测算法,检测在所述空间分布图中的消失点;Detect the vanishing point in the spatial distribution map through the vanishing point detection algorithm;
    根据检测得到的所述消失点,确定所述图像采集设备的焦距以及相机坐标系和世界坐标系的旋转矩阵;以及Determine the focal length of the image acquisition device and the rotation matrix of the camera coordinate system and the world coordinate system according to the detected vanishing point; and
    根据所述焦距和所述旋转矩阵,确定所述对应关系。 The corresponding relationship is determined based on the focal length and the rotation matrix.
  5. 根据权利要求3所述的方法,其中,根据所述对应关系,将所述目标图样投影至在所述空间分布图中的所述目标区域,包括:The method of claim 3, wherein projecting the target pattern to the target area in the spatial distribution map according to the corresponding relationship includes:
    根据所述对应关系,对所述目标图样进行投影变换,以得到所述目标区域的纹理前景;According to the corresponding relationship, perform projection transformation on the target pattern to obtain the texture foreground of the target area;
    将所述空间分布图的亮度信息合成至所述纹理前景;以及Synthesize the brightness information of the spatial distribution map to the texture foreground; and
    将合成亮度信息后的纹理前景与所述空间分布图进行合成,以得到目标空间分布图。The texture foreground after synthesizing the brightness information is synthesized with the spatial distribution map to obtain the target spatial distribution map.
  6. 根据权利要求5所述的方法,其中,将所述合成亮度信息后的纹理前景与所述空间分布图进行合成,包括:The method according to claim 5, wherein synthesizing the texture foreground after synthesizing the brightness information and the spatial distribution map includes:
    确定在所述空间分布图中的前景和背景的比例关系;以及determining the proportional relationship between foreground and background in the spatial distribution map; and
    根据所述比例关系,将所述合成亮度信息后的纹理前景与所述空间分布图进行合成。According to the proportional relationship, the texture foreground after synthesizing the brightness information is synthesized with the spatial distribution map.
  7. 根据权利要求6所述的方法,其中,确定在所述空间分布图中的所述前景和所述背景的所述比例关系,包括:The method of claim 6, wherein determining the proportional relationship between the foreground and the background in the spatial distribution map includes:
    获取所述空间分布图的像素掩码图;以及Obtain a pixel mask map of the spatial distribution map; and
    将所述空间分布图以及所述像素掩码图输入至抠图神经网络,以通过所述抠图神经网络确定所述比例关系。The spatial distribution map and the pixel mask map are input to a matting neural network to determine the proportional relationship through the matting neural network.
  8. 根据权利要求7所述的方法,其中,将所述空间分布图以及所述像素掩码图输入至所述抠图神经网络,包括:The method according to claim 7, wherein inputting the spatial distribution map and the pixel mask map to the matting neural network includes:
    对所述像素掩码图进行图像增强;以及Perform image enhancement on the pixel mask map; and
    将所述空间分布图以及增强后的像素掩码图输入至所述抠图神经网络。The spatial distribution map and the enhanced pixel mask map are input to the matting neural network.
  9. 根据权利要求8所述的方法,其中,对所述像素掩码图进行图像增强,包括:The method according to claim 8, wherein performing image enhancement on the pixel mask map includes:
    提取所述像素掩码图的拓扑骨架;Extract the topological skeleton of the pixel mask map;
    对所述像素掩码图进行膨胀腐蚀;以及 Perform dilation and erosion on the pixel mask map; and
    叠加所述拓扑骨架和膨胀腐蚀后的像素掩码图,以得到所述增强后的像素掩码图。The topological skeleton and the pixel mask map after dilation and erosion are superimposed to obtain the enhanced pixel mask map.
  10. 一种图像处理装置,包括存储器和处理器,所述存储器中存储有至少一条程序指令,所述处理器通过加载并执行所述至少一条程序指令以实现根据权利要求1至9中任一所述的方法。An image processing device, including a memory and a processor. At least one program instruction is stored in the memory. The processor loads and executes the at least one program instruction to implement the method according to any one of claims 1 to 9. Methods.
  11. 一种计算机可读存储介质,存储有至少一条程序指令,所述至少一条程序指令被处理器加载并执行时实现根据权利要求1至9中任一所述的方法。 A computer-readable storage medium stores at least one program instruction. When the at least one program instruction is loaded and executed by a processor, the method according to any one of claims 1 to 9 is implemented.
PCT/CN2023/103359 2022-08-26 2023-06-28 Image processing method and apparatus, and storage medium WO2024041181A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211035709.6 2022-08-26
CN202211035709.6A CN115359169A (en) 2022-08-26 2022-08-26 Image processing method, apparatus and storage medium

Publications (1)

Publication Number Publication Date
WO2024041181A1 true WO2024041181A1 (en) 2024-02-29

Family

ID=84005320

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/103359 WO2024041181A1 (en) 2022-08-26 2023-06-28 Image processing method and apparatus, and storage medium

Country Status (2)

Country Link
CN (1) CN115359169A (en)
WO (1) WO2024041181A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115359169A (en) * 2022-08-26 2022-11-18 杭州群核信息技术有限公司 Image processing method, apparatus and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190026900A1 (en) * 2017-06-19 2019-01-24 Digitalbridge System and method for modeling a three dimensional space based on a two dimensional image
CN112116620A (en) * 2020-09-16 2020-12-22 北京交通大学 Indoor image semantic segmentation and painting display method
CN112712487A (en) * 2020-12-23 2021-04-27 北京软通智慧城市科技有限公司 Scene video fusion method and system, electronic equipment and storage medium
CN115359169A (en) * 2022-08-26 2022-11-18 杭州群核信息技术有限公司 Image processing method, apparatus and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190026900A1 (en) * 2017-06-19 2019-01-24 Digitalbridge System and method for modeling a three dimensional space based on a two dimensional image
CN112116620A (en) * 2020-09-16 2020-12-22 北京交通大学 Indoor image semantic segmentation and painting display method
CN112712487A (en) * 2020-12-23 2021-04-27 北京软通智慧城市科技有限公司 Scene video fusion method and system, electronic equipment and storage medium
CN115359169A (en) * 2022-08-26 2022-11-18 杭州群核信息技术有限公司 Image processing method, apparatus and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
李熠 (LI, YI): "基于全景图像的室内三维重建算法研究 (Non-official translation: Research on Indoor 3D Reconstruction Algorithm Based on Panoramic Image)", 中国优秀硕士学位论文全文数据库(电子期刊) (CHINA MASTER’S THESES FULL-TEXT DATABASE) (ELECTRONIC JOURNAL)), 15 February 2021 (2021-02-15) *
黄茜茜 (HUANG, XIXI): "虚拟家装系统的户型设计与装修 (Non-official translation: Virtual Home Decorating System for Household Design and Decoration)", 中国优秀硕士学位论文全文数据库(电子期刊) (CHINA MASTER’S THESES FULL-TEXT DATABASE) (ELECTRONIC JOURNAL)), 15 January 2014 (2014-01-15) *

Also Published As

Publication number Publication date
CN115359169A (en) 2022-11-18

Similar Documents

Publication Publication Date Title
US10803659B2 (en) Automatic three-dimensional solid modeling method and program based on two-dimensional drawing
JP4642757B2 (en) Image processing apparatus and image processing method
US9443353B2 (en) Methods and systems for capturing and moving 3D models and true-scale metadata of real world objects
CN109242961B (en) Face modeling method and device, electronic equipment and computer readable medium
Dou et al. Scanning and tracking dynamic objects with commodity depth cameras
US10580205B2 (en) 3D model generating system, 3D model generating method, and program
JP4770960B2 (en) Image search system and image search method
JP6196416B1 (en) 3D model generation system, 3D model generation method, and program
JP5299173B2 (en) Image processing apparatus, image processing method, and program
WO2024041181A1 (en) Image processing method and apparatus, and storage medium
Vidanapathirana et al. Plan2scene: Converting floorplans to 3d scenes
JP6425511B2 (en) Method of determining feature change and feature change determination apparatus and feature change determination program
JP6556680B2 (en) VIDEO GENERATION DEVICE, VIDEO GENERATION METHOD, AND PROGRAM
Park Interactive 3D reconstruction from multiple images: A primitive-based approach
US20240062345A1 (en) Method, apparatus, and computer-readable medium for foreground object deletion and inpainting
JP2021152935A (en) Information visualization system, information visualization method, and program
JP2018185658A (en) Information processing apparatus, information processing method, and program
TWI468849B (en) Building texture extracting apparatus and method thereof
Bui et al. Integrating videos with LIDAR scans for virtual reality
Kim et al. Planar Abstraction and Inverse Rendering of 3D Indoor Environments
JP2016071496A (en) Information terminal device, method, and program
JP7344620B1 (en) Building structure recognition system and building structure recognition method
JP7403108B2 (en) Building structure recognition system and building structure recognition method
Oniga A new approach for the semi-automatic texture generation of the buildings facades, from terrestrial laser scanner data
Mihut et al. Lighting and Shadow Techniques for Realistic 3D Synthetic Object Compositing in Images

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23856272

Country of ref document: EP

Kind code of ref document: A1