Initial commit

This commit is contained in:
ChiKyun Kim
2025-07-17 16:11:46 +09:00
parent 4865711adc
commit 4a1b1924ba
743 changed files with 230954 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using Euresys.Open_eVision_2_11;
namespace Project
{
public partial class fMain
{
Int32[] _hDevice = new Int32[] { 0, 0, 0 };
Int32[] _width = new Int32[] { 0, 0, 0 };
Int32[] _height = new Int32[] { 0, 0, 0 };
Int32[] _stride = new Int32[] { 0, 0, 0 };
Int32[] _bufferSize = new Int32[] { 0, 0, 0 };
Boolean[] _isCrevisOpen = new bool[] { false, false, false };
Boolean[] _isCrevisACQ = new bool[] { false, false, false };
IntPtr[] _pImage = new IntPtr[] { IntPtr.Zero, IntPtr.Zero, IntPtr.Zero };
//IntPtr[] _vImage = new IntPtr[] { IntPtr.Zero, IntPtr.Zero, IntPtr.Zero };
arCtl.ImageBox[] ivs;
Bitmap[] OrgBitmap = null;
Image<Gray, byte>[] OrgImage = null;
//EImageBW8[] OrgEImage = null;
//Boolean bOpenEvisionReady = false;
void MakeBlankImage(int vIdx, int width=1024, int height=768, string title = "")
{
_width[vIdx] = width;
_height[vIdx] = height;
OrgBitmap[vIdx] = new Bitmap(_width[vIdx], _height[vIdx], PixelFormat.Format8bppIndexed);
SetGrayscalePalette(OrgBitmap[vIdx]);
var lockbit = OrgBitmap[vIdx].LockBits(new Rectangle(0, 0, _width[vIdx], _height[vIdx]), ImageLockMode.ReadOnly, OrgBitmap[vIdx].PixelFormat);
_pImage[vIdx] = lockbit.Scan0;
_stride[vIdx] = lockbit.Stride;
OrgBitmap[vIdx].UnlockBits(lockbit);
//if (bOpenEvisionReady)
//{
// //OrgEImage[vIdx] = new EImageBW8();
// //OrgEImage[vIdx].SetImagePtr(_width[vIdx], _height[vIdx], _pImage[vIdx]);
//}
//openCv 이미지 처리
OrgImage[vIdx] = new Image<Gray, byte>(_width[vIdx], _height[vIdx], _stride[vIdx], _pImage[vIdx]);
if (title.Equals("") == false)
{
CvInvoke.PutText(OrgImage[vIdx], title, new Point(50, 100), FontFace.HersheyDuplex, 2.0, new Gray(255).MCvScalar, 2);
}
}
private void SetGrayscalePalette(Bitmap bitmap)
{
ColorPalette GrayscalePalette = bitmap.Palette;
for (int i = 0; i < 255; i++)
{
GrayscalePalette.Entries[i] = Color.FromArgb(i, i, i);
}
bitmap.Palette = GrayscalePalette;
}
}
}