Skip to content

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

@Kimhasen

Description

@Kimhasen

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions