当前位置:网站首页>文件无法保存(文件夹已损坏无法读取怎么办)
文件无法保存(文件夹已损坏无法读取怎么办)
2022-07-25 21:43:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
要使用EmguCV,首先需要去官网下载安装包(除了下载安装包,还有其他几种方式)。安装完成后,得配置环境变量。这里不再赘述。网上的教程很多。我这里分享一个官网的下载链接:https://sourceforge.net/projects/emgucv/files/emgucv/
这里使用窗体程序进行说明,首先新建个窗体
1.引用EmguCV的DLL:using Emgu.CV;using Emgu.CV.Structure;
把Emgu.CV.UI这个类库拖到工具箱中,这样,我们就可以使用他的控件了。往窗体上拖一个imageBox控件(EmguCV控件而不是.NET控件)两个按钮(普通按钮)。
窗体完整代码如下:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Mat img;
private void btnRead_Click(object sender, EventArgs e)
{
//方式一
img = CvInvoke.Imread("1000.jpg");
CvInvoke.Imshow("img", img);
CvInvoke.WaitKey(0);
//方式二
//Image<Bgr, Byte> img = new Image<Bgr, byte>("aa.jpg");//从文件加载图片
//imageBox1.Image = img;
}
private void btnSave_Click(object sender, EventArgs e)
{
//方式一
CvInvoke.Imwrite("new.jpg", img);
MessageBox.Show("保存成功");
//方式二
//imageBox1.Image.Save(@"D:\new.jpg");
}我使用了两种方式进行读取和保存。但是只有方法一可以正常运行。第二种方式程序在 imageBox1.Image = img;这句话卡死了。我目前还没找到原因。但是第二种方式亲测可用。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/127918.html原文链接:https://javaforall.cn
边栏推荐
- Special symbols in shell
- QT | learn about QT creator by creating a simple project
- 【Flink】FLink RocksDBListState 报错 You cannot add null to a ListState
- LeetCode_ 93_ Restore IP address
- 5、 Pinda general permission system__ PD tools XXS (anti cross site script attack)
- 【Redis底层解析】字符串类型
- [interview: concurrent 25: multithreading: volatile] visibility
- [MAIXPY]kpu: load error:2005, ERR_ READ_ File: read file failed problem solving
- 如何用 Redis 实现分布式锁的?
- 全志芯片bsp命名规则
猜你喜欢

Oxford University: many common insomnia drugs lack long-term safety data

字节一面:TCP 和 UDP 可以使用同一个端口吗?

Redis usage details

Bitcoin.com:USDD代表了真正去中心化稳定币

【Flink】FLink RocksDBListState 报错 You cannot add null to a ListState

How to implement distributed locks with redis?

人脸与关键点检测:YOLO5Face实战

Idea resolves the prompt of profile properties disappear

开源的RSS订阅器FreshRSS

Creation and destruction of function stack frames
随机推荐
What are the application characteristics of NTU general database gbase Bi?
[interview: concurrent Part 24: multithreading: comprehensive exercise] sequence control
Is there any document for synchronizing from Oracle to ODPs?
[MAIXPY]kpu: load error:2005, ERR_ READ_ File: read file failed problem solving
Pyqt5 use pyqtgraph to draw multiple y-value scatter plots
【leetcode天梯】链表 · 876 查找链表中间结点
字节一面:TCP 和 UDP 可以使用同一个端口吗?
【饭谈】那些看似为公司着想,实际却很自私的故事 (一:造轮子)
五、品达通用权限系统__pd-tools-xxs(防跨站脚本攻击)
立创EDA——我为什么要学EDA
【Redis底层解析】链表类型
如何快速搭建图片服务器[通俗易懂]
少儿编程 电子学会图形化编程等级考试Scratch一级真题解析(判断题)2022年6月
浅谈web性能优化(一)
腾讯云数据库的可信可控之路
Trusted and controllable way of Tencent cloud database
In depth understanding of seven specific ways to enhance code scalability
Unity metaverse (II), mixamo & animator hybrid tree and animation fusion
Excuse me, how to deal with repeated consumption of MySQL data
IJCAI2022开会了! 微软等《领域泛化Domain Generalization》教程