用rename()函数实现了多次点击抓拍,实时显示用了halcon的多线程。
//抓拍并存储
int index = 0;
void Cdemo2Dlg::OnBnClickedCancel2()
{
// TODO: 在此添加控件通知处理程序代码
//要读取的文件夹路径
WriteImage(ho_Image, "jpeg", 0, "D:/Desktop/MyPrj/test2/temp/111.jpg");
string newFilePath("D:\\Desktop\\MyPrj\\test2\\image\\"); //重新写到这个文件夹中
//int index = 0;
char t_str1[100];
_itoa_s(index,t_str1,10); //将i转换为图像命名的一部分
string str(t_str1);
string sNewName1 = newFilePath + str + ".jpg";
rename("D:\\Desktop\\MyPrj\\test2\\temp\\111.jpg",sNewName1.c_str());
index++;
}
拍摄显示网上太多就不贴了
halcon源代码及整个程序的代码如下:
https://download.csdn.net/download/ly117626/10536164