Skip to content

Instantly share code, notes, and snippets.

@immengineer
immengineer / Form1.cs
Created August 1, 2017 05:23
JAISDK Transport layer名取得サンプル
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Jai_FactoryDotNET;
namespace SimpleImageDisplaySample
@immengineer
immengineer / Form1.cs
Last active August 2, 2017 00:04
JAISDK 画像取込/停止
private void StartButton_Click(object sender, EventArgs e)
{
if (myCamera != null)
myCamera.StartImageAcquisition(true, 5);
}
private void StopButton_Click(object sender, EventArgs e)
{
if (myCamera != null)
myCamera.StopImageAcquisition();
@immengineer
immengineer / Form1.cs
Created August 2, 2017 00:29
JAISDK ChildWindow 画像取込
private void StartButton_Click(object sender, EventArgs e)
{
if (myCamera != null)
{
// Set the "Stretch flag"
myCamera.StretchLiveVideo = stretchCheckBox.Checked;
// Start the image acquisition with the picturebox windows handle. If the handle is IntPtr.Zero then a new window will be created
myCamera.StartImageAcquisition(true, 5, pictureBox1.Handle);
@immengineer
immengineer / Form1.cs
Created August 2, 2017 00:54
JAISDK ChildWindow Resize
private void Form1_Resize(object sender, EventArgs e)
{
// Here we need to resize the Child Window image display
if (myCamera != null)
{
Jai_FactoryWrapper.RECT newRectSize;
if (myCamera.StretchLiveVideo)
newRectSize = new Jai_FactoryWrapper.RECT(0, 0, pictureBox1.Width, pictureBox1.Height);
else
newRectSize = new Jai_FactoryWrapper.RECT(0, 0, Convert.ToInt32(myCamera.GetNode("Width").Max), Convert.ToInt32(myCamera.GetNode("Height").Max));
@immengineer
immengineer / Form1.cs
Last active August 7, 2017 02:36
JAISDK 画像データ取得 startボタン
private void StartButton_Click(object sender, EventArgs e)
{
if (myCamera != null)
{
// Set the "Stretch flag"
myCamera.StretchLiveVideo = stretchCheckBox.Checked;
// Set the NewImageDelegete, will be called for every image captured
myCamera.NewImageDelegate += new Jai_FactoryWrapper.ImageCallBack(HandleImage);
@immengineer
immengineer / Form1.cs
Created August 7, 2017 01:50
JAISDK 画像データ取得 stopボタン
private void StopButton_Click(object sender, EventArgs e)
{
if (myCamera != null)
{
myCamera.StopImageAcquisition();
StartButton.Enabled = true;
StopButton.Enabled = false;
stretchCheckBox.Enabled = true;
myCamera.NewImageDelegate -= new Jai_FactoryWrapper.ImageCallBack(HandleImage);
@immengineer
immengineer / Form1.cs
Created August 7, 2017 02:49
JAISDK 画像データ取得 前準備部分
namespace SimpleImageDisplaySample
{
public partial class Form1 : Form
{
// Main factory object
CFactory myFactory = new CFactory();
// Opened camera object
CCamera myCamera;
@immengineer
immengineer / Form1.cs
Created August 9, 2017 04:38
JAISDK 画像データ取得 実処理部分
void HandleImage(ref Jai_FactoryWrapper.ImageInfo ImageInfo)
{
Jai_FactoryWrapper.EFactoryError error = Jai_FactoryWrapper.EFactoryError.Success;
// Set Measurement area (100 x 100 Pixel)
m_MeasureRect.Left = 100;
m_MeasureRect.Top = 100;
m_MeasureRect.Right = 200;
m_MeasureRect.Bottom = 200;
@immengineer
immengineer / Form1.cs
Last active August 15, 2017 04:58
JAISDK PixelFormatを指定して画像取得 前準備
namespace SimpleImageDisplaySample
{
public partial class Form1 : Form
{
// Main factory object
CFactory myFactory = new CFactory();
// Opened camera object
CCamera myCamera;
@immengineer
immengineer / Form1.cs
Last active August 15, 2017 04:54
JAISDK PixelFormatを指定して画像取得 PixelFormatの一覧取得
private void GetPixelFormat()
{
if (null == myCamera)
{
return;
}
if (comboBox1.Items.Count > 0) comboBox1.Items.Clear();
myPixelFormatNode = myCamera.GetNode("PixelFormat");