Skip to content

Comments

added 16bit support#33

Open
DonkeyShot21 wants to merge 1 commit intoLandingEllipse:masterfrom
DonkeyShot21:feature/16bit
Open

added 16bit support#33
DonkeyShot21 wants to merge 1 commit intoLandingEllipse:masterfrom
DonkeyShot21:feature/16bit

Conversation

@DonkeyShot21
Copy link

I created a new branch adding support for 16bit images

@LandingEllipse
Copy link
Owner

Thanks for the PR! As mentioned in #32 I'll be able to look over this and merge within a few days.

Copy link
Owner

@LandingEllipse LandingEllipse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for your interest in SLDTk! I've looked at the pull request and added some comments/feedback. Mostly I'm interested in conserving support for uint8 images, which is easily achievable by moving towards fraction based arguments and adapting ranges on the fly based on the treated image's dtype.

I've changed the status to "request changes" in case you'd like to make the tweaks yourself (or continue the discussion); if not I'd be happy to do so myself, just let me know. I'd of course be happy to add you as a contributor when your pull request is accepted.

Cheers,
Ariel

"profile.")
ap.add_argument("-t", "--threshold",
type=_uint8,
type=int,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type too broad. e.g. "-1337" would be a valid threshold which, assuming by 16-bit we're talking about uint16, is not desirable. If support for uint8 is to be kept (see below), I propose threshold and bias arguments are converted to fractions to remain agnostic of a given image's dtype.

disk = (disk / flat) * bias

img[d_y-d_r:d_y+d_r, d_x-d_r:d_x+d_r] = np.clip(disk, 0, 255).round()
img[d_y-d_r:d_y+d_r, d_x-d_r:d_x+d_r] = np.clip(disk, 0, 2**16 - 1).round()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to use np.iinfo(img.dtype).max in place of hardcoded values to conserve support for uint8 images.


blur = cv2.GaussianBlur(img, (5, 5), 0)
mask = cv2.inRange(blur, threshold, 255)
mask = cv2.inRange(blur, threshold, 2**16 - 1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to use np.iinfo(img.dtype).max in place of hardcoded values to conserve support for

"threshold": 10,
"slices": 1000,
"bias": 175,
"bias": 44975,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be converted to a fraction as per comment for helpers.py

paths = generate_output_paths(args)

image = cv2.imread(args['image'])
image = cv2.imread(args['image'], -1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use explicit constants instead of integer values for flags, i.e. cv2.IMREAD_UNCHANGED in this case.

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

Successfully merging this pull request may close these issues.

2 participants