I have two viewboxes as shown below. The one on the left is a PGImageView. The one on the right is a PGGraphicsView. I used setXLink and setYLink to link the two viewboxes.
On the right viewbox, I use drawKernel (PGImageItem) to draw a kernel at the position of my mouse click within the viewbox.
In this example, I created a 5x5 kernel. This means that drawKernel was a 5x5 numpy array.
On the left viewbox, I use the coordinates associated with the boundary of the mask to draw an overlay. The problem is that the overlay is always smaller than the mask. A 5x5 kernel means the line segments that create the square span 5 numpy array indices.
However, the mask itself visually appears to span 6 numpy array indices. This means that for a kernel of a given size (N x N), the corresponding overlay will always be (N-1 x N-1). This becomes a big problem when working with complex masks, such as the one shown below.
As shown above, the overlay doesn't exactly match the mask. Any thoughts on how to solve this issue? Is there a better technique for taking a binary mask in one viewbox and creating an exact overlay in a different viewbox?
Thanks!
PaLab