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#)

Convert Binary Data to OpenCV Image Format

在影像處理時,常常會讀取影像資料(binary data)後轉成影像格式(cv::Mat),在進行影像操作。

那我們如何轉成可用的OpenCV影像格式呢?

首先讀取檔案後得到binary data,在進行解碼轉成cv::Mat

當然如果單純讀檔後轉成OpenCV影像格式,OpenCV是有提供cv::imread這個API可以使用。

04-03

  • comb [kom] (n.) 梳子
  • suspend [səˋspɛnd] (v.) 終止
  • belief [bɪˋlif] (n.) 相信、信任
  • consequence [ˋkɑnsə͵kwɛns] (n.) 結果、後果
  • radical [ˋrædɪk!] (adj.) 激進的
  • engrained [ɪnˋgrend] (adj.) 根深蒂固的
  • grain [gren] (n.) 穀粒
  • institution [͵ɪnstəˋtjuʃən] (n.) 機構

你有注意過台灣的美嗎? (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

Morphological Dilation and Erosion using OpenCV

型態學常用的4個運算:

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

運用層面:

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

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.