I’m having trouble with bitwise_and, I’m getting some strange artefacts in the output image from the following code:
// remove the green background from the piece so we can overlay pieces without overlap
Mat transparentPieceMat = new Mat(piece.pieceMat.rows(), piece.pieceMat.cols(), CvType.CV_8UC4);
Imgproc.cvtColor(piece.pieceMat, piece.pieceMat, Imgproc.COLOR_BGR2BGRA);
Core.bitwise_and(piece.pieceMat, piece.pieceMat, transparentPieceMat, piece.pieceChromaMat);
As you can see, smaller images, like the one along the top, do not work, they have this strange artefact left behind after the operation, whereas larger images, like the one below, work perfectly fine.
Both of these images undergo exactly the same processes, the only difference being that one of them is rotated more than another, giving it a larger image size.
MRE required. none of these variables mean anything to me. I prefer MREs in python because that doesn’t require an IDE or a build system or any of that excrement. if you’re dealing with C#, be prepared for some friction. C# is not officially supported by OpenCV. primary support should be given by whatever project gives you the bindings.
think about what you’re doing. think about which arguments you’re passing. think about what a “mask” does.
you put your question in the python subforum. that’s not python code. best leave it uncategorized.