CN104537607A - Automatic efficient photo collage method based on binary tree and layer sequencing - Google Patents
Automatic efficient photo collage method based on binary tree and layer sequencing Download PDFInfo
- Publication number
- CN104537607A CN104537607A CN201410813937.0A CN201410813937A CN104537607A CN 104537607 A CN104537607 A CN 104537607A CN 201410813937 A CN201410813937 A CN 201410813937A CN 104537607 A CN104537607 A CN 104537607A
- Authority
- CN
- China
- Prior art keywords
- node
- parent
- width
- height
- binary tree
- Prior art date
- Legal status (The legal status 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 status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 30
- 238000012163 sequencing technique Methods 0.000 title 1
- 238000004364 calculation method Methods 0.000 claims abstract description 24
- 230000011218 segmentation Effects 0.000 claims abstract description 18
- 238000013507 mapping Methods 0.000 claims abstract description 6
- 230000000694 effects Effects 0.000 claims description 6
- 238000010422 painting Methods 0.000 claims 5
- 230000001143 conditioned effect Effects 0.000 claims 1
- 238000000638 solvent extraction Methods 0.000 claims 1
- 238000012545 processing Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 3
- 238000005192 partition Methods 0.000 description 2
- 239000000969 carrier Substances 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000004321 preservation Methods 0.000 description 1
- 230000001337 psychedelic effect Effects 0.000 description 1
- 238000012800 visualization Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/40—Scaling of whole images or parts thereof, e.g. expanding or contracting
- G06T3/4038—Image mosaicing, e.g. composing plane images from plane sub-images
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Processing Or Creating Images (AREA)
Abstract
本发明公开了一种基于二叉树及分层排序的自动高效照片拼贴方法,包括以下步骤:步骤一、基于二叉树分割算法对画布进行快速分割;步骤二、输入照片,完成照片与树节点之间的映射,由叶节点至根节点,自下而上层次遍历二叉树的每个内部节点,直至确定每个内部节点的宽高比例;步骤三、对逐层的节点,依据其宽高比例的计算结果进行排序;步骤四、自上而下计算节点所代表画布的尺寸和摆放位置;上述流程,步骤二和步骤三交替进行,步骤二逐层计算内部节点的比例,步骤三每一层的计算结果进行排序,直至完成所有节点的计算。本发明适用于电脑和智能移动平台;可以用于相册拼贴;同时对于同一照片集,可以产生不一样的拼贴结果,最大限度满足不同的需求。The invention discloses an automatic and efficient photo collage method based on a binary tree and layered sorting, comprising the following steps: step 1, rapidly splitting the canvas based on a binary tree segmentation algorithm; Mapping, from the leaf node to the root node, traverse each internal node of the binary tree from bottom to top until the width-to-height ratio of each internal node is determined; step 3, for layer-by-layer nodes, calculate according to their width-to-height ratio The results are sorted; step 4, calculate the size and placement of the canvas represented by the nodes from top to bottom; the above process, step 2 and step 3 are carried out alternately, step 2 calculates the proportion of internal nodes layer by layer, step 3 the proportion of each layer The calculation results are sorted until the calculation of all nodes is completed. The invention is suitable for computers and intelligent mobile platforms; it can be used for photo album collage; and at the same time, different collage results can be generated for the same photo set, so as to meet different needs to the greatest extent.
Description
技术领域technical field
本发明图片处理技术,特别是涉及一种自动高效的照片拼贴方法。The image processing technology of the present invention particularly relates to an automatic and efficient photo collage method.
背景技术Background technique
近年来,随着智能手机、高清相机等数码产品的不断普及,照片已经成为人们记录生活的主要载体之一。这种直观的记录,既适合回忆,也适合分享。与此同时,各种照片分享网站也层出不穷,使得人们可以随时分享照片。然而,大量的照片不但使管理变得困难,也使分享变得不便。照片拼贴作为一种重要的照片处理手段,旨在将多张照片拼贴在一张画布中,可以很好的解决大量照片所带来的不便。然而,手动拼贴不但耗时,而且通常需要一定的专业技能,拼贴结果也不尽如人意。正因如此,自动照片拼贴技术越来越受到人们的关注。自动拼贴技术在处理速度上更快,而且不需要专业技能。已经有人提出解决此类问题的算法,但都有一定的不足之处。In recent years, with the continuous popularization of digital products such as smart phones and high-definition cameras, photos have become one of the main carriers for people to record their lives. This intuitive record is suitable for both recall and sharing. At the same time, various photo-sharing websites have emerged in an endless stream, allowing people to share photos at any time. However, a large number of photos not only makes management difficult, but also makes sharing inconvenient. As an important means of photo processing, photo collage aims to collage multiple photos into one canvas, which can well solve the inconvenience caused by a large number of photos. However, manual collage is not only time-consuming, but also usually requires certain professional skills, and the collage results are not satisfactory. Because of this, automatic photo collage technology is getting more and more attention. The automatic tiling technique is faster in processing speed and does not require professional skills. Algorithms to solve this kind of problems have been proposed, but they all have certain deficiencies.
例如,目前已经有人提出的二维和三维空间下的照片拼贴算法。文献[1]是微软提出的一种二维照片拼贴方法AutoCollage:首先根据照片大小对输入照片进行筛选,忽略较小的照片,然后检测提取每张照片的感兴趣区域(ROI),对提取的区域进行拼贴和平滑处理,整个过程比较耗时。文献[2]采用基于Voronoi图的方法对画布进行分割,然后计算确定每张照片的重要性,再根据重要性的不同调整照片尺寸,同时还要对照片进行裁剪以适应子区域的形状,处理过程同样非常耗时。文献[3]通过提取照片中的对象,将其拼贴成一幅具有迷幻色彩的照片。文献[4]和[5]均采用基于二叉树的算法对画布进行分割,不同之处在于前者在进行拼贴时将照片之间的关系考虑在内,需要进行多次调整,由此会带来时耗,后者不考虑照片之间的相互关系,在速度上非常快,但拼贴结果存在容易出现裂缝等不理想的情况。在三维领域中,文献[6]的Connection Constrained 3DCollage和文献[7]的[Structured Mechanical Collage将照片拼贴为三维模型,可以应用于游戏开发等领域。For example, photo collage algorithms in two-dimensional and three-dimensional spaces have been proposed. Literature [1] is a two-dimensional photo collage method AutoCollage proposed by Microsoft: first, filter the input photos according to the size of the photos, ignore the smaller photos, and then detect and extract the region of interest (ROI) of each photo, and extract Collage and smooth the area, the whole process is time-consuming. Literature [2] uses the Voronoi diagram-based method to divide the canvas, and then calculates and determines the importance of each photo, and then adjusts the size of the photo according to the importance, and at the same time crops the photo to fit the shape of the sub-region, processing The process is also very time-consuming. Literature [3] collages them into a psychedelic photo by extracting the objects in the photo. Literature [4] and [5] both use a binary tree-based algorithm to divide the canvas, the difference is that the former takes the relationship between the photos into account when making a collage, and needs to make multiple adjustments, which will bring Time-consuming, the latter does not consider the interrelationship between photos, and is very fast in speed, but the collage result is prone to cracks and other unsatisfactory situations. In the 3D field, the Connection Constrained 3DCollage in [6] and the [Structured Mechanical Collage] in [7] collage photos into 3D models, which can be applied to fields such as game development.
前人提出了一些拼贴方法,但都难以在处理速度和拼贴质量之间取得较好的平衡。其中基于感兴趣区域提取的方法,由于需要进行感兴趣区域识别,处理过程十分耗时,且会造成信息丢失;基于内容完全保留的方法处理速度较快,但是拼贴结果不够理想。Predecessors have proposed some collage methods, but it is difficult to achieve a good balance between processing speed and collage quality. Among them, the method based on the extraction of the region of interest needs to identify the region of interest, the processing process is very time-consuming, and will cause information loss; the method based on the complete preservation of the content is faster, but the collage result is not ideal.
参考文献:references:
[1]Rother C,Bordeaux L,Hamadi Y,et al.Autocollage.ACM Transactions on Graphics(TOG),2006,25(3):847-852.[1] Rother C, Bordeaux L, Hamadi Y, et al. Autocollage. ACM Transactions on Graphics (TOG), 2006, 25(3): 847-852.
[2]Yu Z,Lu L,Guo Y,Fan RF,Liu MM,Wang WP.Content-aware photo collage using circlepacking.IEEE Transactions on Visualization and Computer Graphics,2014,20(2):182-195.[2] Yu Z, Lu L, Guo Y, Fan RF, Liu MM, Wang WP. Content-aware photo collage using circlepacking. IEEE Transactions on Visualization and Computer Graphics, 2014, 20(2): 182-195.
[3]Goferman S,Tal A,Zelnik-Manor L.Puzzle-like collage.Computer Graphics Forum,2010,29(2):459-468.[3] Goferman S, Tal A, Zelnik-Manor L. Puzzle-like collage. Computer Graphics Forum, 2010, 29(2): 459-468.
[4]Atkins C B.Blocked recursive image composition.In Proceedings ofthe 16th ACMinternational conference on Multimedia,2008,pp.821-824.[4]Atkins C B. Blocked recursive image composition. In Proceedings of the 16th ACM international conference on Multimedia, 2008, pp.821-824.
[5]Wu Z,Aizawa K.PicWall:Photo collage on-the-fly.In Proceedings of Signal andInformation ProcessingAssociationAnnual Summit and Conference(APSIPA),2013,pp.1-10.[5] Wu Z, Aizawa K. PicWall: Photo collage on-the-fly. In Proceedings of Signal and Information Processing Association Annual Summit and Conference (APSIPA), 2013, pp.1-10.
[6]Huang Z,Wang J,Lau Rynson WH,Fu HB.Connection constrained 3D collage.InProceedings ofComputer Graphics International,2014.[6] Huang Z, Wang J, Lau Rynson WH, Fu HB. Connection constrained 3D collage. In Proceedings of Computer Graphics International, 2014.
[7]Huang Z,Wang J,Fu HB,Lau Rynson WH.Structured mechanical collage.IEEETransactions on Visualization and Computer Graphics,2014,20(7):1076-1082.[7]Huang Z, Wang J, Fu HB, Lau Rynson WH.Structured mechanical collage.IEEE Transactions on Visualization and Computer Graphics,2014,20(7):1076-1082.
发明内容Contents of the invention
为了克服上述现有技术,本发明提出了一种基于二叉树及分层排序的自动高效照片拼贴方法,能够实现一种兼顾速度和效果的自动照片拼贴算法,算法处理效率高而且对硬件要求不高,可以在不同的平台上实现,包括智能手机和PC。In order to overcome the above-mentioned prior art, the present invention proposes an automatic and efficient photo collage method based on binary tree and layered sorting, which can realize an automatic photo collage algorithm that takes into account both speed and effect, and the algorithm has high processing efficiency and low hardware requirements It is not high and can be implemented on different platforms, including smartphones and PCs.
本发明提出了一种基于二叉树及分层排序的自动高效照片拼贴方法,该方法包括以下步骤:The present invention proposes a kind of automatic high-efficiency photo collage method based on binary tree and layered sorting, and this method comprises the following steps:
步骤一、基于二叉树分割算法对画布进行快速分割,分割结果是将画布区域产生一棵完全二叉树,其中树的叶子节点数量与照片数量相等,树的内部节点保存画布分割类型的属性,分割类型属性包括横向或者纵向两种,并且随机产生;Step 1. Quickly split the canvas based on the binary tree segmentation algorithm. The result of the segmentation is to generate a complete binary tree in the canvas area, in which the number of leaf nodes in the tree is equal to the number of photos. The internal nodes of the tree store the attributes of the canvas segmentation type and the segmentation type attribute Including horizontal or vertical two, and randomly generated;
步骤二、输入照片,完成照片与树节点之间的映射,由叶节点至根节点,自下而上层次遍历二叉树的每个内部节点,直至确定每个内部节点的宽高比例;Step 2: Input the photo, complete the mapping between the photo and the tree node, traverse each internal node of the binary tree from the leaf node to the root node, until the width-to-height ratio of each internal node is determined;
步骤三、对逐层的节点,依据其宽高比例的计算结果进行排序;Step 3. Sorting the layer-by-layer nodes according to the calculation results of their width-to-height ratios;
步骤四、自上而下计算节点所代表画布的尺寸和摆放位置;Step 4. Calculate the size and placement of the canvas represented by the nodes from top to bottom;
上述流程,步骤二和步骤三交替进行,步骤二逐层计算内部节点的比例,步骤三每一层的计算结果进行排序,直至完成所有节点的计算。In the above process, step 2 and step 3 are performed alternately, step 2 calculates the proportion of internal nodes layer by layer, and step 3 calculates the calculation results of each layer until the calculation of all nodes is completed.
所述步骤二中每个内部节点的宽高比例的计算,具体包括以下处理:The calculation of the aspect ratio of each internal node in the step 2 specifically includes the following processing:
由子节点计算父节点的宽高比例时,若父节点分割类型为“V”,则左右孩子节点高度一致;若父节点分割类型为“H”,则左右孩子节点宽度一致,计算公式如下:When calculating the width-to-height ratio of a parent node from a child node, if the parent node split type is "V", then the left and right child nodes have the same height; if the parent node split type is "H", then the left and right child nodes have the same width. The calculation formula is as follows:
父节点分割类型为’V’:Arparent=Arleft+Arright The split type of the parent node is 'V': Ar parent =Ar left +Ar right
父节点分割类型为‘H’:1/Arparent=1/Arleft+1/Arright Parent node split type is 'H': 1/Ar parent =1/Ar left +1/Ar right
其中,Ar代表节点所代表区域的宽高比例,Arparent表示父节点所代表区域的宽高比例,Arleft和Arright分别表示父节点左右孩子节点所代表区域的宽高比例;Among them, Ar represents the width-to-height ratio of the area represented by the node, Ar parent represents the width-to-height ratio of the area represented by the parent node, Ar left and Ar right represent the width-to-height ratio of the area represented by the left and right child nodes of the parent node, respectively;
对叶子节点来说其宽高比例即为其所对应照片的宽高比例,内部节点的宽高比例根据其左右子节点计算而得。For a leaf node, its width-to-height ratio is the width-to-height ratio of its corresponding photo, and the width-to-height ratio of an internal node is calculated based on its left and right child nodes.
所述每个内部节点的宽高比例的计算结果需满足预设条件,如果计算结果超出预设比例范围,则调整父节点的分割类型,重新进行计算。The calculation result of the width-to-height ratio of each internal node needs to meet a preset condition. If the calculation result exceeds the preset ratio range, adjust the division type of the parent node and recalculate.
所述步骤四的计算画布的尺寸,其计算公式如下:The calculation formula for calculating the size of the canvas in step 4 is as follows:
父节点分割类型为‘V’:Parent node split type is 'V':
node.Height=node.Parent.Heightnode.Height=node.Parent.Height
node.Width=node.Height×node.Arnode.Width=node.Height×node.Ar
父节点分割类型为‘H’:Parent node split type is 'H':
node.Width=node.Parent.Widthnode.Width = node.Parent.Width
node.Height=node.Width/node.Arnode.Height=node.Width/node.Ar
式中node.Height和node.Width分别表示当前节点所代表的区域的宽度和高度,node.Parent.Height和node.Parent.Width分别表示当前节点父节点的高度和宽度,node.Ar表示当前节点所代表区域的宽高比例。In the formula, node.Height and node.Width represent the width and height of the area represented by the current node, respectively, node.Parent.Height and node.Parent.Width represent the height and width of the parent node of the current node, respectively, and node.Ar represents the current node The aspect ratio of the represented area.
所述步骤四的计算画布的摆放位置,其计算公式如下:The calculation formula for calculating the placement position of the canvas in the step 4 is as follows:
节点为左孩子节点The node is the left child node
node.Pox=node.Parent.Poxnode.Pox = node.Parent.Pox
node.Poy=node.Parent.Poynode.Poy = node.Parent.Poy
节点为右孩子节点The node is the right child node
父节点分割类型为‘V’Parent node split type is 'V'
node.Pox=node.Parent.Left.Pox+node.Parent.Left.Widthnode.Pox = node.Parent.Left.Pox + node.Parent.Left.Width
node.Poy=node.Parent.Poynode.Poy = node.Parent.Poy
父节点分割类型为‘H’Parent node split type is 'H'
node.Pox=node.Parent.Poxnode.Pox = node.Parent.Pox
node.Poy=node.Parent.Poy+node.Parent.Left.Heightnode.Poy=node.Parent.Poy+node.Parent.Left.Height
式中node.Pox和node.Poy表示当前节点所代表的区域的左上角的坐标,node.Parent.Pox和node.Parent.Poy代表当前节点父节点所代表区域左上角的横坐标和纵坐标,node.Parent.Left.Pox代表当前节点的父节点的左孩子节点所代表区域的左上角的横坐标,node.Parent.Left.Width和node.Parent.Left.Height代表当前节点父节点的左孩子节点所代表区域的宽度和高度。In the formula, node.Pox and node.Poy represent the coordinates of the upper left corner of the area represented by the current node, node.Parent.Pox and node.Parent.Poy represent the abscissa and ordinate of the upper left corner of the area represented by the parent node of the current node, node.Parent.Left.Pox represents the abscissa of the upper left corner of the area represented by the left child node of the parent node of the current node, node.Parent.Left.Width and node.Parent.Left.Height represent the left child of the parent node of the current node The width and height of the region represented by the node.
所述步骤三中,在排序完成后,调整排序层和其子节点层的对应关系,使其重新满足映射关系。In the third step, after the sorting is completed, the corresponding relationship between the sorting layer and its child node layers is adjusted so that the mapping relationship is satisfied again.
与现有技术相比,本发明可以用于相册拼贴、图片检索结果显示、视频摘要拼贴等领域,通过设置不同的参数,可以产生不一样的结果。同时对于同一照片集,可以产生不一样的拼贴结果,最大限度满足不同的需求。Compared with the prior art, the present invention can be used in photo album collage, picture retrieval result display, video summary collage and other fields, and different results can be produced by setting different parameters. At the same time, for the same photo set, different collage results can be produced to meet different needs to the greatest extent.
附图说明Description of drawings
图1为照片数量为20时的拼贴结果示意图;Figure 1 is a schematic diagram of the collage results when the number of photos is 20;
图2为照片数量为100时的拼贴结果示意图;Figure 2 is a schematic diagram of the collage results when the number of photos is 100;
图3为本发明的最佳实施方式流程图。Fig. 3 is a flow chart of the best embodiment of the present invention.
具体实施方式Detailed ways
下面结合附图和具体实施方式对本发明进行详细说明,但本发明的实施范围并不局限于此。The present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments, but the implementation scope of the present invention is not limited thereto.
最佳实施流程主要有以下几个步骤:快速产生画布分割二叉树、自下而上逐层计算内部节点的比例、根据结算结果逐层排序、自上而下计算节点的大小及位置。流程图如图3所示:The best implementation process mainly has the following steps: quickly generate a canvas partition binary tree, calculate the proportion of internal nodes layer by layer from bottom to top, sort layer by layer according to the settlement results, and calculate the size and position of nodes from top to bottom. The flowchart is shown in Figure 3:
步骤1、快速产生画布分割二叉树。Step 1. Quickly generate a canvas partition binary tree.
为了对画布进行快速分割,本步骤需要产生一棵完全二叉树,树的叶子节点个数与待拼贴照片数量相等,树的内部节点存储分割类型(H或V),H代表横向分割画布,V代表纵向分割画布,分割类型由程序随机决定。在二叉树产生后,对输入的照片根据照片宽高比例进行排序。排序完成后,将照片映射到二叉树的叶子节点上,一张照片唯一对应一个叶子节点。In order to quickly split the canvas, this step needs to generate a complete binary tree. The number of leaf nodes of the tree is equal to the number of photos to be collaged. The internal nodes of the tree store the split type (H or V), where H represents the horizontal split canvas, and V Represents vertically splitting the canvas, and the split type is randomly determined by the program. After the binary tree is generated, the input photos are sorted according to the aspect ratio of the photos. After the sorting is completed, the photos are mapped to the leaf nodes of the binary tree, and a photo uniquely corresponds to a leaf node.
步骤2、自下而上逐层计算内部节点的宽高比例。Step 2. Calculate the width-to-height ratio of internal nodes layer by layer from bottom to top.
在完成照片映射后,需要自下而上层次遍历二叉树的节点,确定每个内部节点的宽高比例。由子节点计算父节点的宽高比例时,若父节点分割类型为“V”,则左右孩子节点高度一致;若父节点分割类型为“H”,则左右孩子节点宽度一致。由此可以导出一下计算公式:After completing the photo mapping, it is necessary to traverse the nodes of the binary tree from bottom to top to determine the width-to-height ratio of each internal node. When calculating the width-to-height ratio of a parent node from a child node, if the split type of the parent node is "V", the height of the left and right child nodes is the same; if the split type of the parent node is "H", the width of the left and right child nodes is the same. From this, the calculation formula can be derived:
父节点分割类型为’V’:Arparent=Arleft+Arright (1)Parent node split type is 'V': Ar parent = Ar left + Ar right (1)
父节点分割类型为‘H’:1/Arparent=1/Arleft+1/Arright (2)Parent node split type is 'H': 1/Ar parent =1/Ar left +1/Ar right (2)
其中,Ar代表节点所代表区域的宽高比例,Arparent表示父节点所代表区域的宽高比例,Arleft和Arright分别表示父节点左右孩子节点所代表区域的宽高比例。对叶子节点来说其宽高比例即为其所对应照片的宽高比例,内部节点的宽高比例根据其左右子节点计算而得。Among them, Ar represents the width-to-height ratio of the area represented by the node, Ar parent represents the width-to-height ratio of the area represented by the parent node, and Ar left and Ar right represent the width-to-height ratio of the area represented by the left and right child nodes of the parent node. For a leaf node, its width-to-height ratio is the width-to-height ratio of its corresponding photo, and the width-to-height ratio of an internal node is calculated based on its left and right child nodes.
同时,在计算过程中还要确保计算结果满足预设条件,如果计算结果超出预设比例范围,则调整父节点的分割类型,重新进行计算。在完成每一层节点计算后,进入步骤3。At the same time, it is also necessary to ensure that the calculation results meet the preset conditions during the calculation process. If the calculation results exceed the preset ratio range, adjust the division type of the parent node and recalculate. After completing the calculation of each layer of nodes, go to step 3.
步骤3、根据结算结果逐层排序Step 3. Sort layer by layer according to settlement results
在本步骤中主要是对每一层的计算结果进行排序(默认为递减排序)。如果没有该过程,则在拼贴结果中,相邻照片之间出现大小悬殊这种情况的概率非常大,影响拼贴结果的美观性。进行逐层排序可以避免这种情况的出现,保证拼贴结果中相邻照片之间大小相近,使得拼贴结果更加美观。In this step, the calculation results of each layer are mainly sorted (decreasing sort by default). If there is no such process, in the collage result, the probability that there will be a large size difference between adjacent photos is very high, which will affect the aesthetics of the collage result. Sorting layer by layer can avoid this situation, and ensure that the size of adjacent photos in the collage result is similar, making the collage result more beautiful.
在排序完成后,需要调整父子节点之间的对应关系,因为排序的过程会打破原有的节点对应关系,当然只是需要调整排序层和其子节点层的对应关系,其他层不需要调整。After the sorting is completed, the corresponding relationship between the parent and child nodes needs to be adjusted, because the sorting process will break the original node corresponding relationship. Of course, only the corresponding relationship between the sorting layer and its child node layer needs to be adjusted, and other layers do not need to be adjusted.
需要注意的是:步骤2和步骤3交替进行,步骤2逐层计算内部节点的比例,步骤3每一层的计算结果进行排序,直至完成所有节点的计算。It should be noted that: step 2 and step 3 are performed alternately, step 2 calculates the proportion of internal nodes layer by layer, and step 3 calculates the calculation results of each layer until the calculation of all nodes is completed.
步骤4、自上而下计算节点的大小及位置Step 4. Calculate the size and position of nodes from top to bottom
该步骤要在前三步完成后进行。首先根据预设画布高度H或者宽度W,结合树根节点的宽高比例计算取得画布的大小。This step should be carried out after the first three steps are completed. Firstly, calculate the size of the canvas according to the preset canvas height H or width W, combined with the width-to-height ratio of the root node of the tree.
计算画布大小的公式如下:The formula for calculating the canvas size is as follows:
父节点分割类型为‘V’: (3)Parent node split type is 'V': (3)
node.Height=node.Parent.Heightnode.Height=node.Parent.Height
node.Width=node.Height×node.Arnode.Width=node.Height×node.Ar
父节点分割类型为‘H’: (4)Parent node split type is 'H': (4)
node.Width=node.Parent.Widthnode.Width = node.Parent.Width
node.Height=node.Width/node.Arnode.Height=node.Width/node.Ar
式中node.Height和node.Width分别表示当前节点所代表的区域的宽度和高度,node.Parent.Height和node.Parent.Width分别表示当前节点父节点的高度和宽度,node.Ar表示当前节点所代表区域的宽高比例。In the formula, node.Height and node.Width represent the width and height of the area represented by the current node, respectively, node.Parent.Height and node.Parent.Width represent the height and width of the parent node of the current node, respectively, and node.Ar represents the current node The aspect ratio of the represented area.
计算位置的公式如下:The formula for calculating position is as follows:
节点为左孩子节点 (5)The node is the left child node (5)
node.Pox=node.Parent.Poxnode.Pox = node.Parent.Pox
node.Poy=node.Parent.Poynode.Poy = node.Parent.Poy
节点为右孩子节点The node is the right child node
父节点分割类型为‘V’ (6)Parent node split type is 'V' (6)
node.Pox=node.Parent.Left.Pox+node.Parent.Left.Widthnode.Pox = node.Parent.Left.Pox + node.Parent.Left.Width
node.Poy=node.Parent.Poynode.Poy = node.Parent.Poy
父节点分割类型为‘H’ (7)Parent node split type is 'H' (7)
node.Pox=node.Parent.Poxnode.Pox = node.Parent.Pox
node.Poy=node.Parent.Poy+node.Parent.Left.Heightnode.Poy=node.Parent.Poy+node.Parent.Left.Height
式中node.Pox和node.Poy表示当前节点所代表的区域的左上角的坐标,node.Parent.Pox和node.Parent.Poy代表当前节点父节点所代表区域左上角的横坐标和纵坐标,node.Parent.Left.Pox代表当前节点的父节点的左孩子节点所代表区域的左上角的横坐标,node.Parent.Left.Width和node.Parent.Left.Height代表当前节点父节点的左孩子节点所代表区域的宽度和高度。In the formula, node.Pox and node.Poy represent the coordinates of the upper left corner of the area represented by the current node, node.Parent.Pox and node.Parent.Poy represent the abscissa and ordinate of the upper left corner of the area represented by the parent node of the current node, node.Parent.Left.Pox represents the abscissa of the upper left corner of the area represented by the left child node of the parent node of the current node, node.Parent.Left.Width and node.Parent.Left.Height represent the left child of the parent node of the current node The width and height of the region represented by the node.
对于每个节点来说,首先根据计算公式计算其画布的大小,而后计算其位置。对于每一层来说自左向右计算。For each node, first calculate the size of its canvas according to the calculation formula, and then calculate its position. Calculated from left to right for each layer.
本发明对运行环境的要求不高,可以运行在普通智能手机和PC上。The invention has low requirements on the operating environment and can run on ordinary smart phones and PCs.
智能手机:1G内存以上配置Smartphone: more than 1G memory configuration
电脑:2G内存以上配置Computer: more than 2G memory configuration
尽管上面结合图对本发明进行了描述,但是本发明并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本发明的启示下,在不脱离本发明宗旨的情况下,还可以作出很多变形,这些均属于本发明的保护之内。Although the present invention has been described above in conjunction with the drawings, the present invention is not limited to the above-mentioned specific embodiments, and the above-mentioned specific embodiments are only illustrative, rather than restrictive. Under the inspiration, many modifications can be made without departing from the gist of the present invention, and these all belong to the protection of the present invention.
Claims (5)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410813937.0A CN104537607B (en) | 2014-12-23 | 2014-12-23 | An Automatic and Efficient Photo Collage Method Based on Binary Tree and Hierarchical Sorting |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410813937.0A CN104537607B (en) | 2014-12-23 | 2014-12-23 | An Automatic and Efficient Photo Collage Method Based on Binary Tree and Hierarchical Sorting |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104537607A true CN104537607A (en) | 2015-04-22 |
CN104537607B CN104537607B (en) | 2017-08-01 |
Family
ID=52853126
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410813937.0A Expired - Fee Related CN104537607B (en) | 2014-12-23 | 2014-12-23 | An Automatic and Efficient Photo Collage Method Based on Binary Tree and Hierarchical Sorting |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104537607B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106445931A (en) * | 2015-08-04 | 2017-02-22 | 阿里巴巴集团控股有限公司 | Database node association relationship display method and apparatus |
GB2552969A (en) * | 2016-08-16 | 2018-02-21 | Fujitsu Ltd | Image processing system |
CN110868319A (en) * | 2019-11-08 | 2020-03-06 | 北京浪潮数据技术有限公司 | Network topology drawing method, device, equipment and readable storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060150092A1 (en) * | 2003-09-30 | 2006-07-06 | Atkins C B | Arranging graphic objects on pages |
US7555730B2 (en) * | 2005-05-12 | 2009-06-30 | Hewlett-Packard Development Company, L.P. | Method for arranging graphic assemblies |
CN102831593A (en) * | 2012-07-23 | 2012-12-19 | 陈华 | Digital picture splicing system and method for carrying out mosaic picture splicing by using system |
CN104112007A (en) * | 2014-07-16 | 2014-10-22 | 深圳大学 | Data storage, organization and retrieval methods of image gradation segmentation result |
-
2014
- 2014-12-23 CN CN201410813937.0A patent/CN104537607B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060150092A1 (en) * | 2003-09-30 | 2006-07-06 | Atkins C B | Arranging graphic objects on pages |
US7555730B2 (en) * | 2005-05-12 | 2009-06-30 | Hewlett-Packard Development Company, L.P. | Method for arranging graphic assemblies |
CN102831593A (en) * | 2012-07-23 | 2012-12-19 | 陈华 | Digital picture splicing system and method for carrying out mosaic picture splicing by using system |
CN104112007A (en) * | 2014-07-16 | 2014-10-22 | 深圳大学 | Data storage, organization and retrieval methods of image gradation segmentation result |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106445931A (en) * | 2015-08-04 | 2017-02-22 | 阿里巴巴集团控股有限公司 | Database node association relationship display method and apparatus |
CN106445931B (en) * | 2015-08-04 | 2019-06-28 | 阿里巴巴集团控股有限公司 | Database node incidence relation methods of exhibiting and device |
GB2552969A (en) * | 2016-08-16 | 2018-02-21 | Fujitsu Ltd | Image processing system |
GB2552969B (en) * | 2016-08-16 | 2022-04-13 | Fujitsu Ltd | Image processing system |
CN110868319A (en) * | 2019-11-08 | 2020-03-06 | 北京浪潮数据技术有限公司 | Network topology drawing method, device, equipment and readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN104537607B (en) | 2017-08-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109993783B (en) | Roof and side surface optimization reconstruction method for complex three-dimensional building point cloud | |
WO2021012837A1 (en) | Method and apparatus for determining recommendation information implantation position, device and storage medium | |
WO2020207191A1 (en) | Method and apparatus for determining occluded area of virtual object, and terminal device | |
CN104216976B (en) | A kind of mobile terminal picture grouping inspection method and system | |
JP6553692B2 (en) | Moving image background removal method and moving image background removal system | |
CN105321177B (en) | A kind of level atlas based on image importance pieces method together automatically | |
US9311756B2 (en) | Image group processing and visualization | |
CN104537607B (en) | An Automatic and Efficient Photo Collage Method Based on Binary Tree and Hierarchical Sorting | |
CN104680572A (en) | BIM-based mobile terminal building model rendering performance optimization method and system | |
CN109472832B (en) | Color scheme generation method and device and intelligent robot | |
CN108550107A (en) | A kind of image processing method, picture processing unit and mobile terminal | |
CN108198194B (en) | Oblique photography single object extraction method based on lateral multi-plane cutting | |
CN108961385B (en) | SLAM composition method and device | |
CN108898136A (en) | Cross-modal image saliency detection method | |
CN102254345A (en) | Method for registering natural characteristic based on cloud computation | |
CN109544687B (en) | Directional layered household graph expansion method | |
CN114419256B (en) | Urban level BIM data light weight method and system based on multistage shell extraction algorithm | |
CN103307979B (en) | Based on the fruit volume measuring method of computer vision | |
CN101436255A (en) | Method for extracting remarkable configuration in complicated image | |
CN105512194A (en) | Game scene management method and device | |
CN102572305A (en) | Method and system for processing video image | |
CN113763240B (en) | Point cloud thumbnail generation method, device, equipment and storage medium | |
CN106469437B (en) | Image processing method and image processing device | |
CN103489212B (en) | The two-dimensional shapes corresponding method inspired based on user | |
CN114782642B (en) | Method and device for placing virtual models |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20170801 |