Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6555 Discussions

No Grayscale in ov::preprocess::ColorFormat?

jrrw1
Beginner
1,349 Views

Hello, I am currently trying to deploy a cv model in C++ using Openvino API. 

My model only takes in grayscale images. When I set up my PrePostProcessor input preprocess, there is no grayscale in ov::preprocess::ColorFormat. This is confirmed in ColorFormat documentation. 

 

The code below is the correct way to do this with an RBG image, however I am unsure how to achieve this with grayscale, as GRAY is not supported in ov::preprocess::ColorFormat.  Any help is greatly appreciated!

 
// Inizialize Preprocessing for the model
ov::preprocess::PrePostProcessor ppp = ov::preprocess::PrePostProcessor(model);

// Specify input image format
ppp.input().tensor().set_element_type(ov::element::u8).set_layout("NHWC").set_color_format(ov::preprocess::ColorFormat::BGR);

// Specify preprocess pipeline to input image without resizing  
  ppp.input().preprocess().convert_element_type(ov::element::f32).convert_color(ov::preprocess::ColorFormat::RGB).scale({255., 255., 255.});
2 Replies
Wan_Intel
Moderator
1,255 Views

Hi Jrrw1,

Thanks for reaching out to us.

Input color format for preprocessing in OpenVINO™ Inference Engine C++ API are as follows:

  •   RAW
  •   RGB
  •   BGR
  •   RGBX
  •   BGRX
  •   NV12
  •   I420

 

For more information, please refer to the enum InferenceEngine::ColorFormat.

 

 

Regards,

Wan

 

0 Kudos
Wan_Intel
Moderator
1,134 Views

Hi Jrrw1,

Thanks for your question.

Please submit a new question if additional information is needed as this thread will no longer be monitored.

 

 

Regards,

Wan

 

0 Kudos
Reply