每次读取目录文件夹的一张图片并保存为数组。
若图片为灰度图,保存的图片数组维度为原图的长乘宽;若图片为RGB三通图,保存的图片数组维度为原图的长乘3乘宽。在scan过程中,会产生bmp.Stride!=bmp.Width的情况,若重组为numpy数组,需要考虑偏差即bmp.Stride-bmp.Width。若图片宽度为4的倍数则不用考虑偏差问题。
若读取的图片为彩色图片,即rgb形式读取,读取后的一维数组为[last_channel_pixel_1,middle_channel_pixel_1,first_channel_pixel_1,last_channel_pixel_2,middle_channel_pixel_2,first_channel_pixel_2,…]以此类推
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
namespace ai_test
{
class Program
{
static void Main(string[] args)
{
byte[] img;
byte[] img_authentic_grey;
byte[] img_authentic_rgb;
//
//图片预处理,将一张图片记为nparray
//
string path = @"C:\Users\18367\Desktop\corner_tes