Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use_pin_hole (x,y) vs (y,x) #115

Open
Kimhasen opened this issue Jun 3, 2024 · 1 comment
Open

use_pin_hole (x,y) vs (y,x) #115

Kimhasen opened this issue Jun 3, 2024 · 1 comment

Comments

@Kimhasen
Copy link

Kimhasen commented Jun 3, 2024

I had problems with the use_pin_hole option. It worked fine on the test data but not on some real world data (kidney segmentations)
I figured the test data was symmetric on y=x.

The problem seems to come from image_help.py, def draw_line_upwards_from_point.

I had to make some changes to (x,y) to (y,x) and back, to get it working on my data.

def draw_line_upwards_from_point(
mask: np.ndarray, start, fill_value: int
) -> np.ndarray:
line_width = 2
end = (start[1], start[0]-1) # np.ndarray and opencv expects (x,y) vs (y,x)
#start = (end[0], end[1])
mask = mask.astype(np.uint8) # Type that OpenCV expects
# Draw one point at a time until we hit a point that already has the desired value
while mask[end] != fill_value:
#cv.line(mask, start, end, fill_value, line_width) # skipped, no need to draw each step
#print("debug",start,end,mask[end],fill_value)
# Update end to the next position
#start = end
end = (end[0]- line_width, end[1])
cv.line(mask, start, (end[1],end[0]), fill_value, line_width) # np.ndarray and opencv expects (x,y) vs (y,x)
#plt.imshow(mask)
#plt.show()
return mask.astype(bool)

@Kimhasen
Copy link
Author

Kimhasen commented Jun 3, 2024

before
after use_pin_hole (with rtutils)
after
with my version of draw_line_upwards

diff
Difference in viewers like Pmod and Hermes (Hermia Affinity)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant