将图像转换为 numpy.net 数组

问题描述

如何在 c# 中将图像转换为 numpy.array,目前我正在使用下面的代码,但在运行时显示 ConvertArrayTondarray 中尚不支持类型 System.Drawing.Image[]

public static async Task<IEnumerable<V>> ForEachAsync<T,V>(this IEnumerable<T> source,int degreeOfParallelism,Func<T,Task<V>> body,CancellationToken token,[Optional] int delay)
{
    var whenAll = await Task.WhenAll(
        from partition in Partitioner.Create(source).GetPartitions(degreeOfParallelism)
        select Task.Run(async delegate {
            var allResponses = new List<V>();
            using (partition)
                while (partition.MoveNext())
                {
                    allResponses.Add(await body(partition.Current));
                    await Task.Delay(TimeSpan.FromSeconds(delay));
                }
            return allResponses;
        },token));
    return whenAll.SelectMany(x => x);
}

我试图转换为 C# 的类似 python 代码如下

var image_array = np.asarray<Image>(new[] { imagetoTest });

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)