Tensorflow.js tf.browser.fromPixels() Function
Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment.
The tf.browser.fromPixels() function is used to creates a Tensor of pixels values of an specified image.
tf.browser.fromPixels (pixels, numChannels)
Parameters: This function accepts two parameters which are illustrated below:
- pixels: It is the pixels of the input image from which the Tensor is going to be constructed. The supported image types are all 4-channel.
- numchannels: It is the number of channels of the output Tensor. It’s default value is 3 and the upper limit is up to 4.
Return Value: This function returns the created Tensor of pixels values of the specified image.
Tensor [[[5, 10, 15], [0, 0 , 0 ]], [[0, 0 , 0 ], [0, 0 , 0 ]]]
Tensor [ [[5, 10, 15, 20],]]