Problems loading a mesh with texture

I’m loading an .obj mesh with a texture in .png image file (Ignition Robotics) and visualize it with this code snippet:

  Mesh  mesh = Mesh::load("/home/paul/st/models/banana.obj", Mesh::LOAD_OBJ);
  Viz3d window{"Mesh"};

  mesh.texture = imread("/home/paul/st/models/banana.png", IMREAD_COLOR);

  window.setFullScreen();
  window.setBackgroundColor(Color::gray());
  window.showWidget("cs", WCoordinateSystem());
  window.showWidget("m", WMesh(mesh));
  window.resetCamera();
  window.spin();

The texture is badly applied:

bad-banana

Any idea what went wrong? The same pair of files: banana.obj and banana.png, renders fine with other applications.

Image memory layout provided by imread is not compatible with cv::viz or .obj requirements. Flipping the image around x-axis solves this problem:

  Mesh  mesh = Mesh::load("/home/paul/st/models/banana.obj", Mesh::LOAD_OBJ);
  Mat   tex, img = imread("/home/paul/st/models/banana.png", IMREAD_COLOR);
  Viz3d window{"Mesh"};

  flip(img, tex, 0);
  mesh.texture = tex;