我想将图像对象从我的C#项目传递到我的python脚本,但是据我了解,无论参数中有什么,它都被认为是字符串,而且当我在python中尝试type(passedImage)
时,即使将其识别为字符串,即使我尝试输入数字而不是图像变量。
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = @"C:\Python\Python36\python.exe";
start.Arguments = string.Format("{0} {1}", @"C:\OCRonImage2.py", image );
start.UseShellExecute = false;
start.RedirectStandardOutput = true;
start.CreateNoWindow = true;
using (Process process = Process.Start(start))
{
}
我认为通过IMAGE
作为Argument
会很不好。
不错的选择:
您可以将图像另存为文件,放在本地计算机的某个位置,并为python程序提供读取图像的路径。
这是我认为您可以做的最简单的方法。