Java BufferedImage в переполнении стека

Я перевожу с Java на C ++ проект OpenCV для университета. Я ищу способ перевести Java BufferedImage в C ++.

Можно ли как-то перевести этот класс в C ++?

Я смотрю на проблему под неправильным углом, и я должен использовать объекты OpenCV, такие как IplImage или же Mat?

Я перевожу проект, который конвертирует бумажный график в цифровую форму. Я публикую основную функцию Java, чтобы сделать пример:

    String name = "";
IplImage greyScaleGraph = null;
// open up standard input
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out
.println("Insert the name of an image from the Input Folder (ex graph.png):");
String input = null;
try {
input = br.readLine();
} catch (IOException ioe) {
System.out.println("IO error trying to read the input");
}
if (input != null) {
if (input.contains("."))
name = input.substring(0, input.lastIndexOf('.'));
else
name = input;

greyScaleGraph = ImageManager.loadGreyscaleImage(PATH + input);
if (greyScaleGraph == null) {
System.err.println("No image with that name found");
System.err.println("--- exit ---");
System.exit(0);
}
}

// IplImage greyScaleGraph = ImageManager.loadGreyscaleImage(PATH + NAME
// + EXTENSION);
ImageManager.ShowImage(greyScaleGraph, "GreyGraph", 512);

// alternativa di openCV per la binarizzazione:
IplImage bWImage = cvCreateImage(cvGetSize(greyScaleGraph),
IPL_DEPTH_8U, 1);
cvThreshold(greyScaleGraph, bWImage, 127, 255, CV_THRESH_OTSU);
bWImage = Utility.reverse(bWImage);
// IplImage bWImage = OtsuBinarize.otsuBinarize(greyScaleGraph);

// cvReleaseImage(greyScaleGraph);

IplImage result = ZhangSuenThinning.thinning(bWImage.asCvMat())
.asIplImage();
ImageManager.ShowImage(result, "Result after thinning", 512);

IplImage houghLinesImage = HoughLines.houghLines(result,
"probabilistic");
ImageManager.ShowImage(bWImage, "bWImage", 512);
ImageManager.ShowImage(houghLinesImage, "houghLinesImage", 512);

IplImage noAxisImage = AxisManipulator.deleteAxis(result.clone(),
houghLinesImage);
// ImageManager.ShowImage(noAxisImage, "noAxisImage", 512);

ConnectedComponents.findConnectedComponents(noAxisImage.clone(),
"Connected Components");

TicksFinder.FindTicks(noAxisImage);

SymbolsFinder.connectedComponentsAnalysis(bWImage);

SymbolsFinder.groupMinus();
SymbolsFinder.groupParenthesis();
TicksFinder.tickNumberCoupleFinder();

IplImage symbolsImage = IplImage.createFrom(Utility.reverse(result
.getBufferedImage()));
SymbolsFinder.printSymbols(symbolsImage);

SVGCreator.createSVG(name);

0

Решение

Задача ещё не решена.

Другие решения