node-opencv
node-opencv copied to clipboard
Segmentation fault on Matrix::Get() and Matrix::Pixel() + src documentation
My problem is two-fold. I'm attempting to provide some very simple typescript definition files to garner interest in further developing this code base. But documentation is severely lacking and I'm new to C++ binding in node. But I'm doing okay so far. Then I ran into an issue with using two functions on the Matrix class.
My understanding is that the get() and pixel() functions are intended to be used as follows:
mat.get(row, col); // get double pixel value at row height and col width
mat.pixel(row, col); // get rgb value at row height and col width
Therefore, I should be able to:
mat.get(mat.height() - 1, mat.width() - 1); // get the lower-right double value
mat.pixel(mat.height() - 1, mat.width() - 1); // get the lower-right pixel rgb value
Unfortunately, attempting this produced weird behavior. On the get() function, this produces a segmentation fault. On the pixel(), it does not, however, if you don't subtract 1 from mat.width() it still works, and this confuses me because I would expect that to segfault...
Could it be (col, row)? I haven't looked at the code in a while, but I assume we copy the opencv ordering.
I tried both ways and it caused a segmentation fault. Someone who knows the C-wrappers and opencv better than I is going to have to try to reproduce and debug. I'm just leaving this here for anyone in case they have the same issue or in case it helps reproduce. I'm guessing the bug is still there because hardly anyone one uses those functions anyway. So it might not be an issue anyway. Oh well! Such is javascript and open source.