日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > ChatGpt >内容正文

ChatGpt

MFC Halcon WriteImage自动添加序号保存图片

發布時間:2024/1/18 ChatGpt 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MFC Halcon WriteImage自动添加序号保存图片 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
  • 環境:vs2019,Unicode,MFC,C++,Halcon
  • 代碼: #pragma once #include <afxwin.h> #include <iostream> #include <cstring> #include <string> #include <fstream> #include <direct.h> #include "HalconCpp.h" #include "HDevThread.h"bool CMy005MFCHalconDlg::SaveCaliImage() {bCapture = true;USES_CONVERSION;string strPath;std::ostringstream ostr;CString csIndex;CString csPath;CFileFind finder;BOOL bWorking = false;iSaveImgIndex = 0;strPath = "D:\\Img";csIndex.Format(_T("%02d"), iSaveImgIndex); // 格式化 00、01、02iSaveImgIndex = 1;strPath = strPath + "\\" + "calib_distorted_" + T2A(csIndex) + ".png";csPath = strPath.c_str();while (1){bWorking = finder.FindFile(csPath);if (bWorking){GetTxtValue("ImgSavePath", &strPath);csIndex.Format(_T("%02d"), iSaveImgIndex);++iSaveImgIndex;strPath = strPath + "\\" + "calib_distorted_" + T2A(csIndex) + ".png";csPath = strPath.c_str();}else{// string 轉 HTupelHTuple HTImgPath = strPath.c_str();WriteImage(ho_RealImage, "png", 0, HTImgPath);break;}}bCapture = false;return true; }

    ?

  • 說明:該代碼配合MFC中自定義的拍照按鈕使用,每點擊一次按鈕則保存一張圖片,保存的圖片格式為png,使用的WriteImage函數是Halcon的函數,圖片文件前綴為“calib_distorted_”,是根據圖片文件數量來命名圖片序號,如“calib_distorted_01.png”、“calib_distorted_02.png”、“calib_distorted_03.png”。
  • 總結

    以上是生活随笔為你收集整理的MFC Halcon WriteImage自动添加序号保存图片的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。