SciSharp / NumSharp

High Performance Computation for N-D Tensors in .NET, similar API to NumPy.
https://github.com/SciSharp
Apache License 2.0
1.38k stars 192 forks source link

load depth images to an NDArray #400

Closed JoeHRIsaac closed 4 years ago

JoeHRIsaac commented 4 years ago

I'm using the NumSharp Lite version along with Tensorflow.NET. I would like to get a set of images in an NDArray and the feed to Tensorflow. Since I am using netstandard 2.0, I can't use system.drawing.common as it shows an error. I need to read the file and make it to an NDArray without using Bitmap (I tried adding the necessary libraries but it messes up the dependencies of TensorFlow)

The images are depth images which are 640 x 480 and 16bit I have this much so far:


string[] files = Directory.GetFiles("H:/Documents/Datasets/BigHand/Subject_1/1_75/", "*.png");
NDArray traindata = new NDArray(np.float32, new Shape(new int[] { files.Length, 480, 640 }));
foreach (var file in files)
{
    NDArray image = load(Path.Combine("H:/Documents/Datasets/BigHand/Subject_1/1_75/", file)) //Need this function
    traindata.append(image)
}
Oceania2018 commented 4 years ago

@JoeHRIsaac Please use SharpCV to address it.