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

Add Emboss / Deboss Stamp Augmentation (or Option) #164

Open
jboarman opened this issue Mar 10, 2022 · 2 comments
Open

Add Emboss / Deboss Stamp Augmentation (or Option) #164

jboarman opened this issue Mar 10, 2022 · 2 comments
Labels
enhancement New feature or request experimental Functionality that may be too risky to develop or release

Comments

@jboarman
Copy link
Sponsor Member

jboarman commented Mar 10, 2022

Add 3D effect of raised (embossed) and lowered (debossed) text or symbols that you might see on a seal or a business card. We may need this as an internal shared lib in addition to being a top-level augmentation since we might want to raise/lower text overall or perhaps just a single seal when add in notary seals as an augmentation type of its own.

image
image

image
image

image
image

@jboarman jboarman added the experimental Functionality that may be too risky to develop or release label Mar 10, 2022
@kwcckw
Copy link
Collaborator

kwcckw commented Apr 12, 2022

This should be possible by adding certain level of gradient in the edges of the outline, but in actual use case, i think we need to get some templates of those seals? Otherwise it might not be easy to create those seals from scratch.

@jboarman jboarman added the enhancement New feature or request label Mar 19, 2023
@jboarman jboarman changed the title Emboss / Deboss Augmentation Add Emboss / Deboss Stamp Augmentation (or Option) Mar 19, 2023
@jboarman
Copy link
Sponsor Member Author

jboarman commented Apr 2, 2023

We have a draft set of stamps that could be integrated for use with this proposed augmentation, but that will need to be packaged for download separately, possibly on zonodo. Nevertheless, a user will need to reference a set of images within a folder, or possibly an existing set that we may offer via URL to download via zonodo or figshare, etc.

Filters and Post-Processing

Below are possible filters that may be useful to create a debossed or embossed representation of the stamp that could then be colorized and blended into the ink layer.

The use of course-grained noise would help make the impression look more natural when blended with the page. We may also want to borrow some of the letterpress functionality to blend ink-based stamps as well.

Note that colorized stamps would represent ink-pressed stamps while a semi-transparent white(?) stamp would represent an impression pressed into the paper to raise/low the paper instead of being combined with ink. Both stamps and seal can have the embossed or debossed impression effect. So a color and alpha transparency level associated with color could be passed in as a parameter or randomized (see markup augmentation and overlaybuilder utility for reference implementations).

Both scipy or opencv are dependencies that offer the convolutions. We may want to compare speeds, but if it's a toss-up then we should stick with opencv for consistency with the majority of our existing code:

opencv:
debossed_image = cv2.filter2D(img, -1, kernel_deboss, borderType=cv2.BORDER_REFLECT)

scipi:
embossed_image = convolve2d(image, kernel_emboss, mode='same', boundary='symm')

Deboss filters

# Deboss filter kernel variation 1
kernel_deboss_1 = np.array([[-1, -1, -1],
                            [-1, 9, -1],
                            [-1, -1, -1]])

# Deboss filter kernel variation 2
kernel_deboss_2 = np.array([[0, -2, -2],
                            [2, 0, -2],
                            [2, 2, 0]])

# Deboss filter kernel variation 3
kernel_deboss_3 = np.array([[-1, -2, -1],
                            [-2, 12, -2],
                            [-1, -2, -1]])

Emboss filters

# Emboss filter kernel variation 1
kernel_emboss_1 = np.array([[-1, -1, 0],
                            [-1, 0, 1],
                            [0, 1, 1]])

# Emboss filter kernel variation 2
kernel_emboss_2 = np.array([[0, 1, 0],
                            [1, -4, 1],
                            [0, 1, 0]])

# Emboss filter kernel variation 3
kernel_emboss_3 = np.array([[-2, -1, 0],
                            [-1, 0, 1],
                            [0, 1, 2]])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request experimental Functionality that may be too risky to develop or release
Projects
Status: Todo
Development

No branches or pull requests

2 participants