gray_histo算子


* Calculate the gray value distribution of two regions of an image
* 
*讀取圖片
read_image (Image, 'fabrik')
dev_close_window ()
*獲取圖片大小
get_image_size (Image, Width, Height)
dev_open_window (0, 0, Width, Height, 'black', WindowID)
dev_display (Image)
dev_set_draw ('margin')
dev_set_color ('red')
* Create two rectangles parallel to the coordinate axes
*生成一個矩形區域
gen_rectangle1 (Rectangle1, 351, 289, 407, 340)
dev_set_color ('green')
*生成另一個矩形區域
gen_rectangle1 (Rectangle2, 78, 178, 144, 244)
*分別計算圖片在兩個矩形區域部分的直方圖
gray_histo (Rectangle1, Image, AbsoluteHisto1, RelativeHisto1)
gray_histo (Rectangle2, Image, AbsoluteHisto2, RelativeHisto2)
dev_set_color ('red')
* Convert a histogram created with gray_histo into a region
*分別生成直方圖數據成區域
gen_region_histo (Histo1, AbsoluteHisto1, 255, 255, 1)
dev_set_color ('green')
gen_region_histo (Histo2, AbsoluteHisto2, 255, 255, 1)

=========================================

gray_histo(Regions,Image:::AbsoluteHisto,RelativeHisto)

        功能描述:計算區域內的灰度值分布(灰度直方圖)

        參數:

        Regions(輸入參數):計算直方圖的區域;

        Image(輸入參數):輸入圖像;

        AbsoluteHisto(輸出參數):灰度值的絕對頻率(灰度值對應的像素個數);

        RelativeHisto(輸出參數):灰度值的相對頻率(像素個數除以區域面積);

       注:AbsoluteHisto和RelativeHisto這兩個元組包含的元素是256個,索引從0-255對應0-255的灰度值

 

gen_region_histo(:Region:Histogram,Row,Column,Scale:)

       功能描述:根據直方圖生成灰度直方圖區域。

       參數:

       Region(輸出參數):包含了直方圖的區域;

       Histogram(輸入參數):輸入直方圖;

       Row(輸入參數):直方圖中心行坐標;

       Column(輸入參數):直方圖中心列坐標;

       Scale(輸入參數):直方圖縮放因子;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM