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

The mask size differs from the input image size #19

Open
Jayanth-L opened this issue Oct 14, 2018 · 1 comment
Open

The mask size differs from the input image size #19

Jayanth-L opened this issue Oct 14, 2018 · 1 comment

Comments

@Jayanth-L
Copy link

I understand that there is some resizing due to convolutions, can't i obtain mask with the same size as the input image ?

@AlexDenis
Copy link

AlexDenis commented Oct 15, 2018

@Jayanth-L I think so, so I just added white frame removal using ImageChops (piece of code below) and then cv2.resize() to the end of the pipeline:

def trim(im):            
    bg = Image.new(im.mode, im.size, im.getpixel((0,0)))
    diff = ImageChops.difference(im, bg)
    diff = ImageChops.add(diff, diff, 2.0, -100)
    bbox = diff.getbbox()
    if bbox:
        return im.crop(bbox)

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

2 participants