Joshua Wilkinson
Joshua Wilkinson

Reputation: 143

Convert a 3D Tensor back into an image (jpg/png)

I want to use the Tensorflow Camera component which returns a Tensor3D for each frame of the camera preview. This is great for live classification with tensorflow models, however, I want to be able to convert this tensor back into a jpg or image format to be used with an OCR library like Tesseract.

Is there any way to convert a <tf.Tensor3d> into a more traditional image format for general use ?

Upvotes: 1

Views: 880

Answers (1)

yudhiesh
yudhiesh

Reputation: 6819

You can either use tf.node.encodeJpeg or tf.node.encodePng but they require that the 3D Tensor passed in is of type uint8.

Upvotes: 1

Related Questions