0
我有Python代码,将图像打开为灰度图,将图像转换为numpy浮点数组,对其执行大量数学运算,然后进行归一化并将其转换为二进制图像(每像素1位),再次将其保存到磁盘(PNG文件)。将图像转换为浮点数组并返回到.NET
我应该使用哪些.NET类(优选)来执行类似的操作?
下面是我的Python代码的一个子集:
im = Image.open(in_name)
a = numpy.asarray(im.convert('L'), dtype=float) ## implicit conversion to grayscale
## lots of element-wise arithmetical operations with 'a'
## and other similar-shaped arrays from other images
out_im = Image.fromarray(a.astype('uint8')).convert('1')
out_im.save(out_name)