為達到豬舍自動除糞之目的,本研究發展了一套電腦視覺定位系統,針對模擬豬舍影像進行準確的豬糞定位。首先建構一組模擬豬舍,其中包括模擬豬隻與模擬豬糞。其次建立一套調光取像系統,包含攝影機、調光器、白光燈泡、光照度感測器及光度計等。攝影機架設於模擬豬舍上方,藉由調光器改變環境光照度,以攝影機擷取模擬豬舍上視影像,並進行電腦視覺定位系統的辨識效果試驗。試驗時使用9種分布型態、5種光照度,共計45種環境條件進行取像。影像經由電腦視覺定位系統進行物體辨識與定位紀錄,系統使用的初始化參數,分別為外接矩形範圍、密集度範圍、使用者「自定義遮罩範圍」及梯度門檻值。辨識效果試驗於45種環境條件下進行取像,而辨識與定位過程中,使用10種梯度門檻值,試驗總次數共計450次,並於每次辨識試驗完後,記錄該光照度與梯度門檻值下的辨識效果。辨識效果使用兩種指標,分別為漏判率與誤判率。實驗數據以X軸為環境光照度、Y軸為梯度門檻值、Z軸為漏判率(或誤判率),繪出各分布型態條件下的漏判率及誤判率的三維曲面圖及曲面上視圖,探討最佳辨識效果所需的環境光照度與梯度門檻值。結果顯示電腦視覺定位系統於環境光照度為500 lux、梯度門檻值為40時,可達到平均漏判率4.57%、平均誤判率8.21%的最佳辨識效果。而除了「散佈豬群、群聚糞便」、「聚散豬群、群聚糞便」及「群聚豬群、群聚糞便」三種分布狀態外,系統漏判率與誤判率皆小於10%。
In order to achieve the automatic manure removal in pig pens, a computer vision system was developed to accurately position the simulated manures thru the camera image of the simulated pig pen in this study. The simulated pig pen including simulated pigs and simulated manures was constructed. An image acquiring system, including camera, dimmer, incandescent lamp, photometric sensor and photometer was set up for testing the computer vision system. The top view image was taken by the camera mounted on top of the simulated pig pen while the ambient luminosity was adjusted by using the dimmer. In experimental design, 9 different distribution patterns and 5 levels of luminosity, totally 45 conditions were tested for evaluating the positioning efficiency of the system. The parameters used in tests include the minimum enclosing rectangle (MER), density, self-defined mask and the gradient threshold value. The image was acquired at the previous 45 different conditions, and there were 10 gradient threshold levels for each condition, thereafter 450 tests were conducted in this study. Two indices of positioning efficiency, error rate and missing rate, were recorded for each test. These data were presented by drawing the three-dimension curved surfaces and their top views by using the luminosity as the x-axis, the gradient threshold value as the y-axis and the missing rate (or error rate) as the z-axis. The optimal condition was then investigated through the above three-dimension drawings. Experimental results showed that the optimal recognizing effect of 4.57% of average missing rate and 8.21% of average error rate was achieved under the condition of 500 lux of luminosity and gradient threshold value of 40. Also, except the three distribution patterns - “scattered pigs, clustered manures”, “randomized pigs, clustered manures” and “clustered pigs, clustered manures”, the missing rate and error rate of the system were all less than 10%.