adamgf/react-native-opencv3

getMatData Error on a few openCV methods

wanjey opened this issue · 1 comments

I get a 'Mat data type is not compatible' error when I try to use getMatData on any Mat that has been passed through an openCV function, except for after invoking Hough Circles.

I've tried the Hough Circles example which uses getMatData after invoking Hough Circles and it works well, but if you try to use getMatData a step before, after invoking GaussianBlur, it will throw that error.

For my use, I am running the following methods:

    RNCv.invokeMethod('blur', {"p1": interMat,"p2": interMat,"p3": blurKernalSize})
    RNCv.invokeMethod('dilate', {"p1": interMat, "p2": interMat, "p3": element, "p4": anchor, "p5": iterDilation})
    RNCv.invokeMethod('erode', {"p1": interMat, "p2": interMat, "p3": element, "p4": anchor, "p5": iterErode})
    RNCv.invokeMethod('Canny', {"p1": interMat,"p2": finalMat,"p3": cannyLow, "p4": cannyHi, "p5": 3})
    const temp = await RNCv.getMatData(finalMat, 0, 0)

The last line will always throw an error. Without it, the image renders well and displays, but I need to get the data.

I saw in the MatManager.java for getMatData() that you have a "TODO: get this to work for different data types checking CvType," does that mean this is a known problem? Is there a workaround I can use for now?

Thanks in advance!

Hi Wanjey I do not really know the answer to your question. If you want to add some more types I just added you as a collaborator. Feel free to make any edits and commit your changes to the master branch. Best regards, Adam