Skip to content

Instantly share code, notes, and snippets.

View MarcWang's full-sized avatar

MarcWang MarcWang

  • 吾微而智
View GitHub Profile

Language

  • Javascript
  • C++
  • C#

PC App

  • Developing Client Applications on Destop with the QT Framework (C++)
  • Developing Client Applications on Destop with the .NET Framework (C#)

你有注意過台灣的美嗎? (Tripinsiders: Live Like a Local)

Source

I used to think traveling was all about seeing all the famous landmarks with my own eyes

以前我總覺得旅行就是親眼看看那些著名的景點

eating at all the famous restaurants recommended in the guidebooks and going home with my suicase full of souvenirs

Translate Image Format from RealSense to OpenCV

開始玩RealSense不免俗來一篇影像格式轉換的教學,因為在影像處理上還是習慣用OpenCV當作主要開發的Library,其實RealSense抓到的Color影像是可支援RGB24和RGB32的,比較特別的是Depth影像必須使用16位元的去記錄深度資訊,因為有效範圍是0.21.2公尺,我猜測0255無法完全記錄這麼長一段的深度資訊。所以抓到的對大值應該是65536。依需求自行可以定義某段區間的值在做正歸化就可以明顯看出那段的深度精確程度。

開發環境:

  • Qt 5.5.1
  • Windows 8.1
  • MSVC 2012

Thresholding using OpenCV

門檻值過濾算是最簡單的影像切割方法,OpenCV提供兩個APIcv::thresholdcv::adaptiveThreshold讓開發者使用,threshold這個API必須自己設定門檻值,而adaptiveThreshold可以自動判斷適合的門檻值,依個人需求而決定使用哪一個。

double threshold(InputArray src, OutputArray dst, double thresh, double maxval, int type)
  • src 輸入影像
  • dst 輸出影像
  • thresh 門檻值
  • maxval 滿足條件給予該像素點的值

瓶裝水的真實秘密 (The story of bottled water and what should surprise you about what bottled water really is.)

Meet Daniel and Alex

認識一下Daniel和Alex

Both lead a healthy lifestyle and try to drink only water

Connected Component Labeling using OpenCV

一般使用計算連通物件的方法分別為Two-Pass及Seed-Filling這兩種,可以選擇使用4連通(4-connected)或者8連通(8-connected)去串連物件。

在OpenCV還沒有提供connectedComponentsAPI之前大家會使用findcontours去計算連通物件,有興趣可以參考這篇Find Contours using OpenCV

Two-Pass Algorithm with 4-connected

第一次檢查條件

Morphological Dilation and Erosion using OpenCV

型態學常用的4個運算:

  • 膨脹(Dilation)
  • 侵蝕(Erosion)
  • 斷開(Opening)
  • 閉合(Closing)

運用層面:

  • 消除影像中的雜訊時 (Removing noise)

下載 (Download)

Hough Transform using OpenCV

一般在偵測霍夫線前會有前處理動作邊緣偵測,而霍夫圓不用,因為該API已包含此功能。

要計算線可使用卡迪爾座標系統(Cartesian coordinate system)及極座標系統(Polar coordinate system)

卡迪爾座標的線公式 = y = kx + b

在時代廣場捕獲了野生超人!(No One in Times Square Recognized Henry Cavill in a Superman T-Shirt)

You did something on your Instagram account that, I wanna, before we show this, tell me why you did this?

你在你的Instergram上傳了一張照片,我想,在我們秀出那個之前,可以告訴我為什麼你這樣做嗎?

Well, there's been so much doubt about the validity of Superman's disguise, which is, the glass.