asp.net调用opencv类库,实现图像处理显示
 
  ​      原理上来说,通过dll的调用,无论是asp.net还是winform都可以调用opencv及其类库。但是在实现的过程还是有许多细节是经过摸索和总结才得到结果的。作为界面显示的方法,asp.net的网页界面和winform的传统界面应该说是各有所长,应当灵活运用。这里是我如何采用asp.net调用opencv类库,实现图像处理显示的小结。
        一、主要过程
        我这里阐述的是最方便、最容易操作的过程,但不一定是最科学的过程
        1)将以GOIMAGE.DLL为主体的,和其支持库,全部拷贝到system32文件夹下
       
       
         在代码中显示引用库文件
       const string dllpath = "GOImage.dll";
    [DllImport(dllpath,
    EntryPoint = "getgray",
    CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
    public static extern int getgray(string ImagePath, string ImagePath_Res, ref int errcode);
 
 
    [DllImport(dllpath,
    EntryPoint = "getgreen",
    CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
    public static extern int getgreen(string ImagePath, string ImagePath_Res, ref int errcode);
     2)编写具体的引用代码
        //网页调用opencv类库,实现图像处理
// jsxyhelu 2015年3月31日
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Runtime.InteropServices;
public partial class _Default : System.Web.UI.Page
{
 
    [DllImport("GOImage.dll",
    EntryPoint = "getgreen",
    CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
    public static extern int getgreen(string ImagePath, string ImagePath_Res, ref int errcode);
    //结果是成功的。
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        //返回值
        int iret = 0;
        int ierror = 0;
        string strresult = "错误";
        //图片输出位置
        string strOutput = Server.MapPath(@"~/imgs/result.jpg");
        //获得输入图片地址
        string strInput = TextBox1.Text.ToString();
        //进行处理
        iret = getgreen(strInput, strOutput, ref ierror);
        //输出结果
        Image1.ImageUrl = strOutput;
        if (0==iret)
        {
            strresult = "正常";
        }
        else if (1==iret)
        {
            strresult = "干旱";
        }
        else
        {
            strresult = "虫蛀";
        }
        tbresult.Text = "当前的图像类型为" + strresult;
    }
}
 
        二、注意事项
       在调用的时候,一定要把所有的相关的dll全部拷贝过去,否则会报看不懂的错误。

asp.net调用opencv类库,实现图像处理显示的更多相关文章

  1. Atitit 图像处理 调用opencv 通过java  api   attilax总结

    Atitit 图像处理 调用opencv 通过java  api   attilax总结 1.1. Opencv java api的支持 opencv2.4.2 就有了对java api的支持1 1. ...

  2. Asp.Net MVC ajax调用 .net 类库问题

    如果你还在为 ajax 调用 .net 类库还束手无策的话,相信这篇博客将帮助你解决这个世纪问题! 因为Visual Studio 内置了asp.net mvc ,不过当你添加asp.net mvc项 ...

  3. C#调用opencv

    最经做一个项目,底层调用openCV编写的图像处理程序,用户界面采用C#编写. 于是学习了相关技术,总结如下: C#编写的是托管代码,编译生成微软中间语言,而普通C++代码则编译生成本地机器码,这两种 ...

  4. 基于Opencv的简单图像处理

    实验环境 本实验均在笔记本电脑完成,电脑的配置如表1所示: 系统 Windows 10 家庭版 处理器 英特尔 Core i5-6200 @ 2.30GHz 双核 主板 宏碁 Zoro_SL 内存 1 ...

  5. matlab和C/C++混合编程--调用opencv

    最近的我们已经将整个项目搭起来了,项目比较复杂.由于我们做的是检索系统,所以我们用asp.net(c#)做了网页,但是算法的实现是在matlab下,所以我们不得不用matlab生成动态链接库dll,然 ...

  6. ASP.NET调用Web Service

    1.1.Web Service基本概念 Web Service也叫XML Web Service WebService是一种可以接收从Internet或者Intranet上的其它系统中传递过来的请求, ...

  7. csharp通过dll调用opencv函数,图片作为参数

    [blog 项目实战派]csharp通过dll调用opencv函数,图片作为参数          ​一直想做着方面的研究,但是因为这个方面的知识过于小众,也是由于自己找资料的能力比较弱,知道今天才找 ...

  8. matlab调用opencv函数的配置

    环境: VS2010 活动解决方案平台x64 WIN 8.1 Opencv 2.4.3 Matlab 2012a 1.  首先保证vs2010能正确调用opencv函数, 2.  Matlab中选择编 ...

  9. OpenCV4Android开发之旅(一)----OpenCV2.4简介及 app通过Java接口调用OpenCV的示例

    转自:  http://blog.csdn.net/yanzi1225627/article/details/16917961 开发环境:windows+ADT Bundle+CDT+OpenCV-2 ...

随机推荐

  1. JS选中清空

    var inputArray = document.getElementsByTagName("input"); var strArray = []; ; i < input ...

  2. LeetCode - Customers Who Never Order

    Description: Suppose that a website contains two tables, the Customers table and the Orders table. W ...

  3. 重构(Refactoring)技巧读书笔记(General Refactoring Tips)

    重构(Refactoring)技巧读书笔记 之一 General Refactoring Tips, Part 1 本文简要整理重构方法的读书笔记及个人在做Code Review过程中,对程序代码常用 ...

  4. ubuntu下nginx编译安装

    安装依赖库: sudo apt-get install libgd2-xpm sudo apt-get install libgd2-xpm-dev sudo apt-get install libg ...

  5. 解决:Bitmap too large to be uploaded into a texture exception

    前几天拿锤子手机做测试,启动页面的闪屏直接黑屏.. 所以看下日志,百度一下 找到解决方案,特此记录. 简单说就是硬件加速的时候,对图片的大小有限制.不同设备可能有不同的最大值.这个问题悲催的地方是,程 ...

  6. jquery收集表单数组及去掉字符串最后的逗号!

    jquery收集表单数组: <input type='text' name='one[]' value='' /><br> <input type='text' name ...

  7. onethink重新安装,提示已安装过解决办法!

    onethink完全重新安装的时候提示已安装过,直接跳过数据库安装的解决办法 首先:删除根目录下 Data目录下的 install.lock 文件,然后: 打开\Application\Install ...

  8. php 自带的过滤函数和转义函数

    函数名 释义 介绍 htmlspecialchars 将与.单双引号.大于和小于号化成HTML格式 &转成&"转成"' 转成'<转成<>转成> ...

  9. SQL的子查询操作

    对于表中的每一个记录,我们有时候需要提取特殊的或者你需要的记录,要提前做一个表的筛选,之后再对你选出的记录做一个修改,此时你必须使用SQL的子查询操作.如:修改id=5的记录的strContent字段 ...

  10. HDU_3486_Interviewe

    Interviewe Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...