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/機器視覺)

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

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 11月 28 週二 202309:46
  • 同步播放兩支影片

今天測試同步播放兩支影片






 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89



using System;
using System.Threading;
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using System.Windows.Forms;

namespace WaferPositioning
{
// 同時播放兩支影片
public class DualVideoPlayer
{
private VideoCapture capture1;
private VideoCapture capture2;
private ManualResetEvent pauseEvent = new ManualResetEvent(true);
private bool stopThreads = false;

public event EventHandler<FrameReadyEventArgs> FrameReady;

public DualVideoPlayer(string videoFile1, string videoFile2)
{
capture1 = new VideoCapture(videoFile1);
capture2 = new VideoCapture(videoFile2);
}

public void Start()
{
stopThreads = false;
pauseEvent.Set(); // Resume if paused
ThreadPool.QueueUserWorkItem(o => StartVideoPlayback());
}

public void Pause()
{
pauseEvent.Reset(); // Pause playback
}

public void Resume()
{
pauseEvent.Set(); // Resume playback
}

public void Stop()
{
stopThreads = true;
pauseEvent.Set(); // Resume if paused
}

private void StartVideoPlayback()
{
while (!stopThreads)
{
pauseEvent.WaitOne(); // Pause if signaled

Mat frame1 = new Mat();
Mat frame2 = new Mat();

// Read frames from the video captures
capture1.Read(frame1);
capture2.Read(frame2);

if (!frame1.IsEmpty && !frame2.IsEmpty)
{
FrameReady?.Invoke(this, new FrameReadyEventArgs(frame1, frame2));
}
else
{
// End of video, you may want to stop or loop the playback
capture1.Set(CapProp.PosFrames, 0);
capture2.Set(CapProp.PosFrames, 0);
}
Thread.Sleep(33);
Application.DoEvents(); // Allow UI events to be processed
}
}
}

public class FrameReadyEventArgs : EventArgs
{
public Mat Frame1 { get; }
public Mat Frame2 { get; }

public FrameReadyEventArgs(Mat frame1, Mat frame2)
{
Frame1 = frame1;
Frame2 = frame2;
}
}
}





(繼續閱讀...)
文章標籤

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

  • 個人分類:C#
▲top
  • 11月 20 週日 202211:12
  • 安裝Log4net,每分鐘生成一個日誌文件



編輯應用程式 App.config

 
(繼續閱讀...)
文章標籤

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

  • 個人分類:C#
▲top
  • 9月 26 週一 202220:18
  • Download .NET SDKs for Visual Studio


 
下載 .NET 7.0 x64
(繼續閱讀...)
文章標籤

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

  • 個人分類:C#
▲top
  • 9月 13 週一 202110:14
  • A Simple C# window form Application using SQLite and Dapper


nuGet管理套件安裝
1. SQLite
(繼續閱讀...)
文章標籤

me1237guy 發表在 痞客邦 留言(1) 人氣(138)

  • 個人分類:C#
▲top
  • 12月 06 週五 201910:06
  • 偏好隱含型別的區域變數

image

 1: static void Main(string[] args)
 2: {
 3: var v1 = f1();
 4: var avg1 = v1 / 3;
 5: Console.WriteLine($"{avg1.GetType().Name}, avg: {avg1}");
 6:  
 7: var v2 = f2();
 8: var avg2 = v2 / 3;
 9: Console.WriteLine($"{avg2.GetType().Name}, avg: {avg2}");
 10:  
 11: var v3 = f3();
 12: var avg3 = v3 / 3;
 13: Console.WriteLine($"{avg3.GetType().Name}, avg: {avg3}");
 14:  
 15: var v4 = f4();
 16: var avg4 = v4 / 3;
 17: Console.WriteLine($"{avg4.GetType().Name}, avg: {avg4}");
 18:  
 19: var v5 = f5();
 20: var avg5 = v5 / 3;
 21: Console.WriteLine($"{avg5.GetType().Name}, avg: {avg5}");
 22: Console.ReadKey();
 23: }
 24: static double f1()
 25: {
 26: double x = 100;
 27: return x;
 28: }
 29: static float f2()
 30: {
 31: float x = 100;
 32: return x;
 33: }
 34: static decimal f3()
 35: {
 36: decimal x = 100;
 37: return x;
 38: }
 39: static long f4()
 40: {
 41: long x = 100;
 42: return x;
 43: }
 44: static Int32 f5()
 45: {
 46: Int32 x = 100;
 47: return x;
 48: }
(繼續閱讀...)
文章標籤

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

  • 個人分類:C#
▲top
  • 9月 19 週四 201910:07
  • C# Create a Bitmap from a IntPtr

C# call a c++ method, which is called GetSourceImage(…)The following is the way how we get the bitmap data by copying srcBmpData to dstBmpdata, and showing them on a pictureBox.The copy sequence is just the same as OpenCV BGR, it looks as though we create a Format32bppArgb image. ,
 1: this.Invoke((MethodInvoker)delegate
 2: {
 3: int width, height, channel, step;
 4: unsafe
 5: {
 6: byte* srcBmpData = cVideo.GetSourceImage(&width, &height, &channel, &step);
 7: Result_lbl.Text = $"{width},{height},{channel},{step}";
 8: Bitmap bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
 9: var data = bmp.LockBits(new Rectangle(0, 0, width, height),
 10: System.Drawing.Imaging.ImageLockMode.WriteOnly,
 11: System.Drawing.Imaging.PixelFormat.Format32bppRgb);
 12: byte* dstBmpData = (byte*)data.Scan0.ToPointer();
 13: int hei = height;
 14: int wid = width;
 15: int stepsize = step;
 16: 
 17:  
 18: for (int y = 0; y < height; y++)
 19: {
 20: for (int x = 0; x < width; x++)
 21: {
 22: dstBmpData[y * width * 4 + 4 * x] = srcBmpData[y * step + channel * x];
 23: dstBmpData[y * width * 4 + 4 * x + 1] = srcBmpData[y * step + channel * x + 1];
 24: dstBmpData[y * width * 4 + 4 * x + 2] = srcBmpData[y * step + channel * x + 2];
 25: }
 26: }
 27: bmp.UnlockBits(data);
 28: pictureBox1.Image = bmp;
 29: }

30: });


(繼續閱讀...)
文章標籤

me1237guy 發表在 痞客邦 留言(0) 人氣(1,093)

  • 個人分類:C#
▲top
  • 9月 08 週日 201921:13
  • 多執行緒與非同步執行

以下根據 DKTD-WinFormThreading 文章節錄重點
1.自己建立thread優點: 精確管理thread生命週期缺點: 執行緒數目過多時
,CPU會耗費太多的資源處理Context Switching
(繼續閱讀...)
文章標籤

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

  • 個人分類:C#
▲top
  • 3月 21 週四 201910:41
  • 列舉(枚舉)值看作位標記

image

 1:  
 2: enum Animal
 3: {
 4: Dog = 0x0001,
 5: Cat = 0x0002,
 6: Duck = 0x0004,
 7: Chicken = 0x0008
 8: }
 9: static void Main(string[] args)
 10: {
 11: Animal animals = Animal.Dog | Animal.Cat;
 12: Console.WriteLine(animals.ToString());
 13: Console.ReadKey();
 14: }
(繼續閱讀...)
文章標籤

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

  • 個人分類:C#
▲top
  • 3月 21 週四 201909:50
  • [C#.NET] 定義常數時用 readonly 好? 還是 const 好?

先說結論:  readonly比較不會出錯,一般狀況新版的dll蓋過去就好,但如果是const狀況,須將整個專案重新編譯,才不會出錯!
參考資料:[C#.NET] 定義常數時用 readonly 好? 還是 const 好?
(繼續閱讀...)
文章標籤

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

  • 個人分類:C#
▲top
  • 2月 27 週三 201915:38
  • C# Serialization &amp; Deserialization

Serialization is used to write class objects to files.[1] De-Serialization is used to recover the objects from the file.
When we want to transport an object through network then we have to convert the object into a stream of bytes.[2] The process of converting an object into a stream of bytes is called Serialization. For an object to be serializable, it should implement ISerialize Interface. De-serialization is the reverse process of creating an object from a stream of bytes.
參考資料:1. C# Serialization & Deserialization with Example
(繼續閱讀...)
文章標籤

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

  • 個人分類:C#
▲top
12...15»

個人資訊

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,170)網路上提供測試 RTSP 的伺服器
  • (23,895)Adding Something to DataGridView
  • (2,907)C# 在憑證存放區中找不到資訊清單簽署憑證
  • (4,385)安裝PLC學習軟體 FX-TRN-BEG-T
  • (7,366)建立和使用 C# 的 DLL
  • (3,658)安裝Open eVision 1.2.5.8549
  • (12,906)EmguCV : 圈選感興趣區域
  • (25,024)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)

最新文章

  • Gemini API Key 低成本 Nano Banana Pro作圖
  • DMK 37AUX226
  • wafer基礎術語
  • 將資料夾中多個mp4影片合併成一個mp4檔案
  • 如何用沙子制造芯片:从冶炼硅锭到晶圆打磨|芯片工艺合集
  • yolov9安裝
  • ActionEngine, ActionTask and ActionWorker
  • @dataclass裝飾子
  • IO控制卡安裝驅動器後無法在此裝置載入驅動程式
  • How you put and then get items from a queue.Queue

動態訂閱

文章精選

文章搜尋

誰來我家

參觀人氣

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