Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

working hit-or-miss implementation

$
0
0
I need an implementation of hit-or-miss transform done in OpenCV. Searching the internet, all I found is [this program on opencv-code.com](https://opencv-code.com/tutorials/hit-or-miss-transform-in-opencv/). The implementation, however, is broken. As an example, take the kernel 0 0 0 0 1 0 0 0 0 That is, a one in the middle and don't-cares everywhere else. The expected behaviour would be to simply copy the input image and that's what the MATLAB function `bwhitmiss` does. The provided snippet, however, zeros a few values. Original: [0, 0, 0, 0, 0, 0, 0, 0; 0, 1, 1, 1, 0, 0, 0, 0; 0, 1 , 0, *1*, 0, 0, 0, 1; 0, 1, *1*, 1, 0, 1, 0, 0; 0, 0 , 1, 0, 0, 0, 0, 0; 0, 0, 1, 0, 0, 1, 1, 0; 0, 1, 0, *1*, 0, 0,*1*, 0; 0, 1, *1*, 1, 0, 0, 0, 0] Hit-and-miss result: [0, 0, 0, 0, 0, 0, 0, 0; 0, 1, 1, 1, 0, 0, 0, 0; 0, 1, 0, *0*, 0, 0, 0, 1; 0, 1, *0*, 1, 0, 1, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 1, 0, 0, 1, 1, 0; 0, 1, 0, *0*, 0, 0,*0*, 0; 0, 1, *0*, 1, 0, 0, 0, 0] Does someone have an idea for a fix?

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>