TWI416360B - Computer system and method for fitting characteristic elements - Google Patents

Computer system and method for fitting characteristic elements Download PDF

Info

Publication number
TWI416360B
TWI416360B TW97136027A TW97136027A TWI416360B TW I416360 B TWI416360 B TW I416360B TW 97136027 A TW97136027 A TW 97136027A TW 97136027 A TW97136027 A TW 97136027A TW I416360 B TWI416360 B TW I416360B
Authority
TW
Taiwan
Prior art keywords
point
fitting
fitted
boundary
points
Prior art date
Application number
TW97136027A
Other languages
Chinese (zh)
Other versions
TW201013446A (en
Inventor
Chih Kuang Chang
Xin-Yuan Wu
Min Wang
Original Assignee
Hon Hai Prec Ind Co Ltd
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 Hon Hai Prec Ind Co Ltd filed Critical Hon Hai Prec Ind Co Ltd
Priority to TW97136027A priority Critical patent/TWI416360B/en
Publication of TW201013446A publication Critical patent/TW201013446A/en
Application granted granted Critical
Publication of TWI416360B publication Critical patent/TWI416360B/en

Links

Landscapes

  • Image Analysis (AREA)

Abstract

The present invention provides a method for fitting characteristic elements. The method includes: constructing triangles by using point cloud data of a measured object; selecting points to be fit the characteristic elements from the triangles; obtaining uppermost layer points of the selected points; extracting boundary points from the uppermost layer points; fitting the boundary points to a characteristic element; obtaining parameters of the characteristic element, and drawing a figure according to the characteristic element and the parameters. A related computer system for fitting characteristic elements is also disclosed.

Description

特徵元素擬合方法及其電腦系統Feature element fitting method and computer system thereof

本發明涉及一種特徵元素擬合方法及其電腦系統。The invention relates to a feature element fitting method and a computer system thereof.

在三維產品的開發及製造過程中,誤差分析已經成為產品品質驗證的重要環節。傳統的做法是使用點雲獲取裝置獲取工件的點雲資料(即由多個三維離散點組成的點的集合),而後將點雲資料登錄電腦,執行相應軟體對點雲資料進行處理,將離散的點擬合並創建成線、面、圓、圓柱或球等特徵元素。然後,將實際工件和理論設計圖檔中的特徵元素進行對齊,以確定實際工件與理論設計圖檔中的影像之間是否存在誤差。In the development and manufacturing process of 3D products, error analysis has become an important part of product quality verification. The traditional approach is to use the point cloud acquisition device to obtain the point cloud data of the workpiece (ie, a collection of points consisting of multiple three-dimensional discrete points), and then log the point cloud data to the computer, and execute the corresponding software to process the point cloud data, which will be discrete. The points are fitted and created as feature elements such as lines, faces, circles, cylinders or spheres. The actual artifacts are then aligned with the feature elements in the theoretical design file to determine if there is an error between the actual artifact and the image in the theoretical design image.

目前,市場上出現了許多種擬合特徵元素的方法,例如,利用最小二乘法擬合特徵元素,但這些方法無法快速提取三維座標系中點雲的最上層點及有效的邊界點。At present, there are many methods for fitting feature elements on the market, for example, using the least squares method to fit feature elements, but these methods cannot quickly extract the uppermost point of the point cloud and the effective boundary point in the three-dimensional coordinate system.

鑒於以上內容,有必要提供一種特徵元素擬合方法及其電腦系統,能夠快速提取三維座標系中點雲的最上層點及有效的邊界點,從而完成特徵元素的擬合。In view of the above, it is necessary to provide a feature element fitting method and a computer system thereof, which can quickly extract the uppermost point of the point cloud and the effective boundary point in the three-dimensional coordinate system, thereby completing the fitting of the feature elements.

一種特徵元素擬合方法,該方法包括:根據所接收的點雲資料建立三角網格曲面;從該三角網格曲面中選取需擬合特徵元素的點雲;從該所選取的點雲中獲取螢幕的最上層點;提取所述最上層點中的邊界點;採用迭代法將所述最上層點中的邊界點擬合成特徵元素;獲取所擬合的特 徵元素的參數;及根據所述特徵元素的參數及所擬合的特徵元素繪製特徵元素。A feature element fitting method, the method comprising: establishing a triangular mesh surface according to the received point cloud data; selecting a point cloud from the triangular mesh surface to be fitted with the feature element; obtaining from the selected point cloud An uppermost point of the screen; extracting a boundary point in the uppermost point; fitting the boundary point in the uppermost point to a feature element by using an iterative method; acquiring the fitted feature A parameter of the element; and a feature element is drawn according to the parameter of the feature element and the feature element that is fitted.

一種擬合特徵元素的電腦系統,該電腦系統包括:三角網格化模組,用於將點雲建立成三角網格曲面;提取模組,用於從該三角網格曲面中選取需擬合特徵元素的點雲,從該選取的點雲中獲取最上層點,並提取所述最上層點中的邊界點;擬合模組,用於採用迭代法將所述最上層點中的邊界點擬合成特徵元素,並獲取所擬合的特徵元素的參數;及創建模組,用於根據所述特徵元素的參數及所擬合的特徵元素繪製特徵元素。A computer system for fitting a feature element, the computer system comprising: a triangular meshing module for establishing a point cloud into a triangular mesh surface; and an extraction module for selecting a fitting from the triangular mesh surface a point cloud of the feature element, obtaining an uppermost point from the selected point cloud, and extracting a boundary point in the uppermost point; a fitting module for using an iterative method to select a boundary point in the uppermost point Fitting into a feature element and acquiring parameters of the fitted feature element; and creating a module for drawing the feature element according to the parameter of the feature element and the fitted feature element.

相較於習知技術,所述特徵元素擬合方法及其電腦系統,能夠快速提取三維座標系中點雲的最上層點及有效的邊界點,利用迭代法完成特徵元素的擬合。Compared with the prior art, the feature element fitting method and the computer system thereof can quickly extract the uppermost point and the effective boundary point of the point cloud in the three-dimensional coordinate system, and use the iterative method to complete the fitting of the feature elements.

參閱圖1所示,係本發明擬合特徵元素的電腦系統1較佳實施例之功能模組圖。該電腦系統1按軟體程式段的功能可被劃分為接收模組10、三角網格化模組12、提取模組14、擬合模組16和創建模組18。Referring to FIG. 1, a functional module diagram of a preferred embodiment of a computer system 1 for fitting feature elements of the present invention is shown. The computer system 1 can be divided into a receiving module 10, a triangular meshing module 12, an extracting module 14, a fitting module 16, and a creating module 18 according to the functions of the software block.

所述接收模組10用於接收影像量測機台量測工件所產生的點雲資料,該點雲資料包括了點雲的個數、點的標識及每個點的屬性。The receiving module 10 is configured to receive point cloud data generated by the image measuring machine, and the point cloud data includes the number of point clouds, the identifier of the point, and the attribute of each point.

所述三角網格化模組12用於根據所接收的點雲資料建立三角網格曲面。The triangular meshing module 12 is configured to establish a triangular mesh surface according to the received point cloud data.

所述提取模組14用於從所述三角網格曲面中提取所 有的邊界點,並從需擬合特徵元素的點雲中提取邊界點。具體而言,當用戶利用多義線從三角網格曲面中選取需擬合特徵元素的點雲後,提取模組14需從所選取的點雲中找出螢幕上所顯示的最上層點,然後從所述最上層點中提取邊界點用於擬合特徵元素。如圖2所示,係本發明視角法向量(將在後續提到)和最上層點之示意圖,該圖僅為示意所用,點雲的實際排佈情況不限於此。在圖2中,標號2示意顯示器的螢幕,標號3示意所述最上層點,標號4示意視角法向量,由該圖2可以看出,所述最上層點位於視角法向量的最上一層。The extraction module 14 is configured to extract from the triangular mesh surface There are boundary points and the boundary points are extracted from the point cloud where the feature elements need to be fitted. Specifically, when the user selects a point cloud from the triangular mesh surface to fit the feature element by using the polyline, the extraction module 14 needs to find the uppermost point displayed on the screen from the selected point cloud, and then A boundary point is extracted from the topmost point for fitting a feature element. As shown in FIG. 2, it is a schematic diagram of the perspective normal vector (to be mentioned later) and the uppermost layer of the present invention. The figure is only used for illustration, and the actual arrangement of the point cloud is not limited thereto. In Fig. 2, reference numeral 2 denotes a screen of the display, reference numeral 3 denotes the uppermost layer, and reference numeral 4 denotes a view angle vector, as can be seen from Fig. 2, the uppermost layer is located at the uppermost layer of the viewing angle normal vector.

擬合模組16用於根據迭代法將所述最上層點中的邊界點擬合成特徵元素,並獲取所擬合的特徵元素的參數。The fitting module 16 is configured to fit the boundary points in the uppermost layer into feature elements according to an iterative method, and obtain parameters of the fitted feature elements.

創建模組18用於根據所述特徵元素的參數及所擬合的特徵元素繪製特徵元素。The creation module 18 is configured to draw feature elements according to the parameters of the feature element and the fitted feature elements.

參閱圖3,係本發明特徵元素擬合方法較佳實施例之作業流程圖。Referring to Fig. 3, there is shown a flow chart of a preferred embodiment of the method for fitting a feature element of the present invention.

步驟S1,接收模組10接收影像量測機台量測工件所產生的點雲資料,三角網格化模組12根據所接收的點雲資料建立三角網格曲面。其中,所述點雲資料包括點雲的個數、點的標識及每個點的屬性。In step S1, the receiving module 10 receives the point cloud data generated by the image measuring machine to measure the workpiece, and the triangular meshing module 12 creates a triangular mesh surface according to the received point cloud data. The point cloud data includes the number of point clouds, the identifier of the points, and the attributes of each point.

步驟S3,提取模組14從該三角網格曲面中選取需擬合特徵元素的點雲,並從該選取的點雲中提取最上層點的邊界點。In step S3, the extraction module 14 selects a point cloud from which the feature element needs to be fitted from the triangular mesh surface, and extracts a boundary point of the uppermost layer point from the selected point cloud.

步驟S5,擬合模組16採用迭代法將所述最上層點的 邊界點擬合成特徵元素。本較佳實施例中,該迭代法為擬牛頓迭代法。其中,所述特徵元素包括線、面、圓、圓柱或球。In step S5, the fitting module 16 adopts an iterative method to the uppermost layer. The boundary points are fitted to feature elements. In the preferred embodiment, the iterative method is a quasi-Newton iteration method. Wherein, the feature element comprises a line, a face, a circle, a cylinder or a ball.

步驟S7,創建模組18獲取所擬合的特徵元素的參數,並根據所述特徵元素的參數及所擬合的特徵元素繪製特徵元素。其中,當該特徵元素為線時,所述參數包括線的起始點、結束點及線的法向;當該特徵元素為面時,所述參數包括面的中心點和面的法向;該特徵元素為圓時,所述參數包括圓心、圓的半徑和圓的法向;該特徵元素為圓柱時,所述參數包括圓柱的中心點、半徑、高度及圓柱的法向;該特徵元素為球時,所述參數包括球心和球的半徑。In step S7, the creating module 18 acquires parameters of the fitted feature elements, and draws the feature elements according to the parameters of the feature elements and the fitted feature elements. Wherein, when the feature element is a line, the parameter includes a starting point, an ending point, and a normal of the line; when the feature element is a face, the parameter includes a center point of the face and a normal of the face; When the feature element is a circle, the parameter includes a center of the circle, a radius of the circle, and a normal direction of the circle; when the feature element is a cylinder, the parameter includes a center point, a radius, a height, and a normal direction of the cylinder; the feature element When the ball is a ball, the parameters include the radius of the center of the ball and the ball.

參閱圖4,係圖3中步驟S3之細化流程圖。Referring to FIG. 4, a detailed flowchart of step S3 in FIG. 3 is shown.

步驟S30,提取模組14提取所述三角網格曲面中的所有邊界點。本實施例以判斷一個點是否是邊界點為例說明如下:提取模組14從所述三角網格曲面中獲取當前判斷點週圍的三角形及每個三角形的頂點,依次判斷所述頂點被當前判斷點週圍的三角形所佔用的次數是否均大於1,若判斷結果為否,則確定該當前判斷點為邊界點。In step S30, the extraction module 14 extracts all boundary points in the triangular mesh surface. In this embodiment, the following is an example of determining whether a point is a boundary point: the extraction module 14 obtains a triangle around the current judgment point and a vertex of each triangle from the triangular mesh surface, and sequentially determines that the vertex is currently determined. Whether the number of times occupied by the triangle around the point is greater than 1, and if the result of the determination is no, it is determined that the current judgment point is a boundary point.

步驟S32,提取模組14利用多義線從所述三角網格曲面中選取需擬合特徵元素的點雲。該選取的點雲為三維空間內的點雲,即包括多個層次的點雲。In step S32, the extraction module 14 selects a point cloud from the triangular mesh surface to be fitted with the feature element by using a polyline. The selected point cloud is a point cloud in a three-dimensional space, that is, a point cloud including multiple levels.

步驟S34,從該所選取的點雲中獲取螢幕上所顯示的最上層點,即從螢幕顯示的角度來看,該層點位於所選取的點雲的最上層。該獲取方法將在圖5中進行具體描述。Step S34: Acquire the topmost point displayed on the screen from the selected point cloud, that is, from the perspective of the screen display, the layer point is located at the uppermost layer of the selected point cloud. This acquisition method will be specifically described in FIG.

步驟S36,將所述最上層點的屬性與步驟S30中的邊界點的屬性分別進行比較,以找出所述最上層點中的邊界點。具體而言,若所述最上層點中的某一點"a"的屬性與步驟S30中某一邊界點的屬性相同,則確定該點"a"為所述邊界點。In step S36, the attributes of the uppermost layer are compared with the attributes of the boundary points in step S30, respectively, to find the boundary points in the uppermost layer. Specifically, if the attribute of a certain point "a" in the uppermost layer is the same as the attribute of a certain boundary point in step S30, it is determined that the point "a" is the boundary point.

參閱圖5,係圖4中步驟S34之細化流程圖。Referring to FIG. 5, it is a refinement flowchart of step S34 in FIG.

步驟S340,根據點雲資料中點的三維座標計算得到所述點雲的包圍盒,對該包圍盒進行分組,並將點雲資料中每個點的標識填入到相應的分組中。所述分組後每個單元小正方體的邊長可由組成三角網格曲面的三角形的最大邊長及點雲總數計算得出。其中,所述最大邊長為用戶自定義的邊長,其約等於點雲中相鄰點之間距離的平均值。Step S340, calculating a bounding box of the point cloud according to the three-dimensional coordinates of the point in the point cloud data, grouping the bounding boxes, and filling the identifier of each point in the point cloud data into the corresponding group. The side length of each unit small cube after the grouping can be calculated from the maximum side length of the triangle constituting the triangular mesh surface and the total number of point clouds. The maximum side length is a user-defined side length, which is approximately equal to the average value of the distance between adjacent points in the point cloud.

步驟S341,獲取當前點所在的分組,並向週圍各擴大至少一個分組,例如,向外擴3*3個分組,以得到這些分組內所有點週圍的三角形。In step S341, the group in which the current point is located is acquired, and at least one group is expanded to the periphery, for example, 3*3 groups are expanded outward to obtain triangles around all points in the group.

步驟S343,根據螢幕的視角法向量為當前點創建射線。所述螢幕的視角法向量是指用戶平視電腦螢幕時視角所形成的法向量,該視角法向量垂直於用戶的水準視線。Step S343, creating a ray for the current point according to the viewing angle normal vector of the screen. The viewing angle normal vector of the screen refers to a normal vector formed by the user's perspective when viewing the computer screen, and the viewing angle normal vector is perpendicular to the user's horizontal line of sight.

步驟S345,統計上述射線與所述三角形的交點個數。In step S345, the number of intersections of the ray and the triangle is counted.

步驟S347,判斷所述交點個數是否等於1。In step S347, it is determined whether the number of intersections is equal to 1.

若所述交點個數不等於1,則表明當前點的射線與多個三角形相交了,因此,直接結束流程;若所述交點個數等於1,則步驟S349,表明該當前點為最上層點,將該當前點加入最上層點的陣列中。If the number of intersections is not equal to 1, it indicates that the ray of the current point intersects with the plurality of triangles, so the flow is directly ended; if the number of intersections is equal to 1, then step S349 indicates that the current point is the uppermost point. , the current point is added to the array of the topmost point.

提取模組14迴圈每個分組中的點,並重複步驟S341至步驟S349直至找到所有的最上層點加入到所述陣列中。The extraction module 14 loops back the points in each group and repeats steps S341 through S349 until all of the uppermost points are found to be added to the array.

參閱圖6,係圖3中步驟S5之細化流程圖。Referring to FIG. 6, a detailed flowchart of step S5 in FIG. 3 is shown.

步驟S50,用戶根據圖3中步驟S3中所提取的邊界點所組成的大致形狀,輸入擬合類型,該擬合類型包括擬合面、擬合線、擬合圓、擬合圓柱和擬合球。Step S50, the user inputs a fitting type according to the approximate shape of the boundary points extracted in step S3 in FIG. 3, and the fitting type includes a fitting surface, a fitting line, a fitting circle, a fitting cylinder, and a fitting. ball.

步驟S51,擬合模組16判斷所輸入的擬合類型是否為擬合線或擬合圓。若是,則直接進入步驟S52;若否,則轉入步驟S53。In step S51, the fitting module 16 determines whether the input type of the fit is a fitted line or a fitted circle. If yes, go directly to step S52; if no, go to step S53.

於步驟S52,擬合模組16先將所述邊界點擬合成一個面,然後將所述邊界點投影到該面上,接著,進入步驟S53。In step S52, the fitting module 16 first fits the boundary point into a face, and then projects the boundary point onto the face, and then proceeds to step S53.

於步驟S53,根據步驟S50中所輸入的擬合類型得到相應的迭代方程式。利用該迭代方程式可計算出每個邊界點到預擬合圖形的最小距離。In step S53, a corresponding iterative equation is obtained according to the type of fitting input in step S50. Using this iterative equation, the minimum distance from each boundary point to the pre-fitted figure can be calculated.

具體而言,當擬合類型為擬合線時,該擬合線的迭代方程式為,其中,(x i y i z i )為當前邊界點的座標,(x 0y 0z 0 )為擬合線的第一端點的座標,α為當前邊界點和該第一點的連線與擬合線間的夾角,n為邊界點的個數。當所述擬合類型為擬合圓時,該擬合圓的迭代方程式為,其中,(x i y i )為當前 邊界點的座標,(x 0y 0 )為擬合圓的圓心座標,R為擬合圓的半徑,n為邊界點的個數。當擬合類型為擬合面時,該擬合面的迭代方程式為,其中,(x i y i z i )為當前邊界點的座標,n為邊界點的個數。當擬合類型為擬合圓柱時,該擬合圓柱的迭代方程式為,其中,(x i y i z i )為當前邊界點的座標,(x 0y 0z 0 )為擬合圓柱的中心軸的第一點座標,α為當前邊界點和該第一點的連線與中心軸間的夾角,R為圓柱的半徑,n為邊界點的個數。當擬合類型為擬合球時,該擬合球的迭代方程式為,其中,(x i y i z i )為當前邊界點的座標,(x 0y 0z 0 )為擬合球的球心的座標,R為球的半徑,n為邊界點的個數。Specifically, when the fitting type is a fitted line, the iterative equation of the fitted line is , where ( x i , y i , z i ) is the coordinate of the current boundary point, ( x 0 , y 0 , z 0 ) is the coordinate of the first endpoint of the fitted line, α is the current boundary point and the first The angle between the line of one point and the fitted line, where n is the number of boundary points. When the fitting type is a fitted circle, the iterative equation of the fitted circle is Where ( x i , y i ) is the coordinate of the current boundary point, ( x 0 , y 0 ) is the centroid of the fitted circle, R is the radius of the fitted circle, and n is the number of boundary points. When the fitting type is a fitting surface, the iterative equation of the fitting surface is Where ( x i , y i , z i ) is the coordinate of the current boundary point, and n is the number of boundary points. When the fitting type is a fitting cylinder, the iteration equation of the fitting cylinder is , where ( x i , y i , z i ) is the coordinate of the current boundary point, ( x 0 , y 0 , z 0 ) is the first point coordinate of the central axis of the fitted cylinder, α is the current boundary point and the The angle between the line connecting the first point and the central axis, R is the radius of the cylinder, and n is the number of boundary points. When the fit type is a fit ball, the iteration equation of the fit sphere is , where ( x i , y i , z i ) is the coordinate of the current boundary point, ( x 0 , y 0 , z 0 ) is the coordinate of the sphere center of the fit sphere, R is the radius of the sphere, and n is the boundary point The number.

步驟S54,輸入迭代總次數m,該迭代總次數m由用戶指定。本較佳實施例僅以迭代一次為例進行具體說明,用戶也可以進行多次迭代以達到更精確的目的。例如,本實施例可用i表示迭代次數即第幾次迭代。In step S54, the total number of iterations m is input, and the total number m of the iterations is specified by the user. The preferred embodiment is specifically described by taking an iteration once as an example, and the user can also perform multiple iterations to achieve a more precise purpose. For example, this embodiment can use i to represent the number of iterations, that is, the first iteration.

步驟S55,根據迭代次數i和所述邊界點的總數得到該次迭代中的點雲數目n。在本較佳實施例中,假設m=3,當i=1即第1次迭代時,從所述邊界點中按10:1的比例 等間距均勻取點,即此時n=邊界點總數*1/10,其中從該邊界點中按10:1的比例等間距均勻取點的具體步驟為:首先沿X軸、Y軸、Z軸方向對所述邊界點的包圍盒進行等間距分割,使該包圍盒被均勻分成10個小包圍盒,而後分別求得所述10個小包圍盒的中心,最後分別取出離所述10個小包圍盒的中心最近的點;當i=2即第2次迭代時,從所述邊界點中按10:5的比例等間距均勻取點,即此時n=待測物體的點雲總數*5/10;當i=3即第3次迭代時,取所有的邊界點進行迭代。In step S55, the number n of point clouds in the iteration is obtained according to the number of iterations i and the total number of the boundary points. In the preferred embodiment, m=3 is assumed, and when i=1, that is, the first iteration, a ratio of 10:1 is taken from the boundary point. Equally spaced equally, that is, n = total number of boundary points * 1 / 10 at this time, wherein the specific steps of uniformly taking points from the boundary point at a ratio of 10:1 are: first along the X axis, Y axis, Z The axis direction divides the bounding box of the boundary point equally, so that the bounding box is evenly divided into 10 small bounding boxes, and then the centers of the 10 small bounding boxes are respectively determined, and finally the 10 pieces are respectively taken out from the 10 The nearest point of the center of the small bounding box; when i=2, that is, the second iteration, the point is evenly spaced from the boundary point by a ratio of 10:5, that is, n=the total number of point clouds of the object to be tested *5/10; When i=3 is the 3rd iteration, all boundary points are iterated.

步驟S56,利用最小二乘法得到一個初始迭代參數。在本實施例中,擬合線的初始迭代參數為該擬合線的兩個端點的座標,擬合圓的初始迭代參數為圓心座標,擬合球的初始迭代參數為球心座標,擬合圓柱的初始迭代參數為該圓柱中心軸的兩個端點的座標,擬合面的初始迭代參數為該擬合面在座標系內的空間位置和法向量。In step S56, an initial iteration parameter is obtained by using a least squares method. In this embodiment, the initial iteration parameter of the fitted line is the coordinates of the two endpoints of the fitted line, the initial iteration parameter of the fitted circle is the center coordinate, and the initial iteration parameter of the fitted sphere is the spherical center coordinate, The initial iteration parameter of the cylindrical shape is the coordinate of the two end points of the central axis of the cylinder, and the initial iteration parameter of the fitting surface is the spatial position and the normal vector of the fitting surface in the coordinate system.

步驟S57,根據所述初始迭代參數,利用擬牛頓迭代法計算出預擬合圖形中點的座標。具體而言,先計算出每個邊界點的迭代值,然後求取所述邊界點的虛擬點雲位置A1,接著,根據所述迭代總次數m判斷所述虛擬點雲位置A1是否為預擬合圖形中點的座標。例如,若於步驟S54中所輸入的迭代次數大於1,則所述邊界點的虛擬點雲位置A1可作為下一次迭代時的初始點雲位置進行迭代,以計算出虛擬點雲位置A2,並以此方法類推,計算出最後一次迭代的虛擬點雲位置A'作為預擬合圖形中點的座標;若 於步驟S54中所輸入的迭代次數等於1,則A'=A1。其中,當迭代次數等於1時,所述迭代值即為邊界點到預擬合圖形的最小距離;當迭代次數大於1時,所述迭代值包括邊界點與第一次迭代時的虛擬點雲位置A1之間的最小距離、該第一次迭代時的虛擬點雲位置A1與下一次迭代時的虛擬點雲位置之間的最小距離及最後一次迭代的虛擬點雲位置A'到預擬合圖形的最小距離。Step S57, calculating a coordinate of a point in the pre-fitted graph by using a quasi-Newton iteration method according to the initial iteration parameter. Specifically, the iteration value of each boundary point is calculated first, and then the virtual point cloud position A1 of the boundary point is obtained, and then, according to the total number of iterations m, whether the virtual point cloud position A1 is pre-planned is determined. The coordinates of the point in the graph. For example, if the number of iterations input in step S54 is greater than 1, the virtual point cloud position A1 of the boundary point may be iterated as the initial point cloud position at the next iteration to calculate the virtual point cloud position A2, and In this way, the virtual point cloud position A' of the last iteration is calculated as the coordinates of the point in the pre-fitted graph; The number of iterations input in step S54 is equal to 1, then A'=A1. Wherein, when the number of iterations is equal to 1, the iterative value is the minimum distance from the boundary point to the pre-fitted graph; when the number of iterations is greater than 1, the iterative value includes the boundary point and the virtual point cloud at the first iteration The minimum distance between the positions A1, the minimum distance between the virtual point cloud position A1 at the first iteration and the virtual point cloud position at the next iteration, and the virtual point cloud position A' of the last iteration to the pre-fit The minimum distance of the graph.

步驟S58,根據所述預擬合圖形中每個點的座標及所輸入的擬合類型擬合特徵元素。Step S58, fitting the feature element according to the coordinates of each point in the pre-fitted graph and the type of fitting input.

參閱圖7,係圖6步驟S57中的擬牛頓迭代法之具體作業流程圖。Referring to FIG. 7, a specific operation flowchart of the quasi-Newton iteration method in step S57 of FIG. 6 is shown.

步驟S600,將初始迭代參數代入迭代方程式f(x)中,計算出迭代函數值f(x)。In step S600, the initial iteration parameter is substituted into the iterative equation f(x), and the iterative function value f(x) is calculated.

步驟S602,擬合模組16判斷所計算出的迭代函數值f(x)是否小於擬合精度FunX。該擬合精度FunX為用戶自定義的擬合精度,可在電腦系統1中預先輸入,其具體是指預擬合圖形中的點雲與圖3中步驟S3中所提取的相應邊界點之間的誤差要達到的程度。In step S602, the fitting module 16 determines whether the calculated iterative function value f(x) is smaller than the fitting precision FunX. The fitting precision FunX is a user-defined fitting precision, which can be input in advance in the computer system 1, which specifically refers to a point cloud in the pre-fitted figure and a corresponding boundary point extracted in step S3 in FIG. The degree of error to be reached.

若f(x)不小於FunX,則進入步驟S604,利用數學法則如擬牛頓迭代法計算f(x)的下降方向。所述下降方向指使f(x)的值變小的方向,即使邊界點到預擬合圖形的距離變小的方向。If f(x) is not smaller than FunX, the process proceeds to step S604, and the falling direction of f(x) is calculated by a mathematical rule such as a quasi-Newton iteration method. The downward direction refers to a direction in which the value of f(x) becomes smaller, even if the distance from the boundary point to the pre-fitted figure becomes smaller.

步驟S606,判斷是否存在所述下降方向。In step S606, it is determined whether the falling direction exists.

若存在所述下降方向,則進入步驟S608,計算邊界點 沿下降方向移動擬合步長D後到預擬合圖形的距離f(x)'。該擬合步長D指以圖3中步驟S3中所提取的相應邊界點為基準,每次移動預擬合圖形中心的距離,該擬合步長D為用戶自定義的參數且可在電腦系統1中預先輸入。If the falling direction exists, proceed to step S608 to calculate a boundary point. The distance f(x)' after the fitting step D is moved in the descending direction to the pre-fitted figure. The fitting step length D refers to the distance of the center of the pre-fitted figure each time based on the corresponding boundary point extracted in step S3 in FIG. 3, and the fitting step size D is a user-defined parameter and can be used in a computer. System 1 is pre-entered.

具體而言,首先計算得到邊界點沿下降方向移動D後的位置,而後利用該位置計算得到該邊界點到預擬合圖形的距離f(x)'。其中,所述f(x)'與步驟S600中f(x)的計算方法完全相同,僅僅使用的參數不同,可參考步驟S600完成計算。Specifically, the position of the boundary point after moving D in the descending direction is first calculated, and then the distance f(x)' of the boundary point to the pre-fitted figure is calculated by using the position. Wherein, the f(x)' is completely the same as the calculation method of f(x) in step S600, and only the used parameters are different, and the calculation can be completed by referring to step S600.

步驟S610,判斷上述計算得到的f(x)'是否小於f(x)。若f(x)'小於f(x),則返回步驟S608;若f(x)'不小於f(x),則返回步驟S604。In step S610, it is determined whether the calculated f(x)' is smaller than f(x). If f(x)' is smaller than f(x), the process returns to step S608; if f(x)' is not less than f(x), the process returns to step S604.

在步驟S606中,若不存在所述下降方向,表明迭代函數值f(x)為所計算的迭代值,則於步驟S612,輸出該迭代值,然後結束流程。在本實施例中,利用所計算出的迭代值及相應邊界點的座標可計算出預擬合圖形中每個點的座標。In step S606, if the falling direction does not exist, indicating that the iterative function value f(x) is the calculated iteration value, then in step S612, the iteration value is output, and then the flow is ended. In this embodiment, the coordinates of each point in the pre-fitted graph can be calculated using the calculated iteration values and the coordinates of the corresponding boundary points.

在步驟S602中,若f(x)小於FunX,則直接進入步驟S612。In step S602, if f(x) is smaller than FunX, the process proceeds directly to step S612.

本發明雖以較佳實施例揭露如上,然其並非用以限定本發明。任何熟悉此項技藝之人士,在不脫離本發明之精神及範圍內,當可做更動與潤飾,因此本發明之保護範圍當視後附之申請專利範圍所界定者為準。The present invention has been described above in terms of preferred embodiments, and is not intended to limit the invention. Any person skilled in the art will be able to make changes and refinements without departing from the spirit and scope of the invention, and the scope of the invention is defined by the scope of the appended claims.

擬合特徵元素的電腦系統‧‧‧1Computer system for fitting feature elements ‧‧1

接收模組‧‧‧10Receiving module ‧‧10

三角網格化模組‧‧‧12Triangular grid module ‧‧12

提取模組‧‧‧14Extraction module ‧‧14

擬合模組‧‧‧16Fitting module ‧‧16

創建模組‧‧‧18Create a module ‧‧18

螢幕‧‧‧2Screen ‧‧2

最上層點‧‧‧3Top level ‧‧3

視角法向量‧‧‧4Perspective method vector ‧‧4

輸入三角網格化後的點雲‧‧‧S1Enter the triangle grid after the point cloud ‧‧S1

從需擬合特徵元素的點雲中提取邊界點‧‧‧S3Extract boundary points from point clouds that need to fit feature elements ‧‧‧S3

擬合特徵元素‧‧‧S5Fitting feature elements ‧‧‧S5

獲取所擬合特徵元素的參數並繪製特徵元素‧‧‧S7Get the parameters of the fitted feature element and draw the feature element ‧‧‧S7

圖1係本發明擬合特徵元素的電腦系統較佳實施例之功能模組圖。1 is a functional block diagram of a preferred embodiment of a computer system for fitting feature elements of the present invention.

圖2係本發明視角法向量和最上層點之示意圖。2 is a schematic diagram of a view normal vector and an uppermost layer of the present invention.

圖3係本發明特徵元素擬合方法較佳實施例之作業流程圖。Fig. 3 is a flow chart showing the operation of a preferred embodiment of the feature element fitting method of the present invention.

圖4係圖3中步驟S3之細化流程圖。FIG. 4 is a detailed flowchart of step S3 in FIG. 3.

圖5係圖4中步驟S34之細化流程圖。FIG. 5 is a detailed flowchart of step S34 in FIG. 4.

圖6係圖3中步驟S5之細化流程圖。FIG. 6 is a detailed flowchart of step S5 in FIG. 3.

圖7係圖6步驟S57中擬牛頓迭代法之具體作業流程圖。Figure 7 is a flow chart showing the specific operation of the quasi-Newton iteration method in step S57 of Figure 6.

輸入三角網格化後的點雲‧‧‧S1Enter the triangle grid after the point cloud ‧‧S1

從需擬合特徵元素的點雲中提取邊界點‧‧‧S3Extract boundary points from point clouds that need to fit feature elements ‧‧‧S3

擬合特徵元素‧‧‧S5Fitting feature elements ‧‧‧S5

獲取所擬合特徵元素的參數並繪製特徵元素‧‧‧S7Get the parameters of the fitted feature element and draw the feature element ‧‧‧S7

Claims (10)

一種特徵元素擬合方法,該方法包括:從影像量測機台接收點雲資料;根據所接收的點雲資料建立三角網格曲面;從該三角網格曲面中選取需擬合特徵元素的點雲;從該所選取的點雲中獲取螢幕的最上層點;提取所述最上層點中的邊界點;採用迭代法將所述最上層點中的邊界點擬合成特徵元素;獲取所擬合的特徵元素的參數;及根據所述特徵元素的參數及所擬合的特徵元素繪製特徵元素。A feature element fitting method, comprising: receiving point cloud data from an image measuring machine; establishing a triangular mesh surface according to the received point cloud data; and selecting a point to be fitted with the feature element from the triangular mesh surface a cloud; obtaining an uppermost point of the screen from the selected point cloud; extracting a boundary point in the uppermost point; fitting the boundary point in the uppermost point to a feature element by using an iterative method; acquiring the fitted a parameter of the feature element; and drawing the feature element according to the parameter of the feature element and the fitted feature element. 如申請專利範圍第1項所述之特徵元素擬合方法,其中所述步驟從該所選取的點雲中獲取螢幕的最上層點包括如下步驟:(a)根據所述點雲資料計算得到點雲的包圍盒,對該包圍盒進行分組,並將點雲資料中每個點的標識填入到相應的分組中;(b)獲取當前點所在的分組,並向週圍各擴大至少一個分組,以得到分組內所有點週圍的三角形;(c)根據螢幕視角法向量為當前點創建射線;(d)統計該射線與所述三角形的交點個數;(e)當所述交點個數等於1時,將當前點加入最上層點的陣列中;及 (f)迴圈每個分組中的點,並重複步驟(b)至步驟(e)直至找到所有的最上層點。The feature element fitting method according to claim 1, wherein the step of obtaining an uppermost layer of the screen from the selected point cloud comprises the following steps: (a) calculating a point according to the point cloud data. a bounding box of the cloud, grouping the bounding boxes, and filling in the identifiers of each point in the point cloud data into the corresponding group; (b) acquiring the group in which the current point is located, and expanding at least one group to each surrounding area, To obtain a triangle around all points in the group; (c) to create a ray for the current point according to the screen view normal vector; (d) to count the number of intersections of the ray with the triangle; (e) when the number of intersections is equal to 1 Adding the current point to the array of the topmost point; and (f) Loop back the points in each group and repeat steps (b) through (e) until all the top points are found. 如申請專利範圍第1項所述之特徵元素擬合方法,其中,在所述根據點雲資料建立三角網格曲面步驟之後,提取最上層點中的邊界點步驟之前還包括如下步驟:提取所述三角網格曲面中的所有邊界點。The feature element fitting method according to claim 1, wherein after the step of creating a triangular mesh surface according to the point cloud data, the step of extracting the boundary point in the uppermost layer further comprises the following steps: extracting the All the boundary points in the triangle mesh surface. 如申請專利範圍第3項所述之特徵元素擬合方法,其中所述步驟提取所述最上層點中的邊界點包括如下步驟:將所述最上層點的屬性與所述三角網格曲面中的所有邊界點的屬性分別進行比較,以找出所述最上層點中的邊界點。The feature element fitting method according to claim 3, wherein the step of extracting a boundary point in the uppermost layer point comprises the step of: locating an attribute of the uppermost layer point and the triangular mesh surface The attributes of all the boundary points are compared separately to find the boundary points in the uppermost point. 如申請專利範圍第1項所述之特徵元素擬合方法,其中所述步驟採用迭代法將所述最上層點中的邊界點擬合成特徵元素包括以下步驟:(i)輸入擬合類型,該擬合類型包括擬合面、擬合線、擬合圓、擬合圓柱和擬合球;(ii)判斷所輸入的擬合類型是否為擬合線或擬合圓;(iii)若是,則將所述邊界點擬合成一個面,然後將所述邊界點投影到該面上;(iv)根據所輸入的擬合類型利用最小二乘法得到一個初始迭代參數;(v)將該初始迭代參數代入所輸入擬合類型的迭代方程式中,並利用擬牛頓迭代法計算出預擬合圖形中點的座標;及 (vi)根據所述預擬合圖形中每個點的座標及所輸入的擬合類型擬合特徵元素。The feature element fitting method according to claim 1, wherein the step of fitting the boundary point in the uppermost point to the feature element by using an iterative method comprises the following steps: (i) inputting a fitting type, The type of fit includes a fitting surface, a fitted line, a fitted circle, a fitted cylinder, and a fitted sphere; (ii) determining whether the type of fit entered is a fitted line or a fitted circle; (iii) if yes, Fitting the boundary point into a face and then projecting the boundary point onto the face; (iv) obtaining an initial iteration parameter by least squares according to the type of fit input; (v) initial iteration parameter Substituting into the iterative equation of the input fitting type, and using the quasi-Newton iteration method to calculate the coordinates of the points in the pre-fitted graph; (vi) fitting the feature elements according to the coordinates of each point in the pre-fitted graph and the type of fit entered. 如申請專利範圍第5項所述之特徵元素擬合方法,其中所述步驟(v)包括如下步驟;(v1)將初始迭代參數代入所輸入擬合類型的迭代方程式f(x)中,計算出迭代函數值f(x);(v2)當所計算出的迭代函數值f(x)不小於擬合精度FunX,進入步驟(v3);(v3)利用擬牛頓迭代法計算f(x)的下降方向,該下降方向指使邊界點到預擬合圖形的距離變小的方向;(v4)當存在所述下降方向,計算邊界點沿下降方向移動擬合步長後到預擬合圖形的距離f(x)',其中,該擬合步長指以所提取的邊界點為基準,每次移動預擬合圖形中心的距離;(v5)當f(x)'小於f(x),則返回步驟(v4),若f(x)'不小於f(x),則返回步驟(v3)。The feature element fitting method according to claim 5, wherein the step (v) comprises the following steps; (v1) substituting the initial iteration parameter into the iterative equation f(x) of the input fitting type, and calculating The iterative function value f(x); (v2) when the calculated iterative function value f(x) is not less than the fitting precision FunX, proceeds to step (v3); (v3) uses the quasi-Newton iteration method to calculate f(x) a direction of descent, which refers to a direction in which the distance from the boundary point to the pre-fitted figure becomes smaller; (v4) when there is the descent direction, the distance from the pre-fit figure after the boundary point is moved in the descending direction by the fitting step length is calculated f(x)', wherein the fitting step refers to the distance of the center of the pre-fitted figure each time based on the extracted boundary point; (v5) when f(x)' is smaller than f(x), Returning to step (v4), if f(x)' is not less than f(x), it returns to step (v3). 如申請專利範圍第6項所述之特徵元素擬合方法,其中當f(x)小於FunX或當不存在所述下降方向時,則所述方法還包括如下步驟:迭代函數值f(x)為所計算的迭代值,根據該迭代值及所述邊界點的座標計算出預擬合圖形中每個點的座標。The feature element fitting method according to claim 6, wherein when f(x) is smaller than FunX or when the descending direction does not exist, the method further comprises the following steps: an iterative function value f(x) For the calculated iteration value, the coordinates of each point in the pre-fitted graph are calculated from the iteration value and the coordinates of the boundary point. 一種擬合特徵元素的電腦系統,該電腦系統包括:三角網格化模組,用於將點雲建立成三角網格曲面;提取模組,用於從該三角網格曲面中選取需擬合特徵元 素的點雲,從該選取的點雲中獲取螢幕的最上層點,並提取所述最上層點中的邊界點;擬合模組,用於採用迭代法將所述最上層點中的邊界點擬合成特徵元素,並獲取所擬合的特徵元素的參數;及創建模組,用於根據所述特徵元素的參數及所擬合的特徵元素繪製特徵元素。A computer system for fitting a feature element, the computer system comprising: a triangular meshing module for establishing a point cloud into a triangular mesh surface; and an extraction module for selecting a fitting from the triangular mesh surface Feature element a point cloud, obtaining an uppermost point of the screen from the selected point cloud, and extracting a boundary point in the uppermost point; a fitting module for using an iterative method to set a boundary in the uppermost point The points are fitted into the feature elements, and the parameters of the fitted feature elements are obtained; and a module is created for drawing the feature elements according to the parameters of the feature elements and the fitted feature elements. 如申請專利範圍第8項所述之電腦系統,其中所述提取模組還用於提取所述三角網格曲面中的所有邊界點,將所述最上層點的屬性與該所有邊界點的屬性分別進行比較,以找出所述最上層點中的邊界點。The computer system of claim 8, wherein the extraction module is further configured to extract all boundary points in the triangular mesh surface, and attributes of the uppermost layer point and attributes of the all boundary points A comparison is made separately to find the boundary points in the uppermost point. 如申請專利範圍第8項所述之電腦系統,其中所述提取模組在從所選取的點雲中獲取螢幕的最上層點的過程中執行如下步驟:(a)根據所述點雲資料計算得到點雲的包圍盒,對該包圍盒進行分組,並將點雲資料中每個點的標識填入到相應的分組中;(b)獲取當前點所在的分組,並向週圍各擴大至少一個分組,以得到分組內所有點週圍的三角形;(c)根據螢幕視角法向量為當前點創建射線;(d)統計該射線與所述三角形的交點個數;(e)當所述交點個數等於1時,將當前點加入最上層點的陣列中;及(f)迴圈每個分組中的點,並重複步驟(b)至步驟(e)直至找到所有的最上層點。The computer system of claim 8, wherein the extracting module performs the following steps in the process of obtaining the topmost point of the screen from the selected point cloud: (a) calculating according to the point cloud data Obtaining a bounding box of a point cloud, grouping the bounding boxes, and filling in the identifiers of each point in the point cloud data into the corresponding group; (b) acquiring the group in which the current point is located, and expanding at least one of the surrounding points Grouping to obtain triangles around all points in the group; (c) creating a ray for the current point based on the screen view normal vector; (d) counting the number of intersections of the ray with the triangle; (e) when the number of intersections When equal to 1, the current point is added to the array of the topmost point; and (f) the points in each group are looped, and steps (b) through (e) are repeated until all uppermost points are found.
TW97136027A 2008-09-19 2008-09-19 Computer system and method for fitting characteristic elements TWI416360B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW97136027A TWI416360B (en) 2008-09-19 2008-09-19 Computer system and method for fitting characteristic elements

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW97136027A TWI416360B (en) 2008-09-19 2008-09-19 Computer system and method for fitting characteristic elements

Publications (2)

Publication Number Publication Date
TW201013446A TW201013446A (en) 2010-04-01
TWI416360B true TWI416360B (en) 2013-11-21

Family

ID=44829336

Family Applications (1)

Application Number Title Priority Date Filing Date
TW97136027A TWI416360B (en) 2008-09-19 2008-09-19 Computer system and method for fitting characteristic elements

Country Status (1)

Country Link
TW (1) TWI416360B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104574516B (en) * 2013-10-16 2019-03-05 鸿富锦精密工业(深圳)有限公司 Point cloud smoothing system and method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060285758A1 (en) * 2003-09-03 2006-12-21 Atsushi Marugame Form changing device, object action encoding device, and object action decoding device
TW200823803A (en) * 2006-11-27 2008-06-01 Hon Hai Prec Ind Co Ltd Method for constructing triangular grids of point clouds

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060285758A1 (en) * 2003-09-03 2006-12-21 Atsushi Marugame Form changing device, object action encoding device, and object action decoding device
TW200823803A (en) * 2006-11-27 2008-06-01 Hon Hai Prec Ind Co Ltd Method for constructing triangular grids of point clouds

Also Published As

Publication number Publication date
TW201013446A (en) 2010-04-01

Similar Documents

Publication Publication Date Title
JP5703396B2 (en) Tolerance evaluation with reduced measurement points
US9984177B2 (en) Modeling device, three-dimensional model generation device, modeling method, program and layout simulator
CN101667290B (en) Method and computer system for fitting characteristic elements
US6771840B1 (en) Apparatus and method for identifying the points that lie on a surface of interest
US9953110B2 (en) Apparatus and method for interactively extracting shapes from a point cloud
JP5758090B2 (en) Shape inspection apparatus and shape inspection method
US20100328308A1 (en) Three Dimensional Mesh Modeling
CN112528379B (en) Building model generation method and device and electronic equipment
CN104504760B (en) The method and system of real-time update 3-D view
CN104463969B (en) A kind of method for building up of the model of geographical photo to aviation tilt
CN112991424B (en) Fractal dimension calculation method and device based on octree algorithm
TW201504991A (en) System and method of points cloud section measure
CN112906124B (en) Method, device, equipment and medium for calculating earthwork
JP6201059B2 (en) Ground shape estimation program, ground shape estimation device, and ground shape estimation method
CN114119488A (en) Intelligent size and quality detection method for prefabricated laminated plate facing factory
Campos et al. Splat-based surface reconstruction from defect-laden point sets
CN112687000B (en) Correction method, system and computer readable storage medium for three-dimensional model coordinates
TWI416360B (en) Computer system and method for fitting characteristic elements
CN113763529A (en) Transformer substation modeling method based on three-dimensional scanning
Vezzetti Computer aided inspection: design of customer-oriented benchmark for noncontact 3D scanner evaluation
TW201349171A (en) System and method for establishing a coordinate system on a curved surface
Hafeez et al. The effect of patterns on image-based modelling of texture-less objects
CN110274560A (en) Measuring device, measuring system, measurement method and recording medium
KR101808958B1 (en) Method for obtaining shape information of structure and method for measuring deformation of structure
TWI444586B (en) System and method for detecting form-position tolerances of an object

Legal Events

Date Code Title Description
MM4A Annulment or lapse of patent due to non-payment of fees