I was primarily using the JavaCPP presets for OpenCV(JavaCV) and Tesseract
But I also found some references for C++
Here's what works for C++
#include <tesseract/baseapi.h>
#include <leptonica/allheaders.h>
#include <opencv2/opencv.hpp>
...
char imagename[] = "testimg.jpg";
cv::Mat _mat = cv::imread(imagename);
cv::cvtColor(_mat, _mat, CV_BGR2RGBA);
api.SetImage(_mat.data, _mat.cols, _mat.rows, 4, 4*_mat.cols);
char *outtext = api.GetUTF8Text();
...
Source: http://stackoverflow.com/a/38583706/1541263
For JavaCV, after hours of searching the web and debugging, this is what works
Mat img = imread("file.jpg");
Mat gray = new Mat();
cvtColor(img, gray, CV_BGR2GRAY);
// api is a Tesseract client which is initialised
api.SetImage(gray.data().asBuffer(),gray.size().width(),gray.size().height(),gray.channels(),gray.size1())
This is exactly what I also spent hours looking for. Thank you!