我正在使用Microsofot图像合成引擎(ICE)的StitchEngine.dll来尝试在c#中将图像拼接在一起。我正在尝试使用以下方法导出结果图像:
StartExporting(string, System.ValueType, Microsoft.Research.ICE.Stitching.OutputOptions, bool)此方法的说明提供了:
public bool StartExporting(string *filename*, System.ValueType *cropRectangle*, float *scale*, Microsoft.Research.ICE.Stitching.OutputOptions *outputOptions*, bool *showCompletion*.当我尝试调用该方法时,我得到了一个InvalidCastException,声明指定的强制转换无效。
我正在做以下工作:
Microsoft.Research.ICE.Stitching.OutputOptions outOpt = new Microsoft.Research.ICE.Stitching.OutputOptions(Microsoft.Research.ICE.Stitching.ExportFormat.JPEG, 75, false, false, false);
var valTyp = new Rectangle(0, 0, 500, 1280);
StartExporting(myFilename, valTyp, outOpt, false);有人知道我该怎么纠正这个问题吗?
发布于 2018-07-31 01:43:36
正如Hans Passant向我展示的那样,正确的类型是System.Windows.Int32Rect。这需要添加WindowsBase作为引用。
https://stackoverflow.com/questions/51597125
复制相似问题