PIXNET Logo登入

天天向上

跳到主文

程式外包服務  E-mail: me1237guy@yahoo.com.tw 歡迎來信洽談, 請附上相關文件或問題說明, 謝謝

專長:  ※自動光學檢測 ※人臉辨識 ※車牌辨識 ※錄影監控系統 ※自動控制I/O相關 
      ※演算法開發 ※基因演算法 ※類神經網路 
      ※MATLAB  ※VISUAL C++/C# ※Xamarin ※OpenCV ※Emgu ※Unity ※QT4/5
-----------------------------------------------------------------------------------------------
   SA (模擬退火法)     GA (基因演算法)    ACO (蟻群演算法)    PSO (粒子最佳化演算法)   
   排列組合問題最佳化   TSP  Scheduling  K-means, Fuzzy C-means, KNN, DBSCAN分群  
   Fuzzy Control (模糊控制)  Neural Networks (類神經網路) Object Tracking (Kalman Filter, Optical Flow)  
   Object Recognition (Pattern Match, Haar-Like Features, EigenFace)  Human Pose Recognition
   人臉偵測     移動物偵測   車牌辨識    智慧型監控攝影  XBOX Kinect影像處理及應用 體感互動應用  
   自動光學檢測(AOI) 玻璃檢測  NVIDIA CUDA平行運算處理
   TI-DSP 6xxx系列 雙影像輸入   / Raspberry PI 樹莓派 / Arduino控制  自走車避障礙物(GPS/機器視覺)

部落格全站分類:數位生活

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 9月 01 週二 201520:01
  • Emgu CV: 如何有效取得像素值?

image
How to go through each and every pixel of an image efficiently? 專案名稱: SpeedUpPixelAcessUnmaged code:第一種方式: MIplImage(1) MIplImage: managed structure equivalent to IplImage利用Marshal.PtrToStructure指向來源影像指標img.Ptr, 資料結構型態為 MIplImage, 記得前面強迫轉型(MIplImage)(2) IntPtr intPtr = mImg.ImageData;
C#利用IntPtr指標型態指向 ImageData: 存放影像像素資料起始位置
(繼續閱讀...)
文章標籤

me1237guy 發表在 痞客邦 留言(2) 人氣(7,943)

  • 個人分類:Emgu CV
▲top
  • 8月 30 週日 201516:29
  • 輪廓為基礎的樣板比對



最近在研究這篇Edge Based Template Matching, 以下為研究心得筆記原作者提供C++版本的實作(OpenCV 2.0 and Visual studio 2008 ), 搭配數學公式說明, 讓人很容易理解
    這個方法(Feature based approach)相較於傳統(Gray value based approach)強健許多,
      尤其當搜尋物件非完整顯示時,可以準確搜. 但計算量超大, 不適合大張圖像樣板比對
      目前我已經成功改寫成C# Emgu CV版本, 之後考慮改以GPU版本加速, 以利實際應用
下面三張圖簡單說明本範例應用情形: 第一張圖(左下角)為template image(樣板影像)
(繼續閱讀...)
文章標籤

me1237guy 發表在 痞客邦 留言(2) 人氣(9,173)

  • 個人分類:Emgu CV
▲top
  • 8月 23 週日 201516:08
  • ActViz: 3-D colored surface

image
MATLAB: peaks指令VTK上視圖VTK 3Dzoom in參考資料:VTK/Examples/CSharp/Meshes/Color a mesh by height
(繼續閱讀...)
文章標籤

me1237guy 發表在 痞客邦 留言(0) 人氣(55)

  • 個人分類:C#
▲top
  • 8月 23 週日 201513:38
  • ActViz: 繪製坐標軸

image
private Kitware.VTK.RenderWindowControl renderWindowControl1;
vtkAxesActor axes = null;
List<vtkActor> vtkActors = new List<vtkActor>();
public Form1()
{
InitializeComponent();
renderWindowControl1 = new RenderWindowControl();
splitContainer1.Panel2.Controls.Add(renderWindowControl1);
renderWindowControl1.Show();
renderWindowControl1.Dock = DockStyle.Fill;
}
(繼續閱讀...)
文章標籤

me1237guy 發表在 痞客邦 留言(0) 人氣(209)

  • 個人分類:C#
▲top
  • 8月 23 週日 201511:50
  • ActViz: 繪製線段

image
加入參考Kitware.mummy.Runtime.dll和Kitware.VTK.dllpublic partial class Form1 : Form
{
private Kitware.VTK.RenderWindowControl renderWindowControl1;
List<vtkActor> vtkActors = new List<vtkActor>();
public Form1()
{
InitializeComponent();
renderWindowControl1 = new RenderWindowControl();
splitContainer1.Panel2.Controls.Add(renderWindowControl1);
renderWindowControl1.Show();
renderWindowControl1.Dock = DockStyle.Fill;
}
(繼續閱讀...)
文章標籤

me1237guy 發表在 痞客邦 留言(0) 人氣(88)

  • 個人分類:C#
▲top
  • 8月 22 週六 201517:52
  • ActiViz: SimplePointReader

image
Add references: Kitware.mymmy.Runtime.dll and KitwareVTK.dll==============================================using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Kitware.VTK;
namespace SimplePointsReader
{
public partial class Form1 : Form
{
private Kitware.VTK.RenderWindowControl renderWindowControl1;
public Form1()
{
InitializeComponent();
renderWindowControl1 = new RenderWindowControl();
this.Controls.Add(renderWindowControl1);
renderWindowControl1.Show();
renderWindowControl1.Dock = DockStyle.Fill;
}
(繼續閱讀...)
文章標籤

me1237guy 發表在 痞客邦 留言(0) 人氣(195)

  • 個人分類:C#
▲top
  • 8月 22 週六 201516:50
  • VTK: 計算一點到一直線的距離和離線段最接近的點之座標

image
p0離紅色線段最近的點,即本身所在位置(1,0,0), 所以距離平方為0p1離紅色線段最近的點(1, 0, 0), 距離平方為4// DistancePointToLine.cpp : 定義主控台應用程式的進入點。
//
#include "stdafx.h"
#include <vtkSmartPointer.h>
#include <vtkLine.h>
#include <vtkPoints.h>
int _tmain(int argc, _TCHAR* argv[])
{
double lineP0[3] = {0.0, 0.0, 0.0};
double lineP1[3] = {1.0, 0.0, 0.0};
double p0[3] = {1.0, 0, 0};
double p1[3] ={ 1.0, 2.0, 0};
/*
vtkSmartPointer<vtkLine> line =
vtkSmartPointer<vtkLine>::New();
line->GetPoints()->SetPoint(0, lineP0);
line->GetPoints()->SetPoint(0, lineP1);
*/
{
double dist0 = vtkLine::DistanceToLine(p0, lineP0, lineP1);
std::cout << "Dist0: " << dist0 << std::endl;
double dist1 = vtkLine::DistanceToLine(p1, lineP0, lineP1);
std::cout << "Dist1: " << dist1 << std::endl;
}
{
double t;
double closest[3];
double dist0 = vtkLine::DistanceToLine(p0, lineP0, lineP1, t, closest);
std::cout << "Dist0: " << dist0 << " closest point: " << closest[0] << " " << closest[1] << " " << closest[2] << std::endl;
double dist1 = vtkLine::DistanceToLine(p1, lineP0, lineP1, t, closest);
std::cout << "Dist1: " << dist1 << " closest point: " << closest[0] << " " << closest[1] << " " << closest[2] << std::endl;
}
char c;
std::cin >> c;
return 0;
}
(繼續閱讀...)
文章標籤

me1237guy 發表在 痞客邦 留言(0) 人氣(256)

  • 個人分類:C#
▲top
  • 8月 22 週六 201514:53
  • C# - synchronizing two threads with AutoResetEvent

image
同步兩個執行緒, 當Counter1++完成, 換Counter2++, 利用AutoResetEvent機制交換控制權由於同步的關係, 儘管兩組計數器跳動很快, 但下列條件成立 |Counter1 -Counter2| <= 1public class Worker
{
int m_cnt1 = 0, m_cnt2 = 0;
Thread m_thread1;
Thread m_thread2;
TextBox m_textBox1, m_textBox2;
readonly AutoResetEvent m_syncEvent1 = new AutoResetEvent(false);
readonly AutoResetEvent m_syncEvent2 = new AutoResetEvent(true);
ManualResetEvent m_pauseEvent = new ManualResetEvent(true);
ManualResetEvent m_shutdownEvent = new ManualResetEvent(false);
void Job1()
{
while (true)
{
m_pauseEvent.WaitOne(Timeout.Infinite);
if (m_shutdownEvent.WaitOne(0))
break;
m_syncEvent2.WaitOne();
m_cnt1++;
m_textBox1.BeginInvoke((MethodInvoker)delegate {
m_textBox1.Text = m_cnt1.ToString();
});
Thread.Sleep(1);
m_syncEvent1.Set();
}
}
void Job2()
{
while (true)
{
m_pauseEvent.WaitOne(Timeout.Infinite);
if (m_shutdownEvent.WaitOne(0))
break;
m_syncEvent1.WaitOne();
m_cnt2++;
m_textBox2.BeginInvoke((MethodInvoker)delegate
{
m_textBox2.Text = m_cnt2.ToString();
});
Thread.Sleep(1);
m_syncEvent2.Set();
}
}
public Worker() { }
public Worker(TextBox textBox1, TextBox textBox2)
{
m_textBox1 = textBox1;
m_textBox2 = textBox2;
}
public void Start()
{
m_thread1 = new Thread(new ThreadStart(Job1));
m_thread2 = new Thread(new ThreadStart(Job2));
m_thread1.Start();
m_thread2.Start();
}
public void Pause()
{
m_pauseEvent.Reset();
}
public void Resume()
{
m_pauseEvent.Set();
}
public void Stop()
{
m_shutdownEvent.Set();
m_pauseEvent.Set();
m_thread1.Join();
m_thread2.Join();
m_thread1 = null;
m_thread2 = null;
}
}
(繼續閱讀...)
文章標籤

me1237guy 發表在 痞客邦 留言(0) 人氣(81)

  • 個人分類:C#
▲top
  • 8月 16 週日 201512:22
  • C# Dictionary&lt;TKey, TValue&gt;


參考資料[C#]Dictionary的foreach使用KeyValuePair
C# Dictionary的用法,以及查字典的用途

C#Hashtable與Dictionary比較性能

雜湊(Hash)C# Dictionary用法 recordHow do I read and write a C# string Dictionary to a file?
(繼續閱讀...)
文章標籤

me1237guy 發表在 痞客邦 留言(0) 人氣(106)

  • 個人分類:C#
▲top
  • 8月 13 週四 201512:00
  • C#多執行緒測試

image
Worker類別public class Worker
{
/* Initializes a new intance of the ManualRestEvent class
* with a Boolean value indicating whether to set the
* initial state signaled
*/
private ManualResetEvent m_pauseEvent = new ManualResetEvent(true);
private ManualResetEvent m_shutdownEvent = new ManualResetEvent(false);
private Thread m_thread;
private int m_cnt = 0;
private string m_status;
private Label m_lbl;
private TextBox m_tBox;
private ProgressBar m_pBar;
public int UserID { get; set; }
public string Status
{
get { return m_status; }
}
public int Count
{
get { return m_cnt; }
set { m_cnt = value; }
}
public Worker() { }
public Worker(Label lbl, TextBox tBox, ProgressBar pBar)
{
m_lbl = lbl;
m_tBox = tBox;
m_pBar = pBar;
}
#region Job
public void Job()
{
const int UPDATE_PERIOD = 10000;
while (true)
{
/* 若收到訊號, 則m_pauseEvent程式繼續往下執行
* 反之, 沒有收到訊號, 則持續等待(infinite),
* 程式不會往下執行(凍結)
*/
m_pauseEvent.WaitOne(Timeout.Infinite);
/* 若沒有收到訊號, 則一直等待訊號,
* 但因為timeout設定等待 0 ms, 自動跳開回傳false
* 反之, 收到訊號, 回傳true
*/
if(m_shutdownEvent.WaitOne(0))
break;
m_cnt++;
if (m_cnt % UPDATE_PERIOD == 0)
{
updateTextBox();
updateProgressBar();
}
}
}
#endregion
#region Start
public void Start()
{
m_thread = new Thread(Job);
m_thread.Start();
m_status = "執行緒開始執行...";
updateLabel();
}
#endregion
#region Pause
public void Pause()
{
// 將事件設定為未收到訊號, 會造成執行緒封鎖
m_pauseEvent.Reset();
m_status = "執行緒暫停";
updateLabel();
}
#endregion
#region Resume
public void Resume()
{
// 將事件設定為收到訊號, 會封鎖的執行緒繼續
m_pauseEvent.Set();
m_status = "執行緒繼續";
updateLabel();
}
#endregion
#region Stop
public void Stop()
{
/* m_shutdownEven事件收到訊號,
* 則(m_shutdownEvent.WaitOne(0))
* 回傳true
*/
m_shutdownEvent.Set();
/* 記得通知_pauseEvent, 即_pauseEvent.Set();
* 否則通知_shutdownEvent也枉然
*/
m_pauseEvent.Set();
/* 優雅地等執行緒結束,
* 即 呼叫_thread.Join();
* 而不是Thread.Terminate
*/
m_thread.Join();
m_status = "執行緒停止";
updateLabel();
}
#endregion
#region Reset Cnt
public void ResetCnt()
{
m_cnt = 0;
}
#endregion
#region Update UI
public void updateLabel()
{
if (m_lbl.InvokeRequired)
{
m_lbl.BeginInvoke((Action)(() => { updateLabel(); }));
}
else
{
m_lbl.Text = m_status;
}
}
public void updateTextBox()
{
if (m_tBox.InvokeRequired)
{
m_tBox.BeginInvoke((Action)(() => { updateTextBox(); }));
}
else
{
m_tBox.Text = m_cnt.ToString();
}
}
public void updateProgressBar()
{
if (m_pBar.InvokeRequired)
{
m_pBar.BeginInvoke((Action) (()=>{ updateProgressBar();}) );
}
else
{
m_pBar.Value = m_cnt;
}
}
#endregion
}
(繼續閱讀...)
文章標籤

me1237guy 發表在 痞客邦 留言(0) 人氣(894)

  • 個人分類:C#
▲top
«1...53545589»

個人資訊

me1237guy
暱稱:
me1237guy
分類:
數位生活
好友:
累積中
地區:

熱門文章

  • (8,482)分水嶺影像分割Marker-based Image Segmentation Algorithm Using OpenCV2.4.7 with Visual Studio 2010
  • (4,000)Pylon Live View C# Sample Code Review
  • (14,172)網路上提供測試 RTSP 的伺服器
  • (23,895)Adding Something to DataGridView
  • (2,908)C# 在憑證存放區中找不到資訊清單簽署憑證
  • (4,399)安裝PLC學習軟體 FX-TRN-BEG-T
  • (7,367)建立和使用 C# 的 DLL
  • (3,660)安裝Open eVision 1.2.5.8549
  • (12,907)EmguCV : 圈選感興趣區域
  • (25,025)C# 如何創建, 暫停, 繼續, 終止一個執行緒(Thread)

文章分類

  • wordpress (2)
  • 雲端計算 (1)
  • 邊緣運算 (5)
  • MPI (2)
  • Git & Github (6)
  • Unity (2)
  • Android Studio (10)
  • Deep Leraning (35)
  • LaTex (2)
  • Linux (6)
  • jetson nano (3)
  • Qt (20)
  • Docker (4)
  • Office (1)
  • OpenTK (1)
  • WPF (8)
  • SQL (4)
  • Revit (6)
  • MATLAB (13)
  • R Language (8)
  • Design Pattern & Implementation by Using C# (48)
  • RaspberryPI (5)
  • Python (77)
  • 其他語言 (40)
  • 攝影機 (45)
  • 工業應用 (50)
  • 家庭 (12)
  • Mobile (31)
  • 工作日誌 (2)
  • Linux (5)
  • C/C++ (15)
  • AOI (41)
  • Emgu CV (42)
  • C# (147)
  • Visual Studio (48)
  • OpenCV (118)
  • 未分類文章 (1)

最新文章

  • git開分支測試完成後整併回原本的分支
  • Gemini API Key 低成本 Nano Banana Pro作圖
  • DMK 37AUX226
  • wafer基礎術語
  • 將資料夾中多個mp4影片合併成一個mp4檔案
  • 如何用沙子制造芯片:从冶炼硅锭到晶圆打磨|芯片工艺合集
  • yolov9安裝
  • ActionEngine, ActionTask and ActionWorker
  • @dataclass裝飾子
  • IO控制卡安裝驅動器後無法在此裝置載入驅動程式

動態訂閱

文章精選

文章搜尋

誰來我家

參觀人氣

  • 本日人氣:
  • 累積人氣: