最近在處理Line-scan CCD取像, 想不到拼完圖後影像扭曲如此嚴重,只好派出Affine Transformations上場, 好險效果很不錯, 可以安心收工囉!! private Image<Bgr, byte> AffineTransform(Image<Bgr, byte> img)
{
PointF[] srcTri = new PointF[3];
PointF[] dstTri = new PointF[3];
Mat mat = new Mat(3,2, DepthType.Cv32F, 1);
// srcTri: 目前影像座標 dstTri: 修正後影像座標(理想座標/棋盤格)
//
srcTri[0] = new PointF(3800, 1179);
dstTri[0] = new PointF(3728, 1127);
srcTri[1] = new PointF(3106, 9407);
dstTri[1] = new PointF(3152, 9405);
srcTri[2] = new PointF(8492, 9410);
dstTri[2] = new PointF(8539, 9406);
mat = CameraCalibration.GetAffineTransform(srcTri, dstTri);
img = img.WarpAffine(mat, Inter.Area, Warp.Default, BorderType.Constant, new Bgr(0, 0, 0));
return img;
//mat = CvInvoke.GetAffineTransform(srcTri, dstTri);
}

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


參考資料1. c# write text on bitmap2. How to create 1024x1024 RGB bitmap image of white?3. encode opencv mat to gif using giflib4. How to save a .gif file with a new color table by using Visual C#

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

image

1. 電壓 0-電壓7為類比電壓信號檢測,檢測電壓信號範圍為0-10V;

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

image
專案名稱: EmguGPUExCUDA版本: cuda7.5.18 windows.exe for win7Emgu CV版本: emgucv-windows-universal-cuda 3.0.0.2158如果CUDA版本太舊,會顯示錯誤提示:windows cuda driver version is insufficient for cuda run time version解決方案, 升級到新的版本private void getCudeDeviceInfo()
{
CudaDeviceInfo cdi = new CudaDeviceInfo();
label2.Text = cdi.IsCompatible.ToString();
label4.Text = cdi.MultiProcessorCount.ToString();
label5.Text = cdi.Name;
label7.Text = cdi.TotalMemory.ToString();
}

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

image
專案名稱:MatStructureEx
using Emgu.CV;
using Emgu.CV.Structure;
using Emgu.CV.CvEnum;
using System.Runtime.InteropServices;
using System.Diagnostics;
using Emgu.CV.Util;

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

image
專案名稱: EmguMorphologyEx加入參考C:\Emgu\emgucv-windows-universal-cuda 3.0.0.2158\binEmgu.Util.dll Emgu.CV.dll Emgu.CV.UI.dllGetStructuringElementReturns a structing element of the specified size and shape for morpholigical operationsParameters shapeType: Emgu.CV.CvEnum.ElementShape
Element shape
ksizeType: System.Drawing.Size
Size of the structuring element.
anchorType: System.Drawing.Point
Anchor position within the element. The value (-1, -1) means that the anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor position. In other cases the anchor just regulates how much the result of the morphological operation is shifted.===============================================

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

image
專案名稱: SpeedUpPixelAcessMask: 通常為一張黑白圖片,也就是二值化圖片,用來擷取感興趣的物件(如膚色偵測)或是圖形去背利用這些黑白的圖片跟原始圖片做對應,白色255的部份為顯示出來的區域,黑色為0的部份為不顯示出來的區域,讀入一張彩色影像img1讀入一張遮罩影像mask將img1套用遮罩mask, 可以得到結果影像img2其中來源影像和遮罩影像大小必須一樣

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

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) 人氣()



最近在研究這篇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) 人氣()

image
MATLAB: peaks指令VTK上視圖VTK 3Dzoom in參考資料:VTK/Examples/CSharp/Meshes/Color a mesh by height

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

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) 人氣()

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) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。