日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

halcon知识:图像纹理特征提取cooc_feature_matrix

發(fā)布時(shí)間:2025/3/21 编程问答 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 halcon知识:图像纹理特征提取cooc_feature_matrix 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一、關(guān)于共生矩陣?

????????如果不懂啥叫共生矩陣,將無(wú)法閱讀該文。如果試圖搞明白啥叫共生矩陣,請(qǐng)看我的另一篇博文,《hjalcon知識(shí):共生矩陣》

? ? ? ? 本片介紹共生矩陣產(chǎn)生的其它屬性:能量、相關(guān)性、同質(zhì)性(同類(lèi)性)、對(duì)比度。

? ? ? ? halcon內(nèi)關(guān)于共生矩陣有三個(gè)算子:

  • gen_cooc_matrix、
  • cooc_feature_matrix、
  • cooc_feature_image

三個(gè)算子的其關(guān)系如下圖:

二、算子函數(shù)

cooc_feature_matrix(CoocMatrix : : : Energy, Correlation, Homogeneity, Contrast)

cooc_feature_matrix(

CoocMatrix

圖標(biāo)量輸入,這里是共生矩陣
無(wú)圖標(biāo)輸出
無(wú)控制量輸入

Energy,

Correlation,

Homogeneity,

Contrast )

四個(gè)控制量,決定圖像特征

?三、特征的數(shù)學(xué)原理

????????該算子根據(jù)共現(xiàn)矩陣(CoocMatrix)計(jì)算能量(能量)、相關(guān)性(相關(guān)性)、局部同質(zhì)性(同質(zhì)性)和對(duì)比度(對(duì)比度)。

????????運(yùn)算符cooc_feature_matrix根據(jù)以下公式計(jì)算由gen_cooc_matrix生成的輸入矩陣中與參數(shù)LdGray和direction指示的方向矩陣相對(duì)應(yīng)的部分的灰度值特征:

3.1 中間變量定義

width = 共生矩陣的寬度(灰度圖像為8)

?= 共生矩陣的元素值

??

3.2 特征數(shù)學(xué)模型

1)能量

? ? ? ? ? ? ? ?計(jì)量圖像的同質(zhì)性,該值越大越不夠同質(zhì)

2)相關(guān)性

?相關(guān)與獨(dú)立相反,該值越大越不獨(dú)立

?3)同質(zhì)度

4)對(duì)比度

四、相關(guān)代碼

* This example shows how to calculate co-occurrence matrices * from given image regions and how to derive gray value features * from these co-occurrence matrices. dev_update_off () * * Read in an image and open and prepare the output windows read_image (Image, 'mreut') dev_close_window () get_image_size (Image, Width, Height) CoocWinSize := 320 Border := 10 dev_open_window (0, CoocWinSize + Border, Width, Height, 'black', WindowID) set_display_font (WindowID, 16, 'mono', 'true', 'false') dev_display (Image) dev_set_draw ('margin') dev_set_line_width (3) * dev_open_window (Height - CoocWinSize, 0, CoocWinSize, CoocWinSize, 'black', WindowID1) set_display_font (WindowID1, 16, 'mono', 'true', 'false') dev_set_lut ('temperature') dev_set_draw ('margin') dev_set_line_width (5) dev_set_color ('yellow') * dev_open_window (0, Width + CoocWinSize + 2 * Border, CoocWinSize, CoocWinSize, 'black', WindowID2) set_display_font (WindowID2, 16, 'mono', 'true', 'false') dev_set_lut ('temperature') dev_set_draw ('margin') dev_set_line_width (5) dev_set_color ('blue') * * Define the regions for which the co-occurance matrices will be calculated gen_rectangle1 (Rectangle1, 350, 100, 450, 200) gen_rectangle1 (Rectangle2, 100, 200, 200, 300) inner_circle (Rectangle1, Row1, Column1, Radius1) inner_circle (Rectangle2, Row2, Column2, Radius2) * * Loop over the four possible directions for Direction := 0 to 135 by 45* * Calculate the co-occurrence matrices for the given regionsgen_cooc_matrix (Rectangle1, Image, Matrix1, 6, Direction)gen_cooc_matrix (Rectangle2, Image, Matrix2, 6, Direction)* * Calculate the gray value features from the co-occurance matricescooc_feature_matrix (Matrix1, Energy1, Correlation1, Homogeneity1, Contrast1)cooc_feature_matrix (Matrix2, Energy2, Correlation2, Homogeneity2, Contrast2)* * Display the resultsdev_set_window (WindowID)dev_display (Image)disp_message (WindowID, 'Direction: ' + Direction$'3d' + ' degrees', 'window', 260, 100, 'black', 'true')dev_set_color ('yellow')dev_display (Rectangle1)gen_arrow_contour_xld (Arrow1, Row1, Column1, Row1 - sin(rad(Direction)) * 0.9 * Radius1, Column1 + cos(rad(Direction)) * 0.9 * Radius1, 8, 8)dev_display (Arrow1)dev_set_color ('blue')dev_display (Rectangle2)gen_arrow_contour_xld (Arrow2, Row2, Column2, Row2 - sin(rad(Direction)) * 0.9 * Radius2, Column2 + cos(rad(Direction)) * 0.9 * Radius2, 8, 8)dev_display (Arrow2)* String := ['Energy: ','Correlation: ','Homogeneity: ','Contrast: ']dev_set_window (WindowID1)dev_display (Matrix1)get_domain (Matrix1, Domain)dev_display (Domain)disp_message (WindowID1, String$'-14s' + [Energy1,Correlation1,Homogeneity1,Contrast1]$'6.3f', 'window', 12, 12, 'white', 'false')* dev_set_window (WindowID2)dev_display (Matrix2)get_domain (Matrix2, Domain)dev_display (Domain)disp_message (WindowID2, String$'-14s' + [Energy2,Correlation2,Homogeneity2,Contrast2]$'6.3f', 'window', 12, 12, 'white', 'false')* if (Direction < 135)disp_continue_message (WindowID, 'black', 'true')stop ()endif endfor

五、結(jié)果

總結(jié)

以上是生活随笔為你收集整理的halcon知识:图像纹理特征提取cooc_feature_matrix的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。