201042576 六、發明說明: 【發明所屬之技術領域】 移位歧触賴’找奴-贿取圖像偏 【先前技術】 。:=r:=完⑼ 上就不存在偏移位置,或者說上層圖像在下像 置為零;相反,如果上層圖像和下 層圖像完全落在了下層圖像上,此時上層 :且上 f上必然會形細像分界,只要獲得上i 的困:分界像形j ^ ®像的圖案都十分複雜,劣去園安丄八 果上層圖像和下層 ❹ 輯的邊緣在下層圖像上^^“/^,這樣會導致上層 -獲得上廣圖像在二界很不明顯,無法準確 【發明内容】 置,可以在:層下了層-圖偏移位|的方法及裝 層圖像在下層則象上的偏it 情況下’準確地獲取上 括:本發明實施例提供了—種獲取圖像偏移位置的方法,包 〜圖像的γ姊/或χ軸方向細第—尺樣條線和第二尺 4 201042576 ,該第一 ί滿足預 樣條線;該圖像是由上層圖像和下層圖像疊加構成的, 尺樣條線和第二尺樣條線預先纷製在該上層圖像上, 設的佈局條件;201042576 VI. Description of the invention: [Technical field to which the invention belongs] Displacement disregard ‘search for slaves-bribe image bias 【Previous technique】. :=r:=End (9) There is no offset position, or the upper image is set to zero in the lower image; conversely, if the upper image and the lower image completely fall on the lower image, the upper layer: On the f, there will inevitably be a demarcation of the fine image, as long as the sleepy i is obtained: the pattern of the boundary image j ^ ® is very complicated, and the image of the upper layer and the lower layer of the lower layer are inferior. On ^^"/^, this will cause the upper layer - to obtain the upper wide image in the second boundary is not obvious, can not be accurate [invention] set, can be in the layer: layer - map offset bit | method and layer The image is accurately acquired in the case of the lower layer in the lower layer. The embodiment of the present invention provides a method for acquiring the image offset position, and the γ 姊 / or the 方向 axis direction of the packet ~ - a ruler line and a second ruler 4 201042576, the first ί satisfies the pre-spline; the image is composed of an upper layer image and a lower layer image superimposed, the ruler line and the second rule line are pre- Layout conditions on the upper layer image;
根據探測到的該尺樣條線在該上層圖像的位置和誃 條線在該®像的位置計算上層圖像在下像中的偏移^置。 本發明實施纖供了-髓取圖像偏移位置的裝置,包括: 探測模組,用於沿圖像的γ軸和/或又轴方向探測第一尺 樣條線和第二尺樣條線;該圖像是由上層圖像和下層圖像疊加 構成的’該第-尺雜線和該第二尺雜線預先_在該I層 圖像上,且滿足預設的佈局條件; 確定模組,用於根據探測到的該第一尺樣條線和第二尺樣 條線確定任意一條尺樣條線在上層圖像的位置; 計算模組,用於根據探測到的該尺樣條線在該上層圖像的 位置和該尺樣條線在該圖像的位置計算上層圖像在下層圖像 中的偏移位置。 本發明實施例以圖像處理技術為基礎,利用繪製有尺樣條 線的圖像作為上層圖像完全落在下層圖像上,並與下層圖像進 行疊加,通過對疊加後的圖像從Υ轴和/或X轴方向進行連續 的第一尺樣條線和第二尺樣條線探測’並根據探測結果分析第 一尺樣條線和第二尺樣條線在疊加後的圖像上的位置以及在 上層圖像上的位置’將第一尺樣條線或第二尺樣條線在疊加後 的圖像上的位置以及在上層圖像上的位置進行比較,即可獲得 上層圖像落在下層圖像上的偏移位置。 【實施方式】 下面將結合本發明實施例中的附圖,對本發明實施例中的 5 201042576 行清楚、完細喊’顯然,所贿的實施例僅僅 疋^發明-部分實_,崎是全部的實_。基 的實施例’本領域普通技術人員在沒有作 $ 所獲得的所有其他實施例,都屬於本發· 第一實施例: _ 請參閱第1圖,第1圖為本發明實施例中提供的一種择敗 . =偏移位置的方賊程圖。如第1圖所示,該方法包括“ 步驟101:沿圖像的Y軸和/或又軸方向探測 線和第二尺樣條線;該圖像是由上層圖像和下層圖ί養加t 該J-尺樣條線和第二尺樣條線預先 f t 上,且滿足預設的佈局條件; h上層圖像 上層in第一 t樣條線和第二尺樣條線預先繪製在該 圖像上,且滿足預设的佈局條件具體可以為: 尺樣條線和第二尺樣條線是預先_在上居 目/平行且第一尺樣條線和第二尺樣條線以 說’第一尺樣條線和第二尺樣條線的間距與第-尺 樣條線到達該上層圖像的起始位置的距離他是任不=的的兩條尺 層Jiuif本發明實棚提供的方法’可財步驟1G1之前對卜 理^::圖像疊加構成的圖像進行二值化處理,二值化ΐ 、、疋為了使探測第-尺樣條線和第二尺樣條線更加簡 6 201042576 單,不用受圖像亮度和顏色的影響。 根據本發明實施例提供的方法,可以在二值化處理該圖像 之後,沿圖像的X轴方向獲取多個基準點位置,每一個基準 點位置滿足大於上述的下層圖像與上層圖像的高度的差值,且 小於預設的上述的上層圖像的非尺樣條線區域高度的條件;和 /或 可以沿圖像的γ軸方向獲取多個基準點位置,每一個基 準點位置滿足大於上述的下層圖像與上層圖像的寬度的差值 且小於預設的上述的上層圖像的非尺樣條線區域寬度的條件。’ Ο ❹ 優選地,上述步驟101中的沿圖像的γ軸和/或χ轴方向 探測第一尺樣條線和第二尺樣條線具體可以包括: 從X轴方向上獲取的每個基準點位置開始,沿圖像的γ 軸方向逐各像素遍歷檢測像素灰階值,直到灰階 檢測,並將灰階值為零的騎闕縱坐標存餅^ 樣條=====錄衫義钱,料第一條尺 然後,從灰階值為零的像素點開始,繼續沿 ”,素遍歷檢聰素灰階值,直職階值為零時停止= 小並將义階值為零的像素點的縱坐標存健於第二陣列中. 樣條現次數最多的縱坐標,作為第二條尺 像的和χΐ;方從向位置開始,沿圖 姻’並將灰階值為零的像素以坐 樣條=圖出現次數最多的縱坐標,作為第-條尺 7The offset of the upper layer image in the lower image is calculated based on the detected position of the upper layer image and the position of the stencil line at the position of the photographic line. The device of the present invention provides a fiber-to-myelin image shifting position, comprising: a detecting module for detecting the first and second ruler splines along the γ axis and/or the axis direction of the image a line; the image is formed by superimposing an upper layer image and a lower layer image, and the second ruler line is pre-positioned on the layer I image and satisfies a preset layout condition; a module, configured to determine, according to the detected first and second ruled splines, a position of an upper image of the ruled sample line; and a calculation module, configured to detect the size of the sample The position of the line at the upper layer image and the position of the ruled line at the image calculate the offset position of the upper layer image in the lower layer image. The embodiment of the present invention is based on the image processing technology, and uses the image drawn with the ruled line as the upper layer image completely falls on the lower layer image, and is superimposed with the lower layer image, and the superimposed image is obtained from Continuous first and second ruler line detection in the x-axis and/or x-axis direction' and analyze the superimposed image of the first and second ruled lines according to the detection result The upper position and the position on the upper image 'Compare the position of the first ruler line or the second rule line on the superimposed image and the position on the upper image to obtain the upper layer The image falls at the offset position on the underlying image. [Embodiment] In the following, in conjunction with the drawings in the embodiments of the present invention, the line 5 201042576 in the embodiment of the present invention is clearly and completely shouted 'obviously, the embodiment of the bribe is only 发明^ invention-partial _, saki is all Real _. Embodiments of the present invention are all present in the present invention. All of the other embodiments obtained by those of ordinary skill in the art are disclosed in the first embodiment: _ See FIG. 1 , which is provided in the embodiment of the present invention. A choice of the thief. As shown in Fig. 1, the method includes "Step 101: detecting a line along the Y-axis and/or the axis direction of the image and a second-scale spline; the image is raised by the upper image and the lower layer. t The J-strip line and the second ruled spline are pre-fined and meet the preset layout conditions; h upper layer image upper layer in the first t-spline and the second-scale spline are pre-drawn in the The image on the image and satisfying the preset layout condition may be: the ruler line and the second rule line are in advance_parallel/parallel and the first ruler line and the second ruler line are Say that the distance between the first ruler and the second ruler and the distance from the first ruler to the start position of the upper image is the two ruler Jiuif The method provided by the shed can be binarized before the 1G1 step: the image formed by the image superimposition, binarized ΐ, 疋, in order to detect the first-scale spline and the second rule The line is more simple 6 201042576 single, without being affected by image brightness and color. According to the method provided by the embodiment of the present invention, the image can be processed in binarization Afterwards, a plurality of reference point positions are acquired along the X-axis direction of the image, and each of the reference point positions satisfies a difference greater than a height of the lower layer image and the upper layer image, and is smaller than a preset non-previous image of the upper layer image. a condition of the height of the ruled line region; and/or a plurality of reference point positions may be acquired along the γ-axis direction of the image, each of the reference point positions satisfying a difference greater than a width of the lower layer image and the upper layer image described above and less than The condition of the width of the non-small line region of the above-mentioned upper layer image is preset. ' Ο ❹ Preferably, the first ruler spline is detected along the γ axis and/or the χ axis direction of the image in the above step 101 The second ruled spline may specifically include: starting from each reference point position acquired in the X-axis direction, traversing the detected pixel grayscale value by pixel in the γ-axis direction of the image until grayscale detection, and grayscale The value of the 阙 阙 阙 存 ^ ^ ^ = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Gray scale value, stop when the direct grade value is zero = small and the meaning value is The ordinate of the pixel is stored in the second array. The ordinate with the largest number of splines is used as the sum of the second ruler; the square starts from the position, along the graph' and the grayscale value is zero. The pixel is the first ruler with the seat bar = the ordinate with the most occurrences of the figure.
201042576 然後,從灰階值為零的像辛 步驟102:根據探測到的第一描 定任意-條尺樣條線在上層圖像的位 第一尺樣條線確 其中’步驟102可以包括·· 1)計算第-尺樣條線和第二尺樣條線的間距; 碰’第一尺樣絲和第二尺樣條線的間距可以是第一尺 樣條線和第二尺樣絲的高度絲度之騎間距。 -尺的第—尺樣條線和第二尺樣條線關距與第 =樣條線和第二尺樣條線分制達上述的上顧像的起始 位置的距離賴應廳,確定第-尺樣條線在上制上層圖 ίίΪίί度,或者確定該第二尺樣條線在上述的上層圖像的 步驟103 :根據探測到的該尺樣條線在該上層圖像的位置 和該尺樣條線在該圖像的位置計算該上層圖像在下層圖 的偏移位置。 其中’步驟103可以包括: 什鼻第一尺樣條線在上述的上層圖像上的高度與第一尺 樣條線在上述的圖像上的高度的差值;和/或,計算第二尺樣 條線在上述的上層圖像的高度與第二尺樣條線在上述的圖像 上的高度的差值; 或者’計算第一尺樣條線在上述的上層圖像上的寬度與第 一尺樣條線在上述的圖像上的寬度的差值;和/或,計算第二 8 201042576 ίϊΐϊΐ上述的上層圖像的寬度與第二尺樣條線在上述的 =上的寬度的差值,從而獲得上層圖像在下層圖像中的偏移 位罝0 需要說明的是’本發明實施例只是為了便於 , 測連續的第-尺樣條線和第二尺樣條線,本領域技術人員可以 =’預先在上像上_的尺樣鱗驗二以是大於兩 條的’都屬於本發明的保護範圍。 Ο 〇 上述對本發㈣-實補提供的獲取圖像偏移位置的方 Γί細的介紹,本發明實補舰輕奴樣條線的圖 ‘、、、s圖像元全落在下層圖像上,並與下層圖像進行叠 ί尺疊加後_像從γ轴和/或x軸方向進行連續的_ 並根據_結果分析第一尺 第二尺樣絲在疊加後的圖像上的位置以及在上層 置,將第—尺樣條線或第二尺樣條線在疊加後的圖 圖像落在下:位置進行比較’即可獲得上層 第二實施例: 閱第2圖’第2圖為本發明實施例中提供的一種獲取 位置的方法流程.本㈣實施例以上層圖像的 ^6·526,下層圖像的解析度是冗奶76為例,介紹本發 2施例提供的獲取圖像偏移位㈣方法。如第 方法可以包括: 步驟201:預先在上層圖像上緣製尺樣條線; Μ ί 1胃的尺樣條線是指用於計算上層圖像完全落在下 層圖像上的偏移位置的自繪規律線條。 後,例是以64〇X526大小的白底圖片作為上層圖 ’先從上層圖像的最上邊往下方向以高度1〇〇像素的位置 9 201042576 ,依次以2的n(其中,1<=n<=8)次方高間距居行 中(左、右各留100像素寬度)畫8條橫黑線; Μ,理從上層圖像的最左邊往右方向以左寬度像素的 位置為起始,依次以2的η(其中,1<=η<=8)次方,寬間 距居列中(上、下各留丨⑽像素寬度)晝8條豐黑線; 這樣就形成了一副繪製有尺樣條線的上層圖像,請一併參 f 3圖’第3 ®為本㈣實施繼供轉財尺樣條線的上 廣圖像的示意®。如第3圖所示,尺樣條線位置說明如下:201042576 Then, the symplectic step from the grayscale value is zero. Step 102: According to the detected first description, the arbitrary-strip-shaped spline is in the first-level spline of the upper-layer image. The step 102 may include · 1) Calculate the distance between the first-scale spline and the second-spline spline; the distance between the first-size and second-stripe splines can be the first-spline and the second-stripe The height of the silky ride spacing. - the distance between the first and second ruler lines of the ruler and the distance between the first and second sample lines and the starting position of the above-mentioned upper image, The first-foot spline is on the upper layer ίίΪίί, or the step 103 of determining the second-scale spline in the above-mentioned upper layer image: according to the detected position of the ruled line at the upper layer image and The ruler line calculates the offset position of the upper layer image in the lower layer image at the position of the image. Wherein the step 103 may include: a difference between a height of the first-foot spline on the upper image and a height of the first ruled spline on the image; and/or a second calculation a difference between the height of the upper layer image and the height of the second ruled spline on the image; or 'calculating the width of the first ruled spline on the upper image a difference in width of the first ruled spline on the image above; and/or, calculating a width of the upper layer image of the second 8 201042576 ίϊΐϊΐ and a width of the second ruled spline at the above= The difference is obtained to obtain the offset position of the upper layer image in the lower layer image. 需要 0 It should be noted that the embodiment of the present invention is only for convenience, and the continuous first-scale spline and the second-scale spline are measured. Those skilled in the art can = 'pre-measure the size of the upper image on the upper image to be more than two' are all within the scope of protection of the present invention. Ο 〇 The above description of the position of the offset of the image provided by the present (4)-the real complement, the picture of the actual slave ship light slave spline ',, s image elements all fall on the lower layer image Up, and superimposed with the underlying image _image continuous _ from the γ axis and / or x axis direction and analyze the position of the first ft second ruled wire on the superimposed image according to the _ result And in the upper layer, the image of the superimposed ruler line or the second ruled spline line is placed under the superimposed position: the position is compared 'to obtain the upper layer second embodiment: read the second picture' It is a method flow for obtaining a position provided in the embodiment of the present invention. In the fourth embodiment, the resolution of the lower layer image is 276, and the analysis of the lower layer image is taken as an example. Get the image offset bit (four) method. For example, the method may include: Step 201: Pre-cut the ruler line on the upper layer image; Μ ί 1 The ruler line of the stomach refers to an offset position for calculating that the upper layer image completely falls on the lower layer image. Self-painting regular lines. After that, the example is a 64 〇 X 526 size white background image as the upper layer image 'first from the top edge of the upper layer image to the height of 1 〇〇 pixel position 9 201042576, followed by 2 n (where 1 <= n<=8) The height of the secondary high-distance line (left and right left 100 pixels wide) draws 8 horizontal black lines; Μ, from the leftmost right direction of the upper image to the left width pixel position First, in order of 2 η (where 1 < = η < = 8) power, the wide spacing in the column (upper and lower each remaining (10) pixel width) 昼 8 black lines; thus forming a pair To draw the upper layer image with the ruler line, please refer to the figure 3 of the 3rd ® (4) implementation of the image of the upper wide image of the feed-for-traffic sample line. As shown in Figure 3, the position of the ruler line is as follows:
尺樣條線從上到下、從左到右分別以相對丨⑽像素偏移 的2的1次方( = 2) ’ 2的2次方( = 4),2的3次方〇8), 2的4次方(=16),2的5次方(=32),2的ό次方(=64), 2的7次方(=128),2的8次方(=256);其中,第3圖所 示的上層圖像中水準方向、垂直方向各繪製8條尺樣條線, 上、下、左、右100像素邊距區域為非尺樣條線區域,中間 尺樣條線交錯區域440x326為尺樣條線區域。 步驟202 :對上層圖像和下層圖像疊加後的圖像進行二值 化處理; 二值化的目的是為了讓後續對圖像的尺樣條線的探測處 理更加簡單,而且不受圖像亮度和顏色的影響。 影響二值化結果的因素主要是中間灰階值(亮度值)的取 值’如果灰階值的取值偏低,則二值化後的黑色樣條線會更加 淡細,樣條線之間的清晰度會越明顯;如果灰階值的取值偏 高’則二值化後的黑色樣條線會更加粗濃,尺樣條線只見的清 晰度會越模糊。 步驟203 :沿圖像的X軸方向獲取多個基準點位置; 其中,多個基準點位置滿足大於上述下層圖像與上層圖像 的高度的差值、且小於預設的上述的上層圖像的非尺樣條線區 201042576 域高度的條件。 、根據本發明實施例提供的上層圖像和下層圖像的大小’由 於上層圖像完全落在下層圖像上,所以上層圖像相對下層圖像 的偏移位置範圍為:〇<=上偏移<=64 ; 0<=左偏移<=50。其中, 為下層圖像的高度與上層圖像的高度640的差值,50 為下層圖像的寬度576與上層圖像的寬度526的差值。 即是,多個基準點位置的高度大於6〇像素和/或多個基準 =位,的寬度大於5Q像素’且小於1GG像素的非尺樣條線區 ft南度條件。這裡所述的丨〇〇像素的非尺樣條線區域的高度 〇 0括上,下,左,右的非尺樣條線區域的高度。其中,本發明實施 ,選擇疊加後的圖像80像素位置作為基準點位置’可以滿足 基準點位置需要的條件。 =驟204 :以X轴方向獲取的多個基準點開始,沿γ轴 方向探測第一條尺樣條線’獲取第-條尺樣條線的高度值; 假设’本發明實施例從χ轴方向獲取的多個基準點的數 =為30個,則遍歷這3〇基準點,依次從每一個基準點開始, /σ γ轴方向上逐各像素遍歷檢測像素灰階值,直到碰到了灰 階值為0的像素,將該像素的縱坐標(高度值)存儲在第一陣 ❹ 列中,這樣當30個採用探測結束時,第一陣列填滿;例如: 第陣列-{452,381,382,451,382,382,382,382,452, 382,382,382,382,撕,382,382,382,452,382,382, 381,382 ’ 382,382,382,382,383,382,382,382 }; 從第一陣列中統計出現次數最多的縱坐標為382,則將縱 坐標382作為第—條尺樣條線在該圖像上的高度值。 步驟205 :繼續沿γ轴方向探測第二條尺樣條線,獲取第 二條尺樣條線的高度值; 從第一陣财存朗灰階值為料像素點開始 ,繼續沿圖 201042576 像的γ軸方向逐各像素遍歷檢測像素灰階值,直到碰到了灰 階值為0的像素’將該像素的縱坐標(高度值)存儲在第二陣 列中’這樣當30個採用探測結束時,第二陣列填滿;例如: 第二陣列={451,254,254,450,254,254,255,254, 451,254,254,255,254,254,254,253,255,451,254, 254 ’ 253 ’ 254 ’ 254,254,254,254,253,254,254,254 }; 從第二陣列中統計出現次數最多的縱坐標為254,則將縱 • 坐標245作為第二條尺樣條線在該圖像上的高度值。 ❹ 步巧206 :計算第一條尺樣條線與第二條尺樣條線的間 距,推算上層圖像在下層圖像上的Υ軸方向偏移位置。 其中,由上述步驟203和步驟204可知,第一條尺檨條峻 =H382 ’第二條尺樣條線在圖像上的it 第 樣條線與第二條尺樣條線的間距為: 利用上層圖像上纷製的尺樣條線的規律,確定第 條線或第二條尺樣條線在上層圖像上的位置。 ' ❹的面的表1,表1表示繪製在上層圖像上尺樣條線The ruler lines are offset from the top to the bottom, from left to right, with a 丨(10) pixel offset of 2 to the power of 2 (= 2) ' 2 to the power of 2 (= 4), 2 to the 3rd power 〇 8) , 2 to the 4th power (=16), 2 to the 5th power (=32), 2 to the power of the second (=64), 2 to the 7th power (=128), 2 to the 8th power (=256) Among them, in the upper layer image shown in Fig. 3, eight ruler lines are drawn in the horizontal direction and the vertical direction, and the upper, lower, left and right 100 pixel margin areas are non-small line areas, and the middle size is The line interlaced area 440x326 is a ruled line area. Step 202: Perform binarization processing on the superimposed image of the upper layer image and the lower layer image; the purpose of the binarization is to make the subsequent detection processing of the ruled line of the image simpler and not subject to the image. The effect of brightness and color. The factor affecting the binarization result is mainly the value of the intermediate grayscale value (luminance value). If the grayscale value is lower, the binarized black spline will be more subtle, and the spline will be The sharpness between the two will be more obvious; if the value of the grayscale value is higher, the blackned spline will be thicker and thicker, and the sharpness of the ruled line will be blurred. Step 203: Acquire a plurality of reference point positions along the X-axis direction of the image; wherein, the plurality of reference point positions satisfy a difference greater than a height of the lower layer image and the upper layer image, and is smaller than the preset upper layer image The non-small line area 201042576 is the height of the field. According to the size of the upper layer image and the lower layer image provided by the embodiment of the present invention, since the upper layer image completely falls on the lower layer image, the offset position range of the upper layer image relative to the lower layer image is: 〇<= Offset <=64;0<=left offset <=50. Wherein, the difference between the height of the lower layer image and the height 640 of the upper layer image, 50 is the difference between the width 576 of the lower layer image and the width 526 of the upper layer image. That is, the height of the plurality of reference point positions is greater than 6 〇 pixels and/or the plurality of reference = bits, and the width is greater than 5Q pixels ′ and less than 1 GG pixels of the non-small line area ft south condition. The height 〇 0 of the non-small line area of the 丨〇〇 pixel described here includes the heights of the upper, lower, left, and right non-small line areas. Here, in the practice of the present invention, selecting the superimposed image 80 pixel position as the reference point position' can satisfy the condition required for the reference point position. = step 204: starting with a plurality of reference points acquired in the X-axis direction, detecting the first ruler spline 'in the γ-axis direction' to obtain the height value of the first-strip-shaped spline; assuming that the embodiment of the present invention is from the x-axis The number of the plurality of reference points acquired in the direction is 30, and the 3 〇 reference points are traversed, starting from each of the reference points in turn, and the pixel grayscale value is traversed by each pixel in the /σ γ-axis direction until the gray level is encountered. A pixel whose order value is 0 stores the ordinate (height value) of the pixel in the first array, so that when the 30 detection ends, the first array is filled; for example: the first array - {452, 381 ,382,451,382,382,382,382,452, 382,382,382,382, tear, 382,382,382,452,382,382, 381,382 ' 382,382,382,382,383 , 382,382,382 }; The ordinate with the most statistical occurrences from the first array is 382, and the ordinate 382 is used as the height value of the first-strip-shaped spline on the image. Step 205: continue to detect the second ruled sample line along the γ axis direction, and obtain the height value of the second ruled sample line; start from the first array of grayscale values, and continue along the image of 201042576. The γ-axis direction traverses the pixel grayscale value by pixel by pixel until the pixel with the grayscale value of 0 is encountered 'store the ordinate of the pixel (height value) in the second array' so that when 30 probe ends , the second array is filled; for example: second array = {451, 254, 254, 450, 254, 254, 255, 254, 451, 254, 254, 255, 254, 254, 254, 253, 255, 451, 254, 254 ' 253 ' 254 ' 254,254,254,254,253,254,254,254 }; The most frequently occurring ordinate from the second array is 254, then the vertical coordinate 245 is taken as the second The height value of the ruler line on the image.步 Step 206: Calculate the distance between the first ruler line and the second ruler line, and estimate the offset position of the upper layer image on the lower layer image. It can be seen from the above steps 203 and 204 that the distance between the first line and the second line of the second ruled line on the image is: The position of the first line or the second ruled line on the upper image is determined by the rule of the ruled line on the upper image. ' Table 1 of the face of the ❹, Table 1 shows the ruled line drawn on the upper image
\^-條 28 27 第^^\ 28 27 128 (27) - 26 192 64 (26) ' [¥ 224 96 ' 24 240 112 23 248 120 — 22 252 124 21 254 126 12 201042576 關係: 有這ϊίίί』律可以得知上層圖像上預先繪製的尺樣條線具 不會1^^何_ 2的n次方位置的A樣條線之間的間距是 2)任何_ 2的η次方位置的尺樣條狀_間距存在 2 - 2m >= 2(η· (m>-〇,n >= ι , m<n) 祕上規律,可以在計算出第-條尺樣條線與第二條尺\^-条28 27 第^^\ 28 27 128 (27) - 26 192 64 (26) ' [¥ 224 96 ' 24 240 112 23 248 120 — 22 252 124 21 254 126 12 201042576 Relationship: There is this ϊ ί ί ί It can be known that the pre-drawn ruler line on the upper layer image does not have a spacing between the A-sample lines at the n-th power position of 2^^ _ 2 is 2) the η-th power position of any _ 2 The ruler strip _ spacing exists 2 - 2m >= 2(η· (m>-〇,n >= ι , m<n) The secret rule can be calculated in the first ruler line and the first Two ruler
間距時’很容易的得知第一條尺樣條線與第二條 條線在上層圖像上的位置。 _ 實&例_ ’第—條尺樣絲與第二條尺樣條線 給二β疋128,根據上述表1 ’可以知道這是28標識的尺樣條 線和s標識的尺樣條線的之間的間距。從而知道第一條尺樣 ,線是28標識的尺樣條線’第二條尺樣條線& y標識的尺樣 Y备錄。 另$,又知道28標識的第一條尺樣條線相對上層圖像最 上邊的高度為:/+ ; 27標麵第二條尺樣條線相對上層圖 像最上邊的高度為:27+1()();靠,根據第—條尺樣條線相對 上層圖像最上邊的高度(28+lGG)以及第—條尺樣條線在疊加 後的圖像辛的位置382,或者根據第二條尺樣條線相對上層圖 像最上邊的高度(27+1〇〇)以及第二條尺樣條線在疊加後的圖 像中的位置254 ’可以得到上層圖像落在下層圖像上的 置為:偏移位置=382- (28+100) =26,或者,偏移位 (27+100) =26。 本實施例只是介紹從在Y轴方向上獲取上層圖像在下層 圖像上的偏移位置,本領域技術人員可以理解,根據本發明| 施例提供的方法’同樣可以從在X轴方向上的獲取上層圖像 13 201042576 ί t的偏雜置,由於從X財向上_取上層圖 偏移位置與從Y軸方向上賴取上層圖像 像上的偏移位置的方法完全補,所以本實施例在此 ,f* f 本實施例僅以2為底數’介紹本實施例提供的療製 ο <n)即可,本實施例不作限 $上層_上的尺樣條線的佈局規律’還可以通過改變指數2 為3、4、5……等大於2的有理數,主要滿足:an-a™ >= a(n-(其中 ’ a >= 2 ’ m >= 〇,n >=卜 定。 ΟAt the time of spacing, it is easy to know the position of the first ruler line and the second line on the upper layer image. _ Real & Example _ 'The first ruler wire and the second ruler line to the second β疋128, according to the above Table 1 'can be known that this is the 28 mark of the ruled line and the s logo of the ruled strip The spacing between the lines. Thus, the first ruler is known, and the line is the ruler line of the 28 mark. The second ruler line & y identifies the size Y record. Another $, also knows that the height of the first ruled line of the 28 mark relative to the uppermost side of the upper layer image is: / + ; 27 The second ruler of the second ruled line is the uppermost height of the upper layer image: 27+ 1()(); depends on the height of the uppermost edge of the upper layer image (28+lGG) and the position of the first ruler-like sample line after the superimposed image is 382, or according to The height of the second ruler line relative to the uppermost edge of the upper layer image (27+1〇〇) and the position of the second ruler line in the superimposed image 254′ can be obtained as the upper layer image falls on the lower layer map. The image is set to: offset position = 382- (28 + 100) = 26, or offset bit (27 + 100) = 26. This embodiment only introduces the offset position of the upper layer image on the lower layer image from the Y-axis direction. It will be understood by those skilled in the art that the method according to the present invention can also be viewed from the X-axis direction. Obtaining the superimposed image of the upper layer image 13 201042576 ί t, since the offset position of the upper layer image from the X financial direction is taken up and the offset position on the upper image image is taken from the Y axis direction, Embodiments Here, f* f This embodiment only describes the treatment system ο <n) provided by the embodiment in the case of 2 as the base number. This embodiment does not limit the layout rule of the ruler line on the upper layer _. 'It is also possible to change the index 2 to 3, 4, 5, etc. rational numbers greater than 2, mainly satisfying: an-aTM >= a(n-(where ' a >= 2 ' m >= 〇, n >=卜定. Ο
Q 、:ΐ述ί本發明第二實施例提供的獲取圖像偏移位置的方 •/II ΐ細的介紹’本發明實施例利躲製有尺樣條線的圖 ί作ί層圖像完全落在下層_上,並與下層圖像進行疊 ,乙過對疊加後的圖像從γ轴方向進行連續的第一尺樣條 篦和線探測’並根據探測結果分析第-尺樣條線‘ =第-尺樣條線或第二尺樣條線在疊丄;= nr 1固你上層圖像上的位£進行比較,#可獲得上層圖像落在 下層圖像上的偏移位置。 第三實施例: 傻2 ’第4圖為本發明實施例提供的—種獲取圖 ,,移位置的裝置的結構*意圖。如第4圖所示,該裝置可以 包括: —ρΪΪ,401 ’用於沿圖像的Υ轴和/或Χ軸方向探測第 h線和第二尺樣條、線;該圖像是由上層圖像和下層圖像 的’第-尺樣條線和第二尺樣條_先繪製在上述上 層圖像上,且滿足預設的佈局規律; 心f選,’第-尺樣條線和第二尺樣條線滿足預設的佈局規 #包括1_尺樣絲和第二尺樣條線相互平行,且第一尺樣 201042576 條線和第二尺樣條線的間距對應預設的第一尺樣條線和第二 尺樣條線分別到達上述上層圖像的起始位置的距離。 , 具體地’第一尺樣條線和第二尺樣條線滿足預設的佈局規 ,可以和上述第二實施例中的表1所示,本實施例在此不再復 述。 確定模組402 ’用於根據探測到的第一尺樣條線和第二尺 樣條線確定任意一條尺樣條線在上層圖像的位置; 計算模組403 ’用於根據探測到的該尺樣條線在上述的上 Ο 層圖像的位置和該尺樣條線在該圖像的位置計算上層圖像在 下層圖像中的偏移位置。 優選地’本發明實施例提供的裝置還可以還包括: 處理模組404,用於在上述探測模組401對該圖像探測第 一尺樣條線和第二尺樣條線之前,對該圖像進行二值化處理。 優選地,本發明實施例提供的裝置還可以還包括: 獲取模組405,用於在上述探測模組4〇1對該圖像探測第 一尺樣條線和第二尺樣條線之前,沿該圖像的X軸方向獲取 多個基準點位置,該基準點位置滿足大於上述的下層圖像與上 的差值,且小於預設的上述的上層圖像的非义樣 條線&域向度的條件;和/或 沿該圖像的γ軸方向獲取多個基準點位置,該 ^滿足大於上述下層圖像與上層圖像的寬度的差值,且小於預 設的上述的上層圖像的非尺樣條線區域寬度的條件。 、 請一併參閱第5圖,第5圖為本發明實施例提供的一 測模組的結構示意圖。如第5圖所示,探測模組4〇1包括: 準點子模、组4〇11,用於從Χ轴方向上獲取的每個基 準點位置開始像的γ軸方向逐各像素顧檢測像素灰 15 201042576 制,餅紐料料像素點 模組4012 ’用戶與從第一陣列中統計出現次數是 夕Ύ坐払’作為第一條尺樣條線在該圖像上的高度; ,,歷檢測子模组備,麟從灰階值為零的 ,續沿圖像的Υ軸方向逐各像素遍歷檢測像素灰階值3 標存檢測,並將灰階值為零的像素點的縱坐 ❹ Ο 多的S子:次數最 的每測子模組備用於從γ軸方向上獲取 _χ _向逐各像素遍歷檢 的像素點的橫坐標===錄測,並將灰階值為零 多⑶計:;;:^^現次數最 開始上4011還用於從灰階值為零的像素點 直到灰階信*的軸方向逐各像素遍歷檢測像素灰階值, 標存儲於ίίί St檢測,並將灰階值為零的像素點的橫坐 最多ΐίϊϊΐίΓ2還麟從第二陣财統計出現次數 、示作為第一條尺樣條線在圖像上的寬度。 定模閱ί6圖’第6圖為本發明實施例提供的一種確 、、的-構不意圖。如第6圖所示,確定模组4〇2可以包括: 線的32模組彻,用於計算第—尺樣條線和第二尺樣條 16 201042576 確定子模組4022,用於根據預設的第一尺樣條線和第二 尺樣條線的間距與第一尺樣條線和第二尺樣條線分別到達上 f的上層®像的起始位置的距觸龍隱,確㈣—尺樣條 線在上述上層®制《度或寬度,或者較帛二尺樣條線在上 述上層圖像的高度或寬度。 可選地,上述計算模組4〇3具體用於計算第一尺樣條線在 ,上層圖像的冑度或寬度鮮__尺雜齡圖像上的高度 或冗度的差值; ❹ Ο 或者’用於計算第二尺樣條線在上層圖像的高度或寬度與 第二尺樣條線在圖像上的高度或寬度的差值,從而獲得上^ 層圖像在下層圖像中的偏移位置。 亡述3本㈣第三實施纖供賴取圖像偏移位置的裝 推了詳、細的介紹’本發明實施例利用_有尺樣條線的圖 為上層圖像完全落在下層圖像上,並與下層圖像進 =^過對叠加後的圖像從γ轴方向進行 ί ’ #雜湖絲分料—尺樣條線和 :表條線在疊加後的圖像上的位置以及在上層 第-尺樣條線或第二尺樣條線在疊加後的圖像上的位 -Λ 上層雖上的位置精味,即可獲得上層圖像落在 下層圖像上的偏移位置。 私备牡 ㈣it ϊ#通技術可㈣解:實現上述方法實施例的全 存儲於「電腦可讀取存儲介質中,該程式在執行時,: 订υ括上述方法實施例的步驟;而前述的存儲介質包括 ;===_ (RAM)m者光碟等各種 方法:發所提供的一種獲取圖像偏移位置的 裝置進订了 κ绍,本文中應用了具體個例對本發明 17 201042576Q, ΐ ί ί 第二 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取 获取It completely falls on the lower layer _ and overlaps with the lower layer image. After the superimposed image, the first image of the superimposed image is continuous from the γ-axis direction and the line detection ' and analyzes the first-strip spline according to the detection result. Line ' = the first-foot spline or the second-foot spline in the stack; = nr 1 fix the bit on your upper image to compare, # can get the offset of the upper image on the lower image position. The third embodiment: Fig. 4 is a schematic diagram of the structure of the device for moving the position provided by the embodiment of the present invention. As shown in Fig. 4, the apparatus may include: - ρ ΪΪ 401 ' for detecting the h-th line and the second-scale spline, line along the x-axis and/or the x-axis direction of the image; the image is from the upper layer The 'the first ruler line and the second ruler' of the image and the lower layer image are first drawn on the above upper layer image and satisfy the preset layout rule; the heart f is selected, the 'first ruler sample line and The second rule spline satisfies the preset layout rule #includes the 1_ ruler wire and the second ruler sample line are parallel to each other, and the spacing of the first ruler 201042576 line and the second ruler sample line corresponds to the preset The first ruler and the second ruler respectively reach the distance from the start position of the upper image. Specifically, the first ruler line and the second ruler line satisfy the preset layout rule, and can be shown in Table 1 in the second embodiment, and the embodiment will not be repeated here. The determining module 402' is configured to determine the position of any one of the ruled splines in the upper layer image according to the detected first and second ruled splines; the calculating module 403' is configured to detect the The ruler line calculates the offset position of the upper layer image in the lower layer image at the position of the above-described upper layer image and the position of the ruler line at the image. Preferably, the apparatus provided by the embodiment of the present invention may further include: a processing module 404, configured to: before the detecting module 401 detects the first and second ruled splines for the image, The image is binarized. Preferably, the apparatus provided by the embodiment of the present invention may further include: an obtaining module 405, configured to: before the detecting module 4〇1 detects the first and second ruled splines of the image, Acquiring a plurality of reference point positions along the X-axis direction of the image, the reference point position satisfying a difference between the lower layer image and the upper portion, and smaller than the preset non-sense spline of the upper layer image. a condition of the domain dimension; and/or acquiring a plurality of reference point positions along the γ-axis direction of the image, the ^ satisfying a difference larger than a width of the lower layer image and the upper layer image, and smaller than the preset upper layer The condition of the width of the non-small line area of the image. Please refer to FIG. 5, which is a schematic structural diagram of a test module according to an embodiment of the present invention. As shown in FIG. 5, the detecting module 4〇1 includes: a quasi-point sub-module, a group 4〇11, for detecting the pixel from the pixel in the γ-axis direction of each reference point position obtained from the x-axis direction. Gray 15 201042576 system, cake material material pixel module 4012 'user and the number of occurrences from the first array is the number of times sitting on the image as the height of the first ruler line on the image; The detection sub-module is prepared, and the gradation of the gray-scale value is zero, and the pixel-level traversal detection pixel gray-scale value 3 is detected along the Υ-axis direction of the image, and the pixel point of the gray-scale value is zero ❹ Ο Many S sub-caps: Each sub-module with the highest number of times is used to obtain _χ _ from the γ-axis direction to the abscissa of the pixel traversed by each pixel === recording, and the gray-scale value is Zero more (3) count: ;;: ^ ^ The number of times at the beginning 4011 is also used to traverse the detected pixel grayscale value from pixel to pixel of the grayscale value to the axis direction of the grayscale letter*, the standard is stored in ίίί St detects, and the cross-sitting of the pixel points with the gray-scale value of zero is at most ΐίϊϊΐίΓ2, and the number of occurrences of the second fiscal statistics is shown. A first spline ulnar width in the image. FIG. 6 is a schematic diagram of an embodiment of the present invention. As shown in FIG. 6, the determining module 4〇2 may include: a 32-module of the line for calculating the first-scale spline and the second-spline spline 16 201042576 Determining the sub-module 4022 for Set the distance between the first and second ruler lines and the distance between the first and second ruler lines to reach the starting position of the upper layer of the upper f, respectively. (d) - the ruler line is in the above upper layer ® "degree or width, or the height or width of the upper layer image of the two-dimensional spline." Optionally, the calculating module 4〇3 is specifically configured to calculate a difference between the height or the redundancy of the first-level spline, the width or the width of the upper image, and the redundancy; Ο or 'used to calculate the difference between the height or width of the upper image and the height or width of the second ruled line on the image, thereby obtaining the image of the upper layer in the lower layer The offset position in . 3 (4) The third embodiment of the fiber is used for the image offset position. The detailed description of the image is used. The embodiment of the present invention uses the image of the ruled line to completely fall on the lower layer image. Up, and the lower layer image is input = ^ over the superimposed image from the γ axis direction ί ' #杂湖丝分料 - ruler line and: the position of the strip line on the superimposed image and In the upper layer of the first-foot spline or the second-size spline, the position of the upper layer on the superimposed image is fine, and the offset position of the upper image on the lower image can be obtained. . Private preparation of the four (four) it ϊ #通技术可(四) Solution: The embodiment of the above method is fully stored in a "computer readable storage medium, when the program is executed, the steps of the above method embodiment are stipulated; The storage medium includes: ===_ (RAM)m, the optical disc, and the like: a device for obtaining an image offset position provided by the sender has been ordered by κ, and a specific example is applied herein to the present invention 17 201042576
If 2實施方式進行了·,以上實關的說明只是用於幫 =解t發明的方法及其核心、思想;同時,對於本領域的-般 本發明的思想,在具體實施方式及應用範圍上 均會有改變之處’综上所述,本說明書内容不應理解為對本發 明的限制。 【圖式簡單說明】 第1圖為本發明實施例中提供的一種獲取圖像偏移位置 的方法流程圖; 第2圖為本發明實施例中提供的一種獲取圖像偏移位置 〇 的方法流程圖; 第3圖為本發明實施例中提供的繪製有尺樣條線的上 圖像示意圖; 第4圖為本發明實施例中提供的一種獲取圖像偏移位置 的裝置結構圖; 第5圖為本發明實施例中提供的一種探測模組的結構示 意圖;If 2 implementations have been carried out, the above description is only used to help the solution of the invention and its core, ideas; at the same time, for the general inventive concept of the field, in the specific implementation and application scope There are variations from the above description, and the contents of this specification are not to be construed as limiting the invention. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a flowchart of a method for acquiring an image offset position according to an embodiment of the present invention; FIG. 2 is a method for acquiring an image offset position 提供 according to an embodiment of the present invention; FIG. 3 is a schematic diagram of an upper image of a ruled line drawn according to an embodiment of the present invention; FIG. 4 is a structural diagram of an apparatus for acquiring an image offset position according to an embodiment of the present invention; 5 is a schematic structural diagram of a detecting module provided in an embodiment of the present invention;
第6圖為本發明實施例中提供的一種確定模組的社 意圖。 …傅不 【主要元件符號說明】 探測模組...............401 遍歷檢測子模組......4011 統計子模組............4012 確定模組...............402 計算子模組............4021 確定子模組............4022 18 201042576 計算模組...............403 處理模組...............404 擷取模組...............405 ❹ ❹ 19Figure 6 is a view showing a social module for determining a module according to an embodiment of the present invention. ...Fu does not [main component symbol description] detection module..................401 traversal detection sub-module...4011 statistical sub-module...... ...4012 Determining the module...............402 Calculating the submodule............4021 Determining the submodule... .........4022 18 201042576 Computing Module...............403 Processing Module...............404 Capture module..................405 ❹ ❹ 19