TW201447241A - Method of water level measurement - Google Patents

Method of water level measurement Download PDF

Info

Publication number
TW201447241A
TW201447241A TW102120913A TW102120913A TW201447241A TW 201447241 A TW201447241 A TW 201447241A TW 102120913 A TW102120913 A TW 102120913A TW 102120913 A TW102120913 A TW 102120913A TW 201447241 A TW201447241 A TW 201447241A
Authority
TW
Taiwan
Prior art keywords
water level
image
block
value
boundary
Prior art date
Application number
TW102120913A
Other languages
Chinese (zh)
Other versions
TWI487884B (en
Inventor
Tai-Been Chen
Wei-Chang Du
Yung-Hui Huang
Original Assignee
Univ Ishou
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 Univ Ishou filed Critical Univ Ishou
Priority to TW102120913A priority Critical patent/TWI487884B/en
Publication of TW201447241A publication Critical patent/TW201447241A/en
Application granted granted Critical
Publication of TWI487884B publication Critical patent/TWI487884B/en

Links

Abstract

A method of water level measurement is used to measure the level of water. The method includes an image reading step, an image adjusting step, and a water level computing step. The image reading step computes the real size of a pixel from an original image that fetching by a computer. The image adjusting step adjusts the original image to a horizontal image according to the angle between the camera's view-angle line and horizontal line, and selects a plurality of regions of interest (ROI) from the horizontal image. The water level computing step estimates the corresponding water surface position of each region of interest, and then computes the water level of the original image according to the plurality of water surface positions derived from the plurality of regions of interest.

Description

多區塊水位量測方法 Multi-block water level measurement method

本發明係關於一種多區塊水位量測方法,尤其是一種透過影像分析處理技術計算水位高度的多區塊水位量測方法。 The invention relates to a multi-block water level measuring method, in particular to a multi-block water level measuring method for calculating a water level height through image analysis processing technology.

台灣位處極易致災的西太平洋季風區,且平均每年遭受西太平洋生成颱風侵台四次以上,颱風所挾帶的豪大雨經常導致水患頻傳,帶來嚴重經濟損失。此外,隨著全球暖化、氣候變遷而造成降雨型態改變,近年來短時間內大降雨量的極端暴雨屢見不鲜,極端降雨型態容易造成都市地區短時間內無法排除多餘雨量、區域排洪不及而淹水,嚴重威脅民眾的生命與財產安全。 Taiwan is located in the western Pacific monsoon region, which is extremely vulnerable to disasters. On average, it has been invaded by the typhoon in the western Pacific for more than four times a year. The heavy rains brought by the typhoon often lead to frequent floods and serious economic losses. In addition, with the global warming and climate change, the rainfall patterns have changed. In recent years, extreme rainstorms of heavy rainfall have been common in recent years. Extreme rainfall patterns are likely to cause urban areas to be unable to eliminate excess rainfall and areas in a short period of time. Flooding is not enough to flood, seriously threatening the lives and property of the people.

據此,水災的監控與預警向來是災害防範的首要目標,習知淹水警報方法為接收到人工通報後,派駐相關人員到淹水現場以一習用接觸式水位量測裝置測量水位高度,再將測量結果回報至災害應變中心統計處理,以判斷淹水情況,進而發出警報,然而這種方式往往需浪費大量人力進行淹水實地水位量測與結果彙整統計。為了解決上述習知淹水警報方法所面臨的問題,針對淹水機率較高的低窪地區,通常會常駐設置該習用接觸式水位量測裝置以隨時監測水位,並且透過有線或無線通訊方式自動回傳測量結果,以節省救災資源。 Accordingly, the monitoring and early warning of floods has always been the primary target of disaster prevention. After receiving the manual notification, the known flooding warning method is to send relevant personnel to the flooding site to measure the water level by a conventional contact water level measuring device. The measurement results are returned to the disaster response center for statistical processing to determine the flooding situation, and then an alarm is issued. However, this method often wastes a lot of manpower for flooding the on-site water level measurement and result aggregation statistics. In order to solve the problems faced by the above-mentioned conventional flood warning method, in the low-lying areas with high flooding probability, the conventional contact water level measuring device is usually resident to monitor the water level at any time and automatically return through wired or wireless communication. Pass the measurement results to save disaster relief resources.

惟,該習用接觸式水位量測裝置由於必須伸入水中進行測量,遇到水流湍急時往往難以成功量測,甚至有裝置直接被沖走或沖毀的風險存在。此外,該習用接觸式水位量測裝置的量測範圍往往受裝置本身 的尺寸限制,當淹水深度過高時,容易有裝置本身被淹沒導致失去測量功能的情形產生。 However, since the conventional contact type water level measuring device has to be inserted into the water for measurement, it is often difficult to measure successfully when the water flow is in a hurry, and even there is a risk that the device is directly washed away or destroyed. In addition, the measuring range of the conventional contact water level measuring device is often affected by the device itself. The size limit, when the flooding depth is too high, is prone to the situation that the device itself is submerged and the measurement function is lost.

為了解決上述習知淹水監控方法所面臨的問題,如中華民國第201024687號「雷射光學影像水位量測裝置及其方法」專利申請案所述內容,揭示一種習知非接觸式水位量測方法,可透過非接觸的方式以一雷射光源射入一水體,並且拍攝水體表面影像以測量該水體水位。該專利案之裝置及其方法雖可改善習用接觸式水位量測裝置必須伸入水中,具有容易量測失敗或毀損裝置的缺點,但該裝置若需設置於各個待偵測地點,仍然有成本較高的問題,難以據以施行大範圍淹水監控。再者,由於淹水時水體往往呈現渾濁且充滿雜物,以雷射光源照射的方式亦具有無法正確量測水位的問題。 In order to solve the problems faced by the above-mentioned conventional flood monitoring method, for example, the content of the patent application of the "Lens Optical Image Water Level Measuring Device and Method" of the Republic of China No. 201024687 discloses a conventional non-contact water level measurement. The method can inject a water source into a body of water by a non-contact method, and take a water surface image to measure the water level of the water body. The device and method thereof of the patent can improve the conventional contact type water level measuring device to be inserted into the water, and have the disadvantages of easy measurement failure or damage to the device, but the device still needs to be installed at each location to be detected, and still has a cost. The higher the problem, it is difficult to implement a wide range of flood monitoring. Moreover, since the water body tends to be turbid and full of debris when flooded, the method of irradiating with a laser light source also has the problem that the water level cannot be accurately measured.

綜上所述,該習知非接觸式水位量測方法雖可達成「以非接觸方式量測水位」之目的,然而仍有「設置成本過高」及「量測準確度可能受水體顏色與水中漂流物影響」等疑慮,在實際使用時容易衍生不同限制與缺點,確有不便之處,亟需進一步改良,以提升其實用性。 In summary, the conventional non-contact water level measurement method can achieve the purpose of "measuring the water level in a non-contact manner", but there are still "the setting cost is too high" and "the measurement accuracy may be affected by the water color and Concerns such as the influence of drifting water in water, it is easy to derive different limitations and shortcomings in actual use, and there are inconveniences that need further improvement to improve its practicability.

本發明的目的乃改良上述之缺點,以提供一種多區塊水位量測方法,僅需就傳統監視攝影機所拍攝之影像進行分析處理,即可量測水位高度,具有降低系統設置成本之功效。 The object of the present invention is to improve the above-mentioned disadvantages, and to provide a multi-block water level measurement method, which only needs to analyze and process the image captured by the conventional surveillance camera, and can measure the water level height, thereby reducing the system installation cost.

本發明另一目的係提供一種多區塊水位量測方法,該多區塊水位量測方法以影像辨識方式判斷水位高度,量測時不受水體顏色與水中漂流物影響,具有增加水位量測準確性之功效。 Another object of the present invention is to provide a multi-block water level measurement method. The multi-block water level measurement method determines the water level height by image recognition, and is not affected by water color and water drifting during measurement, and has an increased water level measurement. The effect of accuracy.

本發明又一目的係提供一種多區塊水位量測方法,該多區塊水位量測方法為使用一梯度運算子邊緣搜尋法偵測邊界位置,於一影像中 選出一判斷區塊,針對該判斷區塊套用該梯度運算子邊緣搜尋法,具有提升運算速度之功效。 Another object of the present invention is to provide a multi-block water level measurement method, which uses a gradient operator edge search method to detect a boundary position in an image. A decision block is selected, and the gradient operation sub-edge search method is applied to the judgment block, which has the effect of improving the operation speed.

本發明再一目的係提供一種多區塊水位量測方法,該多區塊水位量測方法係於該影像中選取複數個該判斷區塊,並依據該複數個判斷區塊運算產生複數個水面位置,一併考量該複數個水面位置以計算產生水位高度,藉此可以避免一判斷區塊受遮蔽物體阻擋時,對水位量測結果造成嚴重影響,具有提升方法可靠度之功效。 A further object of the present invention is to provide a multi-block water level measurement method, wherein the multi-block water level measurement method selects a plurality of the determination blocks in the image, and generates a plurality of water surfaces according to the plurality of determination block operations. The position, together with the plurality of water surface positions to calculate the water level height, can avoid the effect that the water level measurement result is seriously affected when the judgment block is blocked by the shielding object, and the reliability of the method is improved.

為達到前述目的,本發明所運用之技術內容包含有:一種多區塊水位量測方法,藉由一監控鏡頭拍攝一原始影像,交由一電腦系統量測該原始影像之水位高度,係包含以下步驟:一影像讀取步驟,藉由該電腦系統讀入該原始影像,依據該原始影像之大小計算出一像素所代表之實際尺寸;一影像校正步驟,若該監控鏡頭之視角與地平線之夾角不等於零,則依據該夾角對該原始影像進行水平旋轉校正;並且自該原始影像中圈選複數個判斷區塊;及一水位估算步驟,係針對該判斷區塊套用一梯度運算子邊緣搜尋法,計算該後製影像各像素之影像梯度值及影像邊界值;且依據該影像邊界值推算一邊界投影值,以估算至少一邊界位置;再依據該邊界位置判定一水面位置,且根據由該複數個判斷區塊所產生之複數個水面位置推算一水位判定結果;最後,由該原始影像之像素所代表之實際尺寸計算出該水位判定結果所代表之水位高度。 In order to achieve the foregoing objectives, the technical content of the present invention includes: a multi-block water level measurement method, wherein a raw image is captured by a monitoring lens, and a computer system measures the water level of the original image, including The following steps: an image reading step, wherein the original image is read by the computer system, and the actual size represented by a pixel is calculated according to the size of the original image; an image correction step, if the angle of view of the monitoring lens and the horizon If the angle is not equal to zero, the original image is horizontally corrected according to the angle; and a plurality of determining blocks are circled from the original image; and a water level estimating step is to apply a gradient operator edge search for the determining block a method for calculating image gradient values and image boundary values of each pixel of the post-image; and estimating a boundary projection value according to the image boundary value to estimate at least one boundary position; and determining a water surface position according to the boundary position, and determining The plurality of water surface positions generated by the plurality of determining blocks are used to calculate a water level determination result; finally, the original The actual size of the image represented by the pixel is determined to calculate the water level of the water represented by the result.

本發明之多區塊水位量測方法,其中,另包含一灰階處理步驟,於該影像讀取步驟完成後執行,係對該原始影像進行灰階運算,該原始影像經灰階運算後之亮度屬於一灰階色階範圍。 The multi-block water level measurement method of the present invention further includes a gray scale processing step, which is performed after the image reading step is completed, and performs gray scale operation on the original image, and the original image is subjected to gray scale operation. The brightness belongs to a gray scale range.

本發明之多區塊水位量測方法,其中,另包含一影像強化步驟,於該灰階處理步驟完成後執行,係調整經灰階運算之該原始影像,使其亮度平均分布於該灰階色階範圍之最大值與最小值之間。 The multi-block water level measurement method of the present invention further includes an image enhancement step, which is performed after the gray scale processing step is completed, and adjusts the original image by gray scale operation to uniformly distribute the brightness on the gray scale Between the maximum and minimum values of the gradation range.

本發明之多區塊水位量測方法,其中,該梯度運算子邊緣搜尋法計算該後製影像各像素之影像梯度及影像邊界值的方法如下式所示: 其中,G代表影像梯度,E代表影像邊界值,f(x,y)係為該判斷區塊之像素座標值為(x,y)時之灰階值,Gx代表該判斷區塊水平方向之梯度值,Gy代表該判斷區塊垂直方向之梯度值,ω為一閾值。 The multi-block water level measurement method of the present invention, wherein the gradient operator sub-edge search method calculates the image gradient and the image boundary value of each pixel of the post-image as follows: Where G represents the image gradient, E represents the image boundary value, f(x, y) is the grayscale value of the pixel coordinate value of the judgment block (x, y), and Gx represents the horizontal direction of the judgment block. The gradient value, Gy represents the gradient value of the vertical direction of the judgment block, and ω is a threshold value.

本發明之多區塊水位量測方法,其中,該閾值使用Canny邊緣檢測算子求得。 The multi-block water level measurement method of the present invention, wherein the threshold value is obtained using a Canny edge detection operator.

本發明之多區塊水位量測方法,其中,若該影像校正步驟共選取L個判斷區塊,且該判斷區塊之大小為M×N像素,則推算該邊界投影值及估算該邊界位置的方法如下式所示: 其中,(x,y)代表上述判斷區塊之像素座標值,I(y)代表上述判斷區塊中一水平高度之邊界投影值,μ為一標準值。當上述邊界投影值超過該標準值時,該水平高度座標即被設定為一邊界位置。 In the multi-block water level measurement method of the present invention, if the image correction step selects a total of L determination blocks, and the size of the determination block is M×N pixels, the boundary projection value is estimated and the boundary position is estimated. The method is as follows: Where (x, y) represents the pixel coordinate value of the above-mentioned judging block, and I(y) represents a boundary projection value of a horizontal height in the above-mentioned judging block, and μ is a standard value. When the boundary projection value exceeds the standard value, the horizontal height coordinate is set to a boundary position.

本發明之多區塊水位量測方法,其中,該判斷區塊之水平方向寬度共有M個像素,垂直方向長度共有N個像素,該標準值為M/2個像素。 In the multi-block water level measurement method of the present invention, the judgment block has a total of M pixels in the horizontal direction width and a total of N pixels in the vertical direction, and the standard value is M/2 pixels.

本發明之多區塊水位量測方法,其中,,判定該水面位置之方法係為將該邊界位置視為該水面位置。 In the multi-block water level measuring method of the present invention, the method of determining the position of the water surface is to regard the boundary position as the water surface position.

本發明之多區塊水位量測方法,其中,判定該水面位置之方法係取該至少一邊界位置中,隨時間變動之邊界位置,作為該水面位置。 In the multi-block water level measuring method of the present invention, the method for determining the position of the water surface is the boundary position of the at least one boundary position that changes with time as the water surface position.

本發明之多區塊水位量測方法,其中,推算該水位判定結果之方法係求取該複數個水面位置之平均數,作為該水位判定結果。 In the multi-block water level measurement method of the present invention, the method for estimating the water level determination result is to obtain an average of the plurality of water surface positions as the water level determination result.

本發明之多區塊水位量測方法,其中,推算該水位判定結果之方法係設定一容許範圍,求取該複數個水面位置中落在該容許範圍內之水面位置之平均數,以作為該水位判定結果。 The multi-block water level measuring method of the present invention, wherein the method for calculating the water level determining result sets an allowable range, and obtains an average of the water surface positions falling within the allowable range among the plurality of water surface positions as the Water level judgment result.

本發明之多區塊水位量測方法,其中,依據該多區塊水位量測方法先前量測之水位判定結果以設定該容許範圍。 In the multi-block water level measurement method of the present invention, the water level determination result previously measured according to the multi-block water level measurement method is used to set the allowable range.

本發明之多區塊水位量測方法,其中,係將該多區塊水位量測方法先前量測之一水位判定結果加上一誤差值,以作為該容許範圍。 The multi-block water level measuring method of the present invention, wherein the multi-block water level measuring method previously measures one water level determination result plus an error value as the allowable range.

本發明之多區塊水位量測方法,其中,係將該多區塊水位量測方法先前量測之複數個水位判定結果之平均值加上其標準差與一容許倍率之乘積,以作為該容許範圍。 The multi-block water level measurement method of the present invention, wherein the average value of the plurality of water level determination results previously measured by the multi-block water level measurement method is added by the product of the standard deviation and an allowable ratio as the product Allowable range.

本發明之多區塊水位量測方法,其中,該多區塊水位量測方法另包含一濾波處理步驟,係在該影像校正步驟選出複數個判斷區塊後,對各該判斷區塊進行濾波處理以消除雜訊。 The multi-block water level measuring method of the present invention, wherein the multi-block water level measuring method further comprises a filtering processing step, after selecting a plurality of determining blocks in the image correcting step, filtering each of the determining blocks Process to eliminate noise.

本發明之多區塊水位量測方法,其中,該濾波處理步驟所使用之濾波處理方法為中間值濾波。 The multi-block water level measuring method of the present invention, wherein the filtering processing method used in the filtering processing step is intermediate value filtering.

1‧‧‧監控鏡頭 1‧‧‧Monitor lens

2‧‧‧電腦系統 2‧‧‧ computer system

3‧‧‧影像伺服器 3‧‧‧Image Server

S1‧‧‧影像讀取步驟 S1‧‧‧Image reading step

S2‧‧‧灰階處理步驟 S2‧‧‧ Grayscale processing steps

S3‧‧‧影像強化步驟 S3‧‧‧ Image Enhancement Steps

S4‧‧‧影像校正步驟 S4‧‧‧Image correction procedure

S41‧‧‧水平校正子步驟 S41‧‧‧Level Correction Substep

S42‧‧‧判斷區塊圈選子步驟 S42‧‧‧Judgement block circle selection substep

S5‧‧‧濾波處理步驟 S5‧‧‧Filter processing steps

S6‧‧‧水位估算步驟 S6‧‧‧ water level estimation steps

S61‧‧‧邊界估算子步驟 S61‧‧‧Boundary estimation substep

S62‧‧‧邊界投影子步驟 S62‧‧‧Boundary projection substep

S63‧‧‧水位判定子步驟 S63‧‧‧ Water level determination sub-step

S64‧‧‧結果計算子步驟 S64‧‧‧Result calculation substeps

A‧‧‧原始影像 A‧‧‧ original image

B‧‧‧資料點 B‧‧‧Information points

△H‧‧‧影像比例尺 △H‧‧‧image scale

θ‧‧‧水平校正角度 θ ‧‧‧ horizontal correction angle

V‧‧‧視角 V‧‧‧ perspective

G‧‧‧水平線 G‧‧‧ horizontal line

R‧‧‧判斷區塊 R‧‧‧Judgement block

B‧‧‧後製影像 B‧‧‧post image

H0‧‧‧水平線之水平高度座標值 H 0 ‧‧‧ horizontal line coordinate value

Ht‧‧‧水平線代表之實際高度 The actual height of the H t ‧‧‧ horizontal line

G‧‧‧影像梯度值 G‧‧‧ image gradient values

E‧‧‧影像邊界值 E‧‧‧ image boundary value

I‧‧‧邊界投影值 I‧‧‧ boundary projection value

H‧‧‧邊界位置 H‧‧‧Boundary position

W‧‧‧水面位置 W‧‧‧ water surface location

WC‧‧‧水位判定結果 W C ‧‧‧ water level determination result

第1圖:本發明多區塊水位量測方法較佳實施例之系統架構圖 Figure 1 is a system architecture diagram of a preferred embodiment of the multi-block water level measurement method of the present invention

第2圖:本發明多區塊水位量測方法較佳實施例之運作流程圖 Figure 2: Operation flow chart of a preferred embodiment of the multi-block water level measurement method of the present invention

第3圖:本發明多區塊水位量測方法較佳實施例之影像校正步驟之內部流程圖 Figure 3: Internal flow chart of the image correction step of the preferred embodiment of the multi-block water level measurement method of the present invention

第4圖:本發明多區塊水位量測方法較佳實施例之監控鏡頭示意圖 4 is a schematic diagram of a monitoring lens of a preferred embodiment of the multi-block water level measuring method of the present invention

第5圖:本發明多區塊水位量測方法較佳實施例之水位估算步驟之內部流程圖 Figure 5: Internal flow chart of the water level estimation step of the preferred embodiment of the multi-block water level measurement method of the present invention

為讓本發明之上述及其他目的、特徵及優點能更明顯易懂,下文特舉本發明之較佳實施例,並配合所附圖式,作詳細說明如下:本發明全文所述之「像素」(pixels),係指一影像(image)組成的最小單位,用以表示該影像之解析度(resolution),例如:若該影像之解析度為1024×768,則代表該影像共有(1024×768=786432)個像素,係本發明所屬技術領域中具有通常知識者可以理解。 The above and other objects, features and advantages of the present invention will become more <RTIgt; (pixels) is the smallest unit of an image used to represent the resolution of the image. For example, if the resolution of the image is 1024×768, it means that the image is common (1024× 768 = 786432) pixels are understood by those of ordinary skill in the art to which the present invention pertains.

本發明全文所述之「色階」(color level),係指該像素所顯現顏色分量或亮度的濃淡程度,例如:彩色(color)影像之紅色(R)、綠色(G)、藍色(B)分量的色階範圍(range)各為0~255;或者,灰階(gray-level)影像之亮度(luminance)的色階範圍可為0~255,係本發明所屬技術領域中具有通常知識者可以理解。 The "color level" as used throughout the present invention refers to the degree of shading of the color component or brightness exhibited by the pixel, for example, the red (R), green (G), and blue (color) images. B) The range of the color gradation of the component is 0 to 255; alternatively, the gradation range of the luminance of the gray-level image may range from 0 to 255, which is generally in the technical field to which the present invention pertains. Knowledge people can understand.

本發明全文所述之「機率分布」(probability distribution),係指一影像中所有像素之色階範圍機率分布,亦即該影像各像素所屬色階之分布情形,例如:一灰階影像之亮度範圍為0~255(即256個色階),則其機率分布包含以下資訊:色階為0之像素數目、色階為1之像素數目、色階為2之像素數目……以及色階為255之像素數目,係本發明所屬技術領域中具有通常知識者可以理解。 The "probability distribution" as used throughout the present invention refers to the probability distribution of the gradation range of all pixels in an image, that is, the distribution of the gradation of each pixel of the image, for example, the brightness of a grayscale image. The range is 0~255 (that is, 256 levels), and the probability distribution includes the following information: the number of pixels with gradation of 0, the number of pixels with gradation of 1, the number of pixels with gradation of 2, and the gradation The number of pixels of 255 is understood by those of ordinary skill in the art to which the present invention pertains.

請參閱第1圖所示,係本發明多區塊水位量測方法較佳實施例之系統架構圖。其中,藉由至少一監控鏡頭1(例如:習知監視攝影機、網路攝影機或夜間紅外線攝影機等)連接一電腦系統2(例如習知電腦主機、檔案伺服器或雲端伺服器等)作為執行架構,該至少一監控鏡頭1係可拍攝取得一原始影像A(original image),例如:單一(single)或連續(continued)影像等,該原始影像A可為彩色或灰階影像,該原始影像A包含數個像素,各像素具有一色階,該色階可表示的數值範圍為該影像的色階範圍。該電腦系統2係耦接該至少一監控鏡頭1,以接收該原始影像A,並據以執行本發明多區塊水位量測方法較佳實施例所揭示的運作流程,用來量測該至少一監控鏡頭1所處地區之積淹水水位高度。在此實施例中,該原始影像A係以單一彩色影像作為實施態樣進行後續說明,惟不以此為限,依此類推,可應用於黑白或連續影像之水位量測,其係本發明所屬技術領域中具有通常知識者可以理解,在此容不贅述。 Please refer to FIG. 1 , which is a system architecture diagram of a preferred embodiment of the multi-block water level measurement method of the present invention. Wherein, a computer system 2 (for example, a conventional computer host, a file server, or a cloud server) is connected as an execution architecture by at least one monitoring lens 1 (for example, a conventional surveillance camera, a network camera, or a nighttime infrared camera). The at least one monitoring lens 1 can capture an original image A, such as a single or continuous image, and the original image A can be a color or grayscale image. The original image A There are several pixels, each pixel has a color gradation, and the range of values that can be represented by the color gradation is the gradation range of the image. The computer system 2 is coupled to the at least one monitoring lens 1 to receive the original image A, and according to the operation flow disclosed in the preferred embodiment of the multi-block water level measuring method of the present invention, is used to measure the at least The height of the flooded water level in the area where the lens 1 is located. In this embodiment, the original image A is described with a single color image as an implementation aspect, but not limited thereto, and the like, and can be applied to water level measurement of black and white or continuous images, which is the present invention. Those skilled in the art can understand that it is not described here.

此外,該至少一監控鏡頭1與該電腦系統2之間較佳串聯連接一影像伺服器3,供接收彙整該至少一監控鏡頭1所拍攝之原始影像A,並據以進行時間取樣處理或影像壓縮處理,再將處理過後之原始影像A轉傳至該電腦系統2。藉此,可避免當該至少一監控鏡頭1之數量過多、所拍攝原始影像A畫質過於精細、或者該原始影像A為長度過長之連續影像時,所形成之影像檔案大小太大,造成該電腦系統2不堪負荷。 In addition, an image server 3 is preferably connected in series between the at least one monitoring lens 1 and the computer system 2 for receiving and collecting the original image A captured by the at least one monitoring lens 1 and performing time sampling processing or imaging. The compressed image is processed, and the processed original image A is transferred to the computer system 2. Therefore, when the number of the at least one monitoring lens 1 is too large, the original image A of the captured image is too fine, or the original image A is a continuous image having a long length, the image file size formed is too large, thereby avoiding The computer system 2 is unbearable.

請參閱第2圖所示,係本發明多區塊水位量測方法較佳實施例之運作流程圖。其中,該多區塊水位量測方法包含一影像讀取步驟S1、一灰階處理步驟S2、一影像強化步驟S3、一影像校正步驟S4、一濾波處理步驟S5以及一水位估算步驟S6,分別敘述如後。 Please refer to FIG. 2, which is a flow chart of the operation of the preferred embodiment of the multi-block water level measurement method of the present invention. The multi-block water level measurement method includes an image reading step S1, a grayscale processing step S2, an image enhancement step S3, an image correction step S4, a filtering processing step S5, and a water level estimation step S6, respectively The narrative is as follows.

該影像讀取步驟S1首先係藉由該電腦系統2讀入一原始影像A,在本實施例當中該原始影像A為一RGB影像,且該原始影像A之 色階範圍為0~255,惟本發明不以此為限。該原始影像A由一監控鏡頭1所攝錄,而該監控鏡頭1設置於一固定位置運作,因此該電腦系統2中可預先設定該原始影像A所代表之實際尺寸。該影像讀取步驟S1接著依據該原始影像A之像素大小與其所代表之實際尺寸計算出一影像比例尺△H,可供換算任意像素值所代表之實際尺寸。舉例而言,假設一監控鏡頭1所拍攝之原始影像A包含一司令台,已知該司令台實際高度為500公分,若該電腦系統2讀入該原始影像A且測量出該司令台之高度為100像素,則可推算出一個像素代表5公分,該影像比例尺△H即為5(cm/pixel)。當該影像讀取步驟S1完成後,開始進行該灰階處理步驟S2。 The image reading step S1 first reads an original image A by the computer system 2. In the embodiment, the original image A is an RGB image, and the original image A is The color scale ranges from 0 to 255, but the invention is not limited thereto. The original image A is recorded by a monitoring lens 1 and the monitoring lens 1 is disposed at a fixed position. Therefore, the actual size represented by the original image A can be preset in the computer system 2. The image reading step S1 then calculates an image scale ΔH according to the pixel size of the original image A and the actual size represented by the original image A, which can be used to convert the actual size represented by the arbitrary pixel value. For example, suppose that the original image A taken by a surveillance lens 1 includes a commander station, and the actual height of the commander is known to be 500 cm. If the computer system 2 reads the original image A and measures the height of the commander. For 100 pixels, it can be inferred that one pixel represents 5 cm, and the image scale ΔH is 5 (cm/pixel). When the image reading step S1 is completed, the grayscale processing step S2 is started.

該灰階處理步驟S2,係對該原始影像A進行灰階處理,主要原理乃依據該原始影像A各像素之紅色、綠色、藍色分量的色階,將該原始影像A之色調平均轉換到色階範圍為0~255之灰階影像之亮度,該色調轉換方式較佳如下式(1)所示:f(x,y)=0.299×R(x,y)+0.587×G(x,y)+0.114×B(x,y) (1)其中(x,y)為像素座標值,f(x,y)為灰階影像之亮度,R(x,y)、G(x,y)、B(x,y)代表紅、綠、藍三種色域之色階。該原始影像A經過轉換過後形成一灰階影像,色彩單一較容易處理。 The gray scale processing step S2 is to perform gray scale processing on the original image A. The main principle is to convert the tone of the original image A to the average according to the color gradation of the red, green and blue components of each pixel of the original image A. The color scale ranges from 0 to 255, and the tone conversion mode is preferably as shown in the following formula (1): f(x, y) = 0.299 × R (x, y) + 0.587 × G (x, y)+0.114×B(x,y) (1) where (x,y) is the pixel coordinate value, f(x,y) is the brightness of the grayscale image, R(x,y), G(x,y ), B(x, y) represents the gradation of the three gamuts of red, green, and blue. The original image A is converted to form a grayscale image, and the color is relatively easy to process.

該影像強化步驟S3係對該灰階影像進行影像強化處理,得到一強化影像,主要原理是將該灰階影像之亮度的色階範圍機率分布,平均轉換至0~255,藉以強化該灰階影像之對比值。舉例來說,若一灰階影像之機率分布區域位於25~100之間,係屬於畫面偏暗之情形,經由該影像強化步驟S3可將其機率分布區域調整為0~255,以利後續步驟對其細節進行判讀。由於該監控鏡頭1所拍攝之原始影像A的畫面品質十分容易受到天候、時間等因素的影響,導致影像模糊、生成雜訊、整體色調過亮或過暗等情形,因此經由該影像強化步驟S3進行影像強化處理後,較能精確觀 察觀察細部變化。 The image enhancement step S3 performs image enhancement processing on the grayscale image to obtain a enhanced image. The main principle is that the probability distribution of the grayscale range of the grayscale image is averaged to 0~255, thereby strengthening the grayscale. The contrast value of the image. For example, if the probability distribution area of a grayscale image is between 25 and 100, which is a case where the screen is dark, the probability distribution area can be adjusted to 0 to 255 through the image enhancement step S3, so as to facilitate subsequent steps. Interpret the details. Since the picture quality of the original image A captured by the monitoring lens 1 is very susceptible to weather, time, and the like, resulting in blurring of the image, generation of noise, excessive color tone or excessive darkness, the image enhancement step S3 is performed. After image enhancement, it is more accurate Observe the changes in detail.

惟,該灰階處理步驟S2及該影像強化步驟S3係可以選擇性執行。換言之,若該原始影像A本身即為一灰階影像,即可省略該灰階處理步驟S2;同理,若該灰階影像之亮度已平均分布於其灰階色階範圍之最大值與最小值之間,則可以省略該影像強化步驟S3。據此,該灰階處理步驟S2及該影像強化步驟S3並非必要步驟,係本發明所屬技術領域技術人員可以輕易思及。 However, the grayscale processing step S2 and the image enhancement step S3 are selectively executable. In other words, if the original image A itself is a gray scale image, the gray scale processing step S2 can be omitted; similarly, if the brightness of the gray scale image is evenly distributed in the grayscale scale range, the maximum value and the minimum value are Between the values, the image enhancement step S3 can be omitted. Accordingly, the grayscale processing step S2 and the image enhancement step S3 are not essential steps, and can be easily considered by those skilled in the art to which the present invention pertains.

請一併參閱第3圖所示,係本發明多區塊水位量測方法較佳實施例之影像校正步驟S4之內部流程圖,該影像校正步驟S4之包含一水平校正子步驟S41及一判斷區塊圈選子步驟S42。該水平校正子步驟S41係對該強化影像進行水平校正,以得到一水平影像,由於該至少一監控鏡頭1的視角通常不是水平直視著待偵測物,故需要校正待偵測物成水平,以方便偵測淹水深度。 As shown in FIG. 3, it is an internal flowchart of the image correction step S4 of the preferred embodiment of the multi-block water level measurement method of the present invention. The image correction step S4 includes a horizontal correction sub-step S41 and a determination. The block circle is selected in step S42. The horizontal correction sub-step S41 is to perform horizontal correction on the enhanced image to obtain a horizontal image. Since the angle of view of the at least one monitoring lens 1 is not directly horizontally looking at the object to be detected, it is necessary to correct the level of the object to be detected. To facilitate the detection of flooding depth.

更詳言之,請另參照參照第4圖所示,該至少一監控鏡頭1通常設置於一固定位置運作,因此該電腦系統2中針對任一監控鏡頭1皆已預設一水平校正角度θ,該水平校正角度θ係為該監控鏡頭1之視角V與一水平線G之夾角,利用該水平校正角度θ可分別對來自每一監控鏡頭1之影像進行水平校正,該水平校正方式如下式(2)所示:x'=xcos(θ)+ysin(θ) y'=-xsin(θ)+ycos(θ) (2)其中(x,y)為該強化影像之像素座標值,(x’,y’)為該水平影像之像素座標值。該水平校正子步驟S41係可選擇性執行,例如當一監控鏡頭1水平直視待偵測物時,其強化影像即為一水平影像,該電腦系統2中係預設該水平校正角度θ等於零,即省略該水平校正子步驟S41。 More specifically, please refer to FIG. 4 again, the at least one monitoring lens 1 is usually disposed at a fixed position, so that the computer system 2 has preset a horizontal correction angle θ for any of the monitoring lenses 1 The horizontal correction angle θ is an angle between the viewing angle V of the monitoring lens 1 and a horizontal line G. The horizontal correction angle θ can be used to horizontally correct the image from each of the monitoring lenses 1, and the horizontal correction mode is as follows ( 2): x' = x cos( θ ) + y sin( θ ) y' =- x sin( θ )+ y cos( θ ) (2) where (x, y) is the pixel coordinate of the enhanced image The value, (x', y') is the pixel coordinate value of the horizontal image. The horizontal correction sub-step S41 is selectively executable. For example, when a monitoring lens 1 is directly viewed from the object to be detected, the enhanced image is a horizontal image. The computer system 2 presets the horizontal correction angle θ to be equal to zero. That is, the horizontal correction sub-step S41 is omitted.

該判斷區塊圈選子步驟S42係自該水平影像當中選取複數個判斷區塊R,該複數個判斷區塊R分別分布於該水平影像中,且各該判 斷區塊R彼此之間較佳不相互重疊。其中,該判斷區塊R之大小為M×N像素,亦即該判斷區塊R之水平方向寬度共有M個像素,垂直方向長度共有N個像素,且該判斷區塊R之大小以佔該原始影像A之百分之五以上為較佳。此外,該判斷區塊影像R中包含一水平線G,該水平線G所處之實際高度為Ht(cm),而該水平線G之水平高度座標值為H0,亦即該水平線G位於該判斷區塊R中垂直位置之第H0像素,且0≦H0<N。 The determining block circle sub-step S42 selects a plurality of determining blocks R from the horizontal image, and the plurality of determining blocks R are respectively distributed in the horizontal image, and each of the determining blocks R is better between each other. Do not overlap each other. The size of the determining block R is M×N pixels, that is, the horizontal width of the determining block R has a total of M pixels, and the vertical direction has a total of N pixels, and the size of the determining block R is occupied. More than five percent of the original image A is preferred. In addition, the determination block image R includes a horizontal line G, the actual height of the horizontal line G is H t (cm), and the horizontal height coordinate value of the horizontal line G is H 0 , that is, the horizontal line G is located in the judgment. The H 0 pixel of the vertical position in the block R, and 0 ≦ H 0 <N.

該濾波處理步驟S5,係針對該判斷區塊R進行濾波處理,主要原理是利用一遮罩對該判斷區塊R進行偵測比對,該遮罩為一習知中位數濾波器(median filter)遮罩,且該遮罩大小較佳為1×(M/2),M/2即為該判斷區塊R之寬度的一半,該判斷區塊R之像素會被該遮罩內的中間值所取代。藉此,可降低該判斷區塊R之雜訊,且由於水位通常僅水平上升或下降運動,因此該濾波處理過程不會濾掉水位資訊成分,經由該濾波處理之判斷區塊R能夠更有效率地估計水位高度。然而,該濾波處理步驟S5亦可以使用平均值濾波、高斯值濾波或拉普拉斯值濾波等其它習知濾波處理方法,本發明不以此為限。 The filtering processing step S5 performs filtering processing on the determining block R. The main principle is to perform a detection comparison on the determining block R by using a mask, which is a conventional median filter (median) Filter), and the size of the mask is preferably 1×(M/2), and M/2 is half of the width of the determination block R, and the pixel of the determination block R is covered by the mask. The intermediate value is replaced. Thereby, the noise of the determination block R can be reduced, and since the water level usually only rises or falls horizontally, the filtering process does not filter out the water level information component, and the determination block R can be further provided through the filtering process. Evaluate the water level efficiently. However, the filtering process step S5 may also use other conventional filtering processing methods such as average value filtering, Gaussian value filtering or Laplacian value filtering, and the invention is not limited thereto.

藉由上述步驟,可對該原始影像A進行連續影像處理過程,該濾波處理步驟S5最終產生複數個後製影像B,該後製影像B為一大小為M×N像素且色階範圍為0~255之灰階影像,供後續步驟進行水位估算。該濾波處理步驟S5係可選擇性執行,例如當一原始影像A足夠清晰,並未包含可能影響後續步驟運算結果之雜訊時,無須針對該原始影像A中所選出之判斷區塊R進行濾波處理,因此可省略本步驟,該判斷區塊R即為一後製影像B。 Through the above steps, the original image A can be subjected to a continuous image processing process. The filtering process S5 finally generates a plurality of post-images B, which are of a size of M×N pixels and a color scale range of 0. A grayscale image of ~255 for subsequent water level estimation. The filtering processing step S5 is selectively executable. For example, when an original image A is sufficiently clear and does not contain noise that may affect the operation result of the subsequent step, it is not necessary to filter the determination block R selected in the original image A. Processing, so this step can be omitted, and the determination block R is a post-production image B.

請參閱第2及5圖所示,第5圖係為本發明多區塊水位量測方法較佳實施例之水位估算步驟S6之內部流程圖,該水位估算步驟S6包含一邊界估算子步驟S61、一邊界投影子步驟S62、一水位判定子步驟S63 與一結果計算子步驟S64,該邊界估算子步驟S61係為一種梯度運算子邊緣搜尋法,主要原理係計算該後製影像B中各像素之影像梯度(gradient)值G,並依據該影像梯度值G計算各該像素之影像邊界值E。該影像邊界值E為1或0,分別代表一像素為一邊界或並非一邊界。該影像梯度值G與影像邊界值E之計算方法如下式(3)、(4)與(5)所示: Please refer to FIG. 2 and FIG. 5, which are internal flowcharts of the water level estimating step S6 of the preferred embodiment of the multi-block water level measuring method of the present invention. The water level estimating step S6 includes a boundary estimating sub-step S61. a boundary projection sub-step S62, a water level determination sub-step S63 and a result calculation sub-step S64, the boundary estimation sub-step S61 is a gradient operation sub-edge search method, the main principle is to calculate each pixel in the post-production image B The image gradient value G, and the image boundary value E of each pixel is calculated according to the image gradient value G. The image boundary value E is 1 or 0, which represents that a pixel is a boundary or not a boundary. The calculation method of the image gradient value G and the image boundary value E is as shown in the following equations (3), (4) and (5):

其中,f(x,y)如上述公式(1)所示,係為該後製影像B之像素座標值為(x,y)時之灰階值,且0≦x<M且0≦y<N;Gx代表該後製影像B之水平方向之梯度值,Gy代表該後製影像B之垂直方向之梯度值,ω為一閾值。當一像素(x,y)之影像梯度值G超過該閾值ω時,則設定該像素(x,y)之影像邊界值E(x,y)為1;反之則設定該像素(x,y)之影像邊界值E(x,y)為0。該閾值ω較佳使用Canny邊緣檢測算子(Canny edge detector)運算產生。 Where f(x, y) is the gray scale value when the pixel coordinate value of the post-image B is (x, y), as shown in the above formula (1), and 0≦x<M and 0≦y <N; Gx represents the gradient value of the horizontal direction of the post-image B, Gy represents the gradient value of the vertical direction of the post-image B, and ω is a threshold. When the image gradient value G of one pixel (x, y) exceeds the threshold ω , the image boundary value E(x, y) of the pixel (x, y) is set to 1; otherwise, the pixel is set (x, y) The image boundary value E(x, y) is 0. The threshold ω is preferably generated using a Canny edge detector (Manny edge detector) operation.

值得注意的是,若該判斷區塊圈選子步驟S42共選取L個判斷區塊R,則前述步驟將產生L個後製影像B,因此該邊界估算子步驟S61必須重複L次,以分別計算產生各該後製影像B中各像素之影像邊界值E。 It should be noted that if the determining block circle sub-step S42 selects a total of L decision blocks R, the foregoing steps will generate L post-images B, so the boundary estimation sub-step S61 must be repeated L times to respectively The image boundary value E of each pixel in each of the post-images B is calculated.

該邊界投影子步驟S62係將各該後製影像B中每一水平高度之影像邊界值E投影累加,以產生一邊界投影值I,並依據該邊界投影值I判定該水平高度是否為一邊界位置。該投影累加方式以及邊界位置判定方法如下式(6)與(7)所示: The boundary projection sub-step S62 accumulates the image boundary value E of each level in each of the post-images B to generate a boundary projection value I, and determines whether the level is a boundary according to the boundary projection value I. position. The projection accumulation method and the boundary position determination method are as shown in the following equations (6) and (7):

其中,由於(x,y)為該後製影像B之像素座標值,因此y為該後製影像B之一水平高度座標,為該水平高度座標y之所有影像邊界值E的和,即為該後製影像B於該水平高度座標y之邊界投影值I(y)。當該邊界投影值I(y)超過一標準值μ時,該水平高度座標y即被設定為一邊界位置H,在本實施例當中,該標準值較佳為該後製影像B之寬度的二分之一(M/2)。 Wherein, since (x, y) is the pixel coordinate value of the post-production image B, y is a horizontal height coordinate of the post-production image B, The sum of all image boundary values E of the horizontal height coordinate y is the boundary projection value I(y) of the post-image B at the horizontal coordinate y. When the boundary projection value I(y) exceeds a standard value μ , the horizontal height coordinate y is set to a boundary position H. In the embodiment, the standard value is preferably the width of the post-image B. One-half (M/2).

若該後製影像B於該邊界投影子步驟S62僅產生一邊界位置H,則該水位判定子步驟S63直接設定該邊界位置H為一水面位置W。然而,一後製影像B中除了水面外,尚可能有其它標的物被判定為邊界位置H,例如經過之路人、車輛或其它遮蔽物體等,導致該邊界投影子步驟S62所產生之邊界位置H的數量超過一個。因此為求更精準地估算水位,該水位判定子步驟S63可針對複數個邊界位置H進行分析比較,主要原理係比較該電腦系統2於不同時間所接收之原始影像A,該不同時間所接收之原始影像A所產生之後製影像B經由該邊界投影子步驟S62,係分別產生複數個邊界位置H,由於淹水時水位通常會隨時間上升或消退,因此水面在各該後製影像B中應屬一變動之邊界位置H,藉由比較該複數個邊界位置H,可排除維持於固定高度之邊界位置H,僅保存隨時間變動之邊界位置H,並設定為一水面位置W。 If the post-production image B generates only one boundary position H in the boundary projection sub-step S62, the water level determining sub-step S63 directly sets the boundary position H to a water surface position W. However, in the post-production image B, in addition to the water surface, other objects may be determined as the boundary position H, such as passing by a passerby, a vehicle or other obscuring object, etc., resulting in the boundary position H generated by the boundary projection sub-step S62. The number is more than one. Therefore, in order to estimate the water level more accurately, the water level determining sub-step S63 can analyze and compare the plurality of boundary positions H. The main principle is to compare the original image A received by the computer system 2 at different times, and the different time is received. After the original image A is generated, the image B is generated by the boundary projection sub-step S62, and a plurality of boundary positions H are respectively generated. Since the water level generally rises or falls with time during flooding, the water surface should be in each of the post-images B. By changing the boundary position H, by comparing the plurality of boundary positions H, the boundary position H maintained at the fixed height can be excluded, and only the boundary position H that changes with time is saved, and is set to a water surface position W.

惟,若一後製影像B嚴重遭受遮蔽物體阻擋,致使該後製影像B中根本無水體畫面時,將導致依據該後製影像B所運算產生之水面位置W並非實際淹水水面,會對本發明多區塊水位量測方法較佳實施例之水 位量測結果造成嚴重影響。為解決此問題,在本實施例當中,該判斷區塊圈選子步驟S42共選取L個判斷區塊R,因此該水位判定子步驟S63係依據L個後製影像B運算產生共L個水面位置W。 However, if a post-production image B is severely blocked by the obstructing object, causing the image of the water-free image in the post-production image B, the water surface position W calculated according to the post-production image B is not actually flooded, and Inventive multi-block water level measurement method The bit measurement results have a serious impact. In order to solve this problem, in the embodiment, the determining block circle selection sub-step S42 selects a total of L determination blocks R, so the water level determination sub-step S63 generates a total of L water surfaces according to the L post-production image B operations. Location W.

詳言之,該水位判定子步驟S63可以求取該L個水面位置W之平均數作為一水位判定結果WC,以抵銷少數誤判為淹水水面之水面位置W所造成之影響;或者,該水位判定子步驟S63可以設定一容許範圍,並將所有落在該容許範圍外之水面位置W剃除,再求取剩餘落在該容許範圍內之水面位置W之平均數,以作為該水位判定結果WCIn detail, the water level determining sub-step S63 can obtain the average of the L water surface positions W as a water level determination result W C to offset the influence of a few false positives on the water surface position W of the flooded water surface; or The water level determining sub-step S63 can set an allowable range, and shave all the water surface positions W that fall outside the allowable range, and then obtain the average of the remaining water surface positions W falling within the allowable range as the water level. The result of the determination is W C .

更詳言之,由於本發明多區塊水位量測方法較佳實施例係由該電腦系統2不斷接收一監控鏡頭1所拍攝之原始影像A,以持續量測更新該監控鏡頭1所處地區之積淹水水位高度,因此該水位判定子步驟S63可以依據前一次(或前數次)之量測結果以設定該容許範圍。舉例而言,透過預設一誤差值ε,即可以±ε作為該容許範圍,其中為前一次量測所得之水位判定結果WC。據此,該水位判定結果WC之判定方式可以劃分為以下三種情形: More specifically, the preferred embodiment of the multi-block water level measuring method of the present invention continuously receives the original image A captured by the monitoring lens 1 by the computer system 2, and continuously updates the area where the monitoring lens 1 is located. The accumulated water level is so high that the water level determining sub-step S63 can set the allowable range based on the previous (or previous) measurement results. For example, by presetting a value of error ε , ± ε as the allowable range, where The water level determination result W C obtained from the previous measurement. Accordingly, the determination method of the water level determination result W C can be divided into the following three cases:

(一)當該L個水面位置W均落在該容許範圍內時,該水位判定結果WC係為該L個水面位置W之平均數,如下式(8)所示: (1) When the L water surface positions W all fall within the allowable range, the water level determination result W C is an average of the L water surface positions W, as shown in the following formula (8):

(二)當其中一水面位置Wj在該容許範圍之外時,該水位判定結果WC如下式(9)所示: (2) When one of the water surface positions W j is outside the allowable range, the water level determination result W C is as shown in the following formula (9):

(三)當所有水面位置W均落在該容許範圍之外時,可以直接以為前一次量測所得之水位判定結果作為該水位判定結果WC,或者 以前數次之水位判定結果,......之平均數作為該水位判定結 果WC,本發明不以此為限。其中,Wi為該L個水面位置W中的第i個,而當該L個水面位置W中有複數個落在該在該容許範圍之外時,套用上式(9)數次即可算出該水位判定結果WC,係本發明所屬技術領域中具有通常知識者可以輕易理解實施。 (3) When all the water surface positions W fall outside the allowable range, the water level judgment result obtained by the previous measurement can be directly considered. As the water level determination result W C , or the water level determination result of the previous several times The average of ... is taken as the water level determination result W C , and the present invention is not limited thereto. Wherein, W i is the i-th of the L water surface positions W, and when a plurality of the L water surface positions W fall outside the allowable range, the above formula (9) can be applied several times. The calculation of the water level determination result W C can be easily understood by those having ordinary knowledge in the technical field to which the present invention pertains.

值得注意的是,該誤差值ε除了可以由使用者預設外,亦可以利用統計學原理運算產生。舉例來說,該電腦系統2可以依據前數次之水位判定結果,......計算一標準差,並且將該標準差乘上一容許倍率作為該誤差值ε。其中,該容許倍率常見為2倍、1倍或1.5倍等等。 It should be noted that the error value ε can be generated by a statistical principle operation, in addition to being preset by the user. For example, the computer system 2 can determine the result based on the previous water level. , ... calculates a standard deviation, and multiplies the standard deviation by an allowable magnification as the error value ε . Among them, the allowable magnification is usually 2 times, 1 time or 1.5 times, and the like.

該結果計算子步驟S64係將該水位判定結果WC與該水平線G之水平高度座標值H0進行比較運算,並依據該水平線G所處之實際高度Ht(cm)與該影像比例尺△H(cm/pixel),計算出該水面位置所代表之實際高度。例如,當前述步驟判定出一水位判定結果WC時,該水位判定結果WC所代表之實際高度即為Ht+(WC-H0)×△H(cm),係為該監控鏡頭1所所拍攝地區之積淹水水位高度。 The result calculation sub-step S64 compares the water level determination result W C with the horizontal height coordinate value H 0 of the horizontal line G, and according to the actual height H t (cm) of the horizontal line G and the image scale ΔH (cm/pixel), calculate the actual height represented by the water surface position. For example, when the foregoing step determines a water level determination result W C , the actual height represented by the water level determination result W C is H t +(W C −H 0 )×ΔH(cm), which is the monitoring lens. The height of the flooded water level in a photographed area.

綜上所述,本發明之多區塊水位量測方法始於該影像讀取步驟S1,係由該電腦系統2讀入一原始影像A,經由該灰階處理步驟S2、影像強化步驟S3、影像校正步驟S4與濾波處理S5等後續步驟,對該原始影像A進行影像分析處理以產生一後製影像B,再交由該水位估算步驟S6運算得到一水位高度,係為該原始影像A中的淹水高度。據此,發明之多區塊水位量測方法可達成透過影像分析處理技術計算水位高度之目的。 In summary, the multi-block water level measurement method of the present invention starts from the image reading step S1, in which the computer system 2 reads an original image A, through the gray-scale processing step S2, the image enhancement step S3, In the subsequent steps of the image correcting step S4 and the filtering process S5, the image analysis processing is performed on the original image A to generate a post-image B, and then the water level estimating step S6 is performed to obtain a water level height, which is the original image A. The height of the flood. Accordingly, the invented multi-block water level measurement method can achieve the purpose of calculating the water level height through image analysis processing technology.

藉此,本發明多區塊水位量測方法較佳實施例僅需藉由該監控鏡頭1所提供之原始影像A配合一電腦系統2即可量測出水位高度,成本無論相較於設置習知接觸式或非接觸式水位量測裝置都大幅減低,且該監控鏡頭1係為習知監視攝影機或網路攝影機,因此能夠大量設置以進行 大範圍監控。 Therefore, the preferred embodiment of the multi-block water level measurement method of the present invention only needs to measure the water level height by using the original image A provided by the monitoring lens 1 in conjunction with a computer system 2, regardless of the cost. The contact type or non-contact water level measuring device is greatly reduced, and the monitoring lens 1 is a conventional monitoring camera or a network camera, so that it can be set in a large amount to perform Large-scale monitoring.

另,本發明多區塊水位量測方法較佳實施例使用影像辨識方式,辨識一影像中水位與四周景物的相對關係,即可找出水面位置並據以計算水位高度,因此可準確量測淹水時的水位,不受水體顏色與水中漂流物影響。 In addition, the preferred embodiment of the multi-block water level measurement method of the present invention uses an image recognition method to identify the relative relationship between the water level and the surrounding scenery in an image, thereby finding the water surface position and calculating the water level height, thereby accurately measuring The water level during flooding is not affected by the color of the water and drifting water.

再者,本發明多區塊水位量測方法較佳實施例已於該原始影像A中取出一判斷區塊R,依據該判斷區塊R產生一後製影像B,再針對該後製影像使用一梯度運算子邊緣搜尋法,以進行邊界偵測估算,相較未選取判斷區塊R直接套用該梯度運算子邊緣搜尋法的情形,節省大量運算過程,是故,運算速度可大幅提升。 Furthermore, in the preferred embodiment of the multi-block water level measurement method of the present invention, a determination block R is taken out from the original image A, and a post-production image B is generated according to the determination block R, and then used for the post-production image. A gradient operator edge search method is used to perform boundary detection estimation. Compared with the case where the gradient operation sub-edge search method is directly applied to the undetermined block R, a large number of operation processes are saved, and the operation speed can be greatly improved.

此外,本發明多區塊水位量測方法較佳實施例係選取複數個判斷區塊R,依據該複數個判斷區塊R運算產生複數個水面位置W,並一併考量該複數個水面位置W以計算產生一水位判定結果WC。藉此降低當一判斷區塊R受到遮蔽物體阻擋,使得據以運算產生之水面位置W並非實際淹水水面時,可以有效降低誤判為淹水水面之水面位置W對該水位判定結果WC所造成的影響,使得依據該水位判定結果WC所計算之水位高度具有較高之可信度。 In addition, in the preferred embodiment of the multi-block water level measurement method of the present invention, a plurality of determination blocks R are selected, and a plurality of water surface positions W are generated according to the plurality of determination block R operations, and the plurality of water surface positions are considered together. A water level determination result W C is generated by calculation. When a block is determined thereby reducing the shielding block by block R, so that when the operation according to the generated water W not the actual position of the flood water, can effectively reduce false determination result by W C W surface location of the flood level of the water The effect is such that the water level calculated according to the water level determination result W C has a high degree of credibility.

本發明多區塊水位量測方法較佳實施例,僅需藉由分析處理一影像,即可快速而有效地量測該影像中的水位高度,因此,可以提升淹水水位量測效率,進而達到「降低系統設置成本」、「增加水位量測準確性」、「提升運算速度」及「提升方法可靠度」等功效。 In the preferred embodiment of the multi-block water level measurement method of the present invention, the water level in the image can be quickly and effectively measured by analyzing and processing an image, thereby improving the flooding water level measurement efficiency, and further Achieve the effects of "reducing system installation cost", "increasing water level measurement accuracy", "upgrading operation speed" and "upgrading method reliability".

雖然本發明已利用上述較佳實施例揭示,然其並非用以限定本發明,任何熟習此技藝者在不脫離本發明之精神和範圍之內,相對上述實施例進行各種更動與修改仍屬本發明所保護之技術範疇,因此本發明之保護範圍當視後附之申請專利範圍所界定者為準。 While the invention has been described in connection with the preferred embodiments described above, it is not intended to limit the scope of the invention. The technical scope of the invention is protected, and therefore the scope of the invention is defined by the scope of the appended claims.

S1‧‧‧影像讀取步驟 S1‧‧‧Image reading step

S2‧‧‧灰階處理步驟 S2‧‧‧ Grayscale processing steps

S3‧‧‧影像強化步驟 S3‧‧‧ Image Enhancement Steps

S4‧‧‧影像校正步驟 S4‧‧‧Image correction procedure

S5‧‧‧濾波處理步驟 S5‧‧‧Filter processing steps

S6‧‧‧水位估算步驟 S6‧‧‧ water level estimation steps

Claims (16)

一種多區塊水位量測方法,藉由一監控鏡頭拍攝一原始影像,交由一電腦系統量測該原始影像之水位高度,係包含以下步驟:一影像讀取步驟,藉由該電腦系統讀入該原始影像,依據該原始影像之大小計算出一像素所代表之實際尺寸;一影像校正步驟,若該監控鏡頭之視角與地平線之夾角不等於零,則依據該夾角對該原始影像進行水平旋轉校正;並且自該原始影像中圈選複數個判斷區塊;及一水位估算步驟,係針對該判斷區塊套用一梯度運算子邊緣搜尋法,計算該後製影像各像素之影像梯度值及影像邊界值;且依據該影像邊界值推算一邊界投影值,以估算至少一邊界位置;再依據該邊界位置判定一水面位置,且根據由該複數個判斷區塊所產生之複數個水面位置推算一水位判定結果;最後,由該原始影像之像素所代表之實際尺寸計算出該水位判定結果所代表之水位高度。 A multi-block water level measurement method, in which a raw image is captured by a monitoring lens, and a computer system measures the water level of the original image, which includes the following steps: an image reading step, which is read by the computer system Entering the original image, calculating an actual size represented by a pixel according to the size of the original image; and an image correcting step, if the angle between the viewing angle of the monitoring lens and the horizon is not equal to zero, the original image is horizontally rotated according to the angle Correcting; and selecting a plurality of determination blocks from the original image; and a water level estimation step, applying a gradient operator edge search method to the determination block, and calculating image gradient values and images of each pixel of the post-image a boundary value; and estimating a boundary projection value according to the image boundary value to estimate at least one boundary position; determining a water surface position according to the boundary position, and estimating a water surface position based on the plurality of water surface positions generated by the plurality of determination blocks Water level determination result; finally, the water level determination knot is calculated from the actual size represented by the pixel of the original image The representative of the water level. 如申請專利範圍第1項所述之多區塊水位量測方法,其中,另包含一灰階處理步驟,於該影像讀取步驟完成後執行,係對該原始影像進行灰階運算,該原始影像經灰階運算後之亮度屬於一灰階色階範圍。 The method for measuring a multi-block water level according to claim 1, wherein the method further comprises a gray scale processing step, which is performed after the image reading step is completed, and performs gray scale operation on the original image, the original The brightness of the image after gray scale operation belongs to a gray scale range. 如申請專利範圍第2項所述之多區塊水位量測方法,其中,另包含一影像強化步驟,於該灰階處理步驟完成後執行,係調整經灰階運算之該原始影像,使其亮度平均分布於該灰階色階範圍之最大值與最小值之間。 The method for measuring a multi-block water level according to claim 2, further comprising an image enhancement step, which is performed after the gray level processing step is completed, and adjusts the original image by gray scale operation to make the original image The brightness is evenly distributed between the maximum and minimum values of the gray scale range. 如申請專利範圍第1、2或3項所述之多區塊水位量測方法,其中,該梯度運算子邊緣搜尋法計算該後製影像各像素之影像梯度及影像邊界值的方法如下式所示: 其中,G代表影像梯度,E代表影像邊界值,f(x,y)係為該判斷區塊之像素座標值為(x,y)時之灰階值,Gx代表該判斷區塊水平方向之梯度值,Gy代表該判斷區塊垂直方向之梯度值,ω為一閾值。 The multi-block water level measurement method described in claim 1, 2 or 3, wherein the gradient operator edge search method calculates the image gradient and the image boundary value of each pixel of the post-image as follows Show: Where G represents the image gradient, E represents the image boundary value, f(x, y) is the grayscale value of the pixel coordinate value of the judgment block (x, y), and Gx represents the horizontal direction of the judgment block. The gradient value, Gy represents the gradient value of the vertical direction of the judgment block, and ω is a threshold value. 如申請專利範圍第4項所述之多區塊水位量測方法,其中,該閾值使用Canny邊緣檢測算子求得。 The method for measuring a multi-block water level according to claim 4, wherein the threshold is obtained using a Canny edge detection operator. 如申請專利範圍第1、2或3項所述之多區塊水位量測方法,其中,若該影像校正步驟共選取L個判斷區塊,且該判斷區塊之大小為M×N像素,則推算該邊界投影值及估算該邊界位置的方法如下式所示: 其中,(x,y)代表上述判斷區塊之像素座標值,I(y)代表上述判斷區塊中一水平高度之邊界投影值,μ為一標準值。當上述邊界投影值超過該標準值時,該水平高度座標即被設定為一邊界位置。 The multi-block water level measurement method as described in claim 1, 2 or 3, wherein if the image correction step selects a total of L determination blocks, and the size of the determination block is M×N pixels, Then the method of estimating the boundary projection value and estimating the boundary position is as follows: Where (x, y) represents the pixel coordinate value of the above-mentioned judging block, and I(y) represents a boundary projection value of a horizontal height in the above-mentioned judging block, and μ is a standard value. When the boundary projection value exceeds the standard value, the horizontal height coordinate is set to a boundary position. 如申請專利範圍第6項所述之多區塊水位量測方法,其中,該判斷區塊之水平方向寬度共有M個像素,垂直方向長度共有N個像素,該標準值為M/2個像素。 The method for measuring a multi-block water level according to claim 6, wherein the judgment block has a total of M pixels in a horizontal direction width and a total of N pixels in a vertical direction, and the standard value is M/2 pixels. . 如申請專利範圍第1、2或3項所述之多區塊水位量測方法,其中, 判定該水面位置之方法係為將該邊界位置視為該水面位置。 The multi-block water level measurement method described in claim 1, 2 or 3, wherein The method of determining the position of the water surface is to regard the boundary position as the water surface position. 如申請專利範圍第1、2或3項所述之多區塊水位量測方法,其中,判定該水面位置之方法係取該至少一邊界位置中,隨時間變動之邊界位置,作為該水面位置。 The multi-block water level measurement method according to the first, second or third aspect of the patent application, wherein the method for determining the water surface position is a boundary position of the at least one boundary position that changes with time as the water surface position. . 如申請專利範圍第1、2或3項所述之多區塊水位量測方法,其中,推算該水位判定結果之方法係求取該複數個水面位置之平均數,作為該水位判定結果。 For example, the multi-block water level measurement method described in claim 1, 2 or 3, wherein the method for calculating the water level determination result is obtained by taking the average of the plurality of water surface positions as the water level determination result. 如申請專利範圍第1、2或3所述之多區塊水位量測方法,其中,推算該水位判定結果之方法係設定一容許範圍,求取該複數個水面位置中落在該容許範圍內之水面位置之平均數,以作為該水位判定結果。 The method for measuring a multi-block water level according to claim 1, 2 or 3, wherein the method for calculating the water level determination result sets an allowable range, and the plurality of water surface positions are determined to fall within the allowable range. The average of the water surface positions is used as the water level determination result. 如申請專利範圍第11所述之多區塊水位量測方法,其中,依據該多區塊水位量測方法先前量測之水位判定結果以設定該容許範圍。 The multi-block water level measurement method according to claim 11, wherein the allowable range is set according to the water level determination result previously measured by the multi-block water level measurement method. 如申請專利範圍第12所述之多區塊水位量測方法,其中,係將該多區塊水位量測方法先前量測之一水位判定結果加上一誤差值,以作為該容許範圍。 The multi-block water level measuring method according to claim 12, wherein the multi-block water level measuring method previously measures one water level determination result by adding an error value as the allowable range. 如申請專利範圍第12所述之多區塊水位量測方法,其中,係將該多區塊水位量測方法先前量測之複數個水位判定結果之平均值加上其標準差與一容許倍率之乘積,以作為該容許範圍。 The method for measuring a multi-block water level according to claim 12, wherein the average value of the plurality of water level determination results previously measured by the multi-block water level measurement method is added to the standard deviation and an allowable ratio. The product is taken as the allowable range. 如申請專利範圍第1、2或3項所述之多區塊水位量測方法,其中,該多區塊水位量測方法另包含一濾波處理步驟,係在該影像校正步驟選出複數個判斷區塊後,對各該判斷區塊進行濾波處理以消除雜訊。 The multi-block water level measurement method as described in claim 1, 2 or 3, wherein the multi-block water level measurement method further comprises a filtering processing step, wherein a plurality of determination areas are selected in the image correction step After the block, each of the determination blocks is filtered to eliminate noise. 如申請專利範圍第15項所述之多區塊水位量測方法,其中,該濾波處理步驟所使用之濾波處理方法為中間值濾波。 The method for measuring a multi-block water level according to claim 15, wherein the filtering processing method used in the filtering processing step is intermediate value filtering.
TW102120913A 2013-06-13 2013-06-13 Method of water level measurement TWI487884B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW102120913A TWI487884B (en) 2013-06-13 2013-06-13 Method of water level measurement

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW102120913A TWI487884B (en) 2013-06-13 2013-06-13 Method of water level measurement

Publications (2)

Publication Number Publication Date
TW201447241A true TW201447241A (en) 2014-12-16
TWI487884B TWI487884B (en) 2015-06-11

Family

ID=52707451

Family Applications (1)

Application Number Title Priority Date Filing Date
TW102120913A TWI487884B (en) 2013-06-13 2013-06-13 Method of water level measurement

Country Status (1)

Country Link
TW (1) TWI487884B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108284925A (en) * 2018-01-09 2018-07-17 燕山大学 The recognition detection method of waterline
CN110909640A (en) * 2019-11-11 2020-03-24 浙江大华技术股份有限公司 Method and device for determining water level line, storage medium and electronic device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI343207B (en) * 2007-09-07 2011-06-01 Lite On Technology Corp Device and method for obtain a clear image
TWI384205B (en) * 2008-07-03 2013-02-01 Univ Nat Central Measurement method for the height of a liquid surface
TWI396832B (en) * 2009-02-09 2013-05-21 Nat Applied Res Laboratories Liquid level identification method
CN101901342B (en) * 2009-05-27 2014-05-07 深圳迈瑞生物医疗电子股份有限公司 Method and device for extracting image target region
TW201124711A (en) * 2010-01-15 2011-07-16 Univ Nat Central Monitoring system and method for water quality and quantity
CN202008382U (en) * 2011-01-12 2011-10-12 湖南大学 Liquid level detector based on machine vision

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108284925A (en) * 2018-01-09 2018-07-17 燕山大学 The recognition detection method of waterline
CN110909640A (en) * 2019-11-11 2020-03-24 浙江大华技术股份有限公司 Method and device for determining water level line, storage medium and electronic device

Also Published As

Publication number Publication date
TWI487884B (en) 2015-06-11

Similar Documents

Publication Publication Date Title
CN107506798B (en) Water level monitoring method based on image recognition
JP4767240B2 (en) Method and apparatus for detecting video boundary and computer-readable recording medium embodying the same
US8184848B2 (en) Liquid level detection method
US20140125801A1 (en) On-line tunnel deformation monitoring system based on image analysis and its application
US20160189354A1 (en) Image processing system, image processing device, and image processing method
CN103973990A (en) Wide dynamic fusion method and device
CN105279772B (en) A kind of trackability method of discrimination of infrared sequence image
CN105828065B (en) A kind of video pictures overexposure detection method and device
WO2020110576A1 (en) Information processing device
CN103632369A (en) Method for universally detecting quality of non-reference underwater images on basis of combination of block average definition
US10375383B2 (en) Method and apparatus for adjusting installation flatness of lens in real time
TWI465699B (en) Method of water level measurement
TWI487884B (en) Method of water level measurement
CN117252868B (en) Direct current screen defect detection method based on machine vision
CN110728212A (en) Road well lid monitoring device and method based on computer vision
Kong et al. Detecting type and size of road crack with the smartphone
TWI481824B (en) Method of water level surveillance
JP4108593B2 (en) Inundation monitoring device
Powell et al. Automated road distress detection
CN110533698B (en) Foundation pit construction pile detection control method based on visual detection
GB2470741A (en) Liquid level detection method
CN111583341B (en) Cloud deck camera shift detection method
CN114723691A (en) Method for detecting oil leakage fault degree of hydraulic system based on artificial intelligence
Ortigossa et al. Using digital image processing to estimate the depth of urban streams
TWI573099B (en) Method of regional water level measurement

Legal Events

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