Roberts運算元邊緣檢測(vc實現)

2021-06-08 11:49:45 字數 758 閱讀 9608

void cislsview::onroberts()

//colorref pixel;

int maxy = myimage1.getheight();

int maxx=myimage1.getwidth();

byte* prealdata;

byte* prealdata2;

prealdata=(byte*)myimage1.getbits();

prealdata2=(byte*)myimage2.getbits();

int pit=myimage1.getpitch();

int pit2=myimage2.getpitch();

//需要注意,pit和pit2的值並不一樣,所以如果使用乙個值,會導致不同的結果出現

//cstring str;

"%d"),pit);

//messagebox(str);

"%d"),pit2);

//messagebox(str);

int bitcount=myimage1.getbpp()/8;

int bitcount2=myimage2.getbpp()/8;

int tempr,tempg,tempb;

float temp,tempx,tempy;

int pixel[4];

// tempr=tempg=tempg=0;

//說明:將生產的影象作為24點陣圖處理。

for (int y=0; y

邊緣檢測常用運算元

邊緣檢測常用運算元 基於一階微分的邊緣檢測方法 roberts 運算元考慮影象的2 2鄰域,是最簡單的邊緣檢測運算元,演算法過程簡述 1 遍歷影象 除去上邊緣和左邊緣 對每個畫素做roberts模板運算。2 將結果儲存到目標影象,結束。sobel運算元考察的是3 3鄰域,由兩個卷積核組成,見上圖,演...

邊緣檢測 Sobel運算元

依賴opencv來做一些資料結構和顯示的工作,但主要的計算法部分是自己實現的。後面爭取依次給出常見的集中邊緣提取的演算法實現。下次補上原理推到說明。sobel.cpp 定義控制台應用程式的入口點。include stdafx.h include cv.h include highgui.h incl...

邊緣檢測運算元

看了很多邊緣檢測的文章,有些不夠詳細,有些不算綜合,所以打算總結一下!以下內容均為個人理解,如有問題,望指正!首先,我想要解釋一下什麼是邊緣。通俗地講,灰度值變化劇烈的地方就是邊緣。那麼如何判斷灰度值變化?如何度量 劇烈 各類演算法給出了自己的規範或者說是原則。所以,各類運算元就跳出來了。由於各類運...