针对你遇到的Halcon错误#3142,即“can not open file for writing in operator write_image”,以下是一些可能的解决步骤和建议: 确认文件路径和名称是否正确: 在使用write_image算子时,确保提供的文件路径和名称是准确无误的。例如: python write_image(Image, 'png', 0, 'C:/path/to/your/image.png') ...
zoom_image_size(Image,ImageZoom,4 * Width,4 * Height ,'constant') *创建指定区域 gen_rectangle1 (Rectangle, 36, 57, 189, 588) * 获取图片指定区域的图片 reduce_domain(ImageZoom,Rectangle,imgMask) * 根据阈值选取图像,筛选体积大的,数字越大体积越大,红色为选中 *threshold (Image, RawSegmentation...
在保存图像的时候遇到了如下问题,就是我在代码的另一处地方复制了保存图像代码: WriteImage(_inImg, "bmp", 0, "D:\\1.bmp"); 1. 发现在断点走到保存图像位置时,一直崩溃,后面我在自己使用英文输出法手动输出要保存图像的位置路径时,又可以正常保存了,感觉非常的困惑,有知道的大佬可以告诉一下,难道复制路...
把CString类型的字符串转换成utf8格式的试试,可以使用这个库https://www.51halcon.com/forum.php?mod...
write_image(Operator) Name write_image— Write images in graphic formats. Signature Description The operatorwrite_imagesaves the input imageImagein the fileFileNamein the formatFormat. If the domain (region) cannot be saved in the specifiedFormat(this is the case for 'bmp', 'jpeg', and 'ima...
FileName(input_control)filename.write(-array)→(string) Name of image file. File extension:.hobj, .ima, .tif, .tiff, .bmp, .jpg, .jpeg, .jp2, .jxr, .png If the parameter values are correct the operatorwrite_imagereturns the value 2 (H_MSG_TRUE). Otherwise an exception is raised...
第1个参数Image是输入变量,即图像数据 第2个参数Format是输入变量,即图像格式 第3个参数FillColor是输入变量,表示不属于图像区域的灰度像素填充值,默认值为0。 第4个参数FileName是输入变量,为保存图像的名字 例子: Hobject objamp; write_image(objamp,"bmp",-1,"f:\\gray.bmp"); ...
set_check("~give_error")和set_check("give_error")配合,开关Halcon自己的异常处理,自己获得错误返回值和在通过 get_error_text()获取错误文本信息; 直接上例子说用法,例如: 1Herror Rtn =H_MSG_TRUE;//正确的返回值2charchrErrorText[1024];34set_check("~give_error");//屏蔽5Rtn =write_image( hoI...
write_message (WindowHandle, 10, 10, 'Image '+Index+': Pattern to be tested was found ...