websdk解决纠偏失败的bug

This commit is contained in:
luoliangyi 2022-06-23 15:22:29 +08:00
parent a11f9c864d
commit 1d5a603ca7
3 changed files with 19 additions and 35 deletions

View File

@ -805,7 +805,7 @@ namespace ver_2
outImagePath.clear();
errInfo = "错误";
if (imagePath.empty() || width <= 0 || height <= 0)
if (imagePath.empty() || width < 0 || height < 0)
return -1;
int ret = -1;
@ -2870,21 +2870,21 @@ namespace ver_2
CURL* curl = curl_easy_init();
if (NULL != curl)
{
char tmpName[256];
HGBase_GetUuid(tmpName, 256);
//char tmpName[256];
//HGBase_GetUuid(tmpName, 256);
char remotePath[256];
HGBase_GetFilePath(remoteFilePath.c_str(), remotePath, 256);
char remoteName[256];
HGBase_GetFileName(remoteFilePath.c_str(), remoteName, 256);
char ftp_rnfr[512];
sprintf(ftp_rnfr, "RNFR %s", tmpName);
char ftp_rnto[512];
sprintf(ftp_rnto, "RNTO %s", remoteName);
//char ftp_rnfr[512];
//sprintf(ftp_rnfr, "RNFR %s", tmpName);
//char ftp_rnto[512];
//sprintf(ftp_rnto, "RNTO %s", remoteName);
struct curl_slist* headerlist = NULL;
headerlist = curl_slist_append(headerlist, ftp_rnfr);
headerlist = curl_slist_append(headerlist, ftp_rnto);
//struct curl_slist* headerlist = NULL;
//headerlist = curl_slist_append(headerlist, ftp_rnfr);
//headerlist = curl_slist_append(headerlist, ftp_rnto);
/* we want to use our own read function */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
@ -2895,18 +2895,18 @@ namespace ver_2
if (!user.empty() && !password.empty())
{
sprintf(url, "ftp://%s:%s@%s:%d%s%s", user.c_str(), password.c_str(),
host.c_str(), port, remotePath, tmpName);
host.c_str(), port, remotePath, remoteName);
}
else
{
sprintf(url, "ftp://%s:%d%s%s", host.c_str(), port, remotePath, tmpName);
sprintf(url, "ftp://%s:%d%s%s", host.c_str(), port, remotePath, remoteName);
}
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS, 1);
/* pass in that last of FTP commands to run after the transfer */
curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist);
//curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist);
/* now specify which file to upload */
curl_easy_setopt(curl, CURLOPT_READDATA, file);
@ -2926,7 +2926,7 @@ namespace ver_2
ret = 0;
/* clean up the FTP commands list */
curl_slist_free_all(headerlist);
//curl_slist_free_all(headerlist);
/* always cleanup */
curl_easy_cleanup(curl);

View File

@ -176,24 +176,6 @@ namespace ver_2
int x, int y, int width, int height, bool temp, std::string& outImagePath, std::string& errInfo);
// 图像方向校正
int LocalImageDirectionCorrect(const std::string& imagePath, bool temp, std::string& outImagePath, std::string& errInfo);
// 二值化
//int LocalImageBinarization(const std::string& imagePath, const std::string& type, int threshold, bool temp, std::string& outImagePath, std::string& errInfo);
// 通道提取
//int LocalImageExtractChannel(const std::string& imagePath, const std::string& type, bool temp, std::string& outImagePath, std::string& errInfo);
// 颜色识别
//int LocalImageColorRecognition(const std::string& imagePath, bool temp, std::string& outImagePath, std::string& errInfo);
// 除色散
//int LocalImageDispersion(const std::string& imagePath, bool temp, std::string& outImagePath, std::string& errInfo);
// 去底色
//int LocalImageFadeBkColor(const std::string& imagePath, bool temp, std::string& outImagePath, std::string& errInfo);
// 图像滤镜
//int LocalImageFilter(const std::string& imagePath, const std::string& type, bool temp, std::string& outImagePath, std::string& errInfo);
// 除穿孔
//int LocalImageOutHole(const std::string& imagePath1, const std::string& imagePath2, double borderSize,
// bool temp, std::string& outImagePath1, std::string& outImagePath2, std::string& errInfo);
// 色彩校正
//int ImageHSVCorrect(const std::string& imagePath, const std::string& option, bool cvtGray, const std::string& color,
// bool temp, std::string& outImagePath, std::string& errInfo);
// 设备初始化
int InitDevice(std::string& errInfo);

View File

@ -348,13 +348,15 @@
}));
}
function UploadLocalFile()
function FtpUpload()
{
socket.send(JSON.stringify({
'func':'upload_local_file',
'file_path':'D:\\1.jpg',
'remote_file_path':'/savedir/123.jpg',
'upload_mode':'ftp',
'remote_file_path':'/savedir/123.jpg'
'ftp_host':'192.168.100.148',
'ftp_port':21
}));
}
@ -832,7 +834,7 @@
<input type="button" value="设置全局参数" onclick="SetGlobalParam()" />
<input type="button" value="获取全局参数" onclick="GetGlobalParam()" />
<input type="button" value="清理保存目录" onclick="ClearGlobalSavePath()" />
<input type="button" value="上传本地文件" onclick="UploadLocalFile()" />
<input type="button" value="FTP上传" onclick="FtpUpload()" />
<input type="button" value="合成本地图像" onclick="MergeLocalImage()" />
<input type="button" value="本地合成多张图像" onclick="LocalMakeMultiImage()" />
<input type="button" value="拆分本地图像" onclick="SplitLocalImage()" />