资源简介
c++里通过opencv读取图片后考入内存传出指针给c#,并在picturebox里显示

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;
using System.IO;
using System.Drawing.Imaging;
namespace _1108_2
{
public partial class Form1 : Form
{
class CPPDLL
{
[DllImport(“dll.dll“ CharSet = CharSet.Ansi)]
public static extern unsafe byte* initZed( out int widthout int heightout int channels);
// public static extern unsafe Byte* initZed();
//[DllImport(“111.dll“ CharSet = CharSet.Ansi)]
//public static extern unsafe int initZed();
////[DllImport(“1107.dll“ CharSet = CharSet.Ansi)]
////public static extern unsafe int test();
//[DllImport(“1107.dll“ CharSet = CharSet.Ansi)]
//public static extern unsafe float* getImage();
////[DllImport(“111.dll“ CharSet = CharSet.Ansi)]
////public static extern unsafe int test();
}
public Form1()
{
InitializeComponent();
}
private float[] cross(float[] A float[] B float[] C)
{
float[] AB = new float[3];
float[] BC = new float[3];
AB[0] = B[0] - A[0];
AB[1] = B[1] - A[1];
AB[2] = B[2] - A[2];
BC[0] = C[0] - B[0];
BC[1] = C[1] - B[1];
BC[2] = C[2] - B[2];
float[] arr = new float[3];
float crs1 = AB[1] * BC[2] - AB[2] * BC[1];
float crs2 = BC[0] * AB[2] - BC[2] * AB[0];
float crs3 = AB[0] * BC[1] - AB[1] * BC[0];
arr[0] = crs1;
arr[1] = crs2;
arr[2] = crs3;
return arr;
}
private void Form1_Load(object sender EventArgs e)
{
// int key = CPPDLL.initZed();
}
public static Bitmap BytesToBmp(byte[] bmpBytes Size imageSize)
{
Bitmap bmp = new Bitmap(imageSize.Width imageSize.Height);
BitmapData bData = bmp.LockBits(new Rectangle(0 0 imageSize.Width imageSize.Height)
ImageLockMode.ReadWrite
PixelFormat.Format24bppRgb); //24bit rgb Format24bppRgb
// Copy the bytes to the bitmap object
System.Runtime.InteropServices.Marshal.Copy(bmpBytes 0 bData.Scan0 bmpBytes.Length);
bmp.UnlockBits(bData);
return bmp;
}
private void button1_Click(object sender EventArgs e)
{
unsafe
{
int width heightchannels;
byte * ptr_image_data ;
//byte image_data = new byte();
ptr_image_data = CPPDLL.in
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5921 2018-12-11 10:23 dll读取图片到c#\Form1.cs
文件 980 2018-12-11 10:26 dll读取图片到c#\MyDll.cpp
目录 0 2018-12-11 10:27 dll读取图片到c#\
相关资源
- VC6LineNumberAddin.dll
- 人脸识别(opencv_facedetect_v4l2)
- c#与西门子1500通讯
- 基于opencv的模板匹配代码
- opencv图片扫描以及校正
- opencv手部轮廓识别以及轨迹识别
- opencv2 3D标定.cpp
- 基于opencv漫水填充算法综合
- dll依赖文件检测工具
- delphi调用结巴分词DLL接口
- c++调用C# COM 参数是结构体数组
- opencv激光中心线的提取
- 大智慧365DLL插件设计
- OpenCV Computer Vision Application Programming
- 基于图割的图像分割OpenCV+MFC实现
- CTP上期技术平台API及C#封装更新到CT
- 识别魔方颜色
- opencv版俄罗斯方块源码
- VS2013 / MFC + OpenCV 2.4.9实现视频的播放
- 粒子滤波器+目标跟踪的C++实现,VS2
- 张平OpenCV算法精讲基于python和C++教材
- C#神思二代身份证读卡程序 demo
- c++ 源码通过dll启动应用程序exe
- 虹膜识别开源代码OSIRIS4.1基于opencv
- C#调用百度地图获取经纬度
- SpiderMonkey1.61.7 编译文件全部libdllh文件
- 03 C#与C++dll互相传递字符串.rar
- c# 华大HD900身份证阅读器操作类
- 即时通讯开发源码终极版C#.NETC++都有
- Sift特征点提取与匹配opencv库
评论
共有 条评论