コード例 #1
0
def main():  #主題:被巨貓吃掉之前的觀光客
    """
    TODO: Let the background pic replace the green screen of the figure pic.
    """
    fg = SimpleImage('image_contest/me.jpg')
    bg = SimpleImage('image_contest/back.jpg')
    bg.make_as_big_as(fg)
    combined_img = combine(bg, fg)
    combined_img.show()
コード例 #2
0
def main():
    """
    I want to live in a pineapple under the sea.
    """
    fg = SimpleImage('image_contest/me.jpg')
    bg = SimpleImage('image_contest/house.png')
    bg.make_as_big_as(fg)
    combined_img = combine(bg, fg)
    combined_img.show()
コード例 #3
0
def main():
    """
    This program mix my photo to a background photo.
    Inspiration: world in cartoon is happier:), and my cloth suits!
    """
    fg = SimpleImage('image_contest/IMG_2432.JPG')
    bg = SimpleImage('image_contest/backgroundhw.jpg')
    bg.make_as_big_as(fg)
    combined_img = combine(bg, fg)
    combined_img.show()
コード例 #4
0
def main():
    """
    創作理念/靈感來源:用天線寶寶的太陽,和大家打招呼!
    """
    sun = SimpleImage("image_contest/sun_back.png")
    figure = SimpleImage("image_contest/Jenny.png")
    figure.make_as_big_as(sun)
    new_figure = change_color(figure)
    result = combine(sun, new_figure)
    result.show()
コード例 #5
0
def main():
    """
    This function conducts green screen replacement
    which is able to photoshop a person onto any background
    """
    fg = SimpleImage('images/jerry.jpeg')
    bg = SimpleImage('images/wave.jpeg')
    bg.make_as_big_as(fg)
    combined_img = combine(bg, fg)
    combined_img.show()
コード例 #6
0
def main():
    """
    This function conducts green screen replacement
    which is able to photoshop a person onto any background
    """
    space_ship = SimpleImage("image_contest/anya.png")
    figure = SimpleImage("image_contest/angel 2.jpeg")
    space_ship.make_as_big_as(figure)  # adjust two images to same size
    result = combine(space_ship, figure)
    result.show()
コード例 #7
0
def main():
    """
    Just want to tell everyone I have these two lovely dogs
    And I love Christmas!
    """
    fg = SimpleImage("images/Isabelle.jpg")
    bg = SimpleImage("images/woofy.jpg")
    bg.make_as_big_as(fg)
    combine_img = combine(fg, bg)
    combine_img.show()
コード例 #8
0
def main():
    """
    This function conducts green screen replacement
    that is able to photoshop a person onto any background
    """
    background = SimpleImage("images/MillenniumFalcon.png")
    figure = SimpleImage("images/ReyGreenScreen.png")
    background.make_as_big_as(figure)
    result = combine(background, figure)
    result.show()
コード例 #9
0
def main():
    """
    This function conducts green screen replacement
    that is able to photoshop a person onto the background.
    """
    fg = SimpleImage('image_contest/calvin.jpg')
    bg = SimpleImage('image_contest/jerry.jpg')
    bg.make_as_big_as(fg)
    combined_img = combine(bg, fg)
    bg.show()
    combined_img.show()
コード例 #10
0
def redscreen(main_filename, back_filename):
    image = SimpleImage(main_filename)
    back = SimpleImage(back_filename)
    image.make_as_big_as(back)

    for pixel in image:
        average = (pixel.red + pixel.green + pixel.blue) // 3
        if pixel.red >= average * INTENSITY_THRESHOLD:
            x = pixel.x
            y = pixel.y
            image.set_pixel(x, y, back.get_pixel(x, y))
    return image
コード例 #11
0
def main():
    """
    This program will replace the green screen
    which can photoshop a person onto any background
    -----------------------------------------------------------
    Concept: My face is round and I like to eat soft-boiled egg.
             As a result, I turn the egg yolk into my face, soaking
             in the ramen and feeling comfortable.
    """
    fg = SimpleImage('image_contest/me.jpg')
    bg = SimpleImage('image_contest/ramen.jpg')
    bg.make_as_big_as(fg)
    combined_img = combine(fg, bg)
    combined_img.show()
コード例 #12
0
def main():
    """
    Being a astronaut is a dream that lives in everyone's childhood, and now, it finally came true...
    This program will make Kevin a astronaut by combining three layers image into one.
    """
    figure = SimpleImage('image_contest/IMG_2267.jpeg')
    background = SimpleImage('image_contest/universe.jpeg')
    suit = SimpleImage('image_contest/space suit.jpeg')
    background.make_as_big_as(figure)
    suit.make_as_big_as(figure)

    dressed_up = suit_up(figure, suit)
    result = into_space(dressed_up, background)
    result.show()
コード例 #13
0
def green_screen_filter():
    """
    This functions carries out green screening.
    :return:
    """
    foreground = SimpleImage(foreground_path_green_screen)
    background = SimpleImage(background_path_green_screen)
    background.make_as_big_as(foreground)
    for pixel in foreground:
        average = (pixel.red + pixel.green + pixel.blue) // 3
        if pixel.green <= average * GREEN_SCREEN_INTENSITY_THRESHOLD:
            x = pixel.x
            y = pixel.y
            background.set_pixel(x, y, foreground.get_pixel(x, y))
    background.show()
コード例 #14
0
def main():
    """
    This function conducts green screen replacement
    which is able to photoshop a person onto any background
    Idea: My dream is to live in LA and enjoy the culture. I love
    Hollywood movies so I will absolutely visit the 'Hollywood
    sign' in the future. This combined image is my imagination of
    the future.
    """
    img = SimpleImage('image_contest/James.jpg')
    background = SimpleImage('image_contest/Holly_wood.jpg')
    background.make_as_big_as(img)
    # img.show()
    # background.show()
    combined_img = combine(img, background)
    combined_img.show()
コード例 #15
0
def main():
    """
    The concept of my masterpiece:
        Apply what I've learned in Assignment4: blur
        Inspired by 'The dress debate': Is the dress white and gold or black and blue
        Also inspired by the great 'Shakespeare': To be or not to be?
    """
    # file reading
    me = SimpleImage('image_contest/blur me.png')
    wb = SimpleImage('image_contest/大whiteboard.jpg')
    back = SimpleImage('image_contest/background.jpg')

    # make me as big as the white part where I'm gonna fit in
    me.make_as_big_as(wb)

    # combine me and the background
    combined_img = combine(me, back)
    combined_img.show()
コード例 #16
0
def main():
    """
    TODO:ps own figure
    """
    img = SimpleImage('image_contest/P_20201127_235437_001.jpg')
    bg = SimpleImage('image_contest/moon.jpg')
    print(img.height, img.width)
    print(bg.height, bg.width)
    bg.make_as_big_as(img)
    for y in range(img.height):
        for x in range(img.width):
            pixel = img.get_pixel(x, y)
            bg_pixel = bg.get_pixel(x, y)
            avg = (pixel.red + pixel.green + pixel.blue) / 3
            if 500 > x or x > 642:
                if 400 > y or y > 500:
                    if avg > 142:
                        pixel.red = bg_pixel.red
                        pixel.blue = bg_pixel.blue
                        pixel.green = bg_pixel.green
    img.show()