Skip to content

Comments

Task 6#4

Open
gitfrandu4 wants to merge 1 commit intomainfrom
task-6
Open

Task 6#4
gitfrandu4 wants to merge 1 commit intomainfrom
task-6

Conversation

@gitfrandu4
Copy link
Owner

Script:

vid = cv2.VideoCapture(0)

while True:
    # frame to frame
    ret, frame = vid.read()

    if not ret:
        # If we've reached the end of the video, reset to the beginning
        vid.set(cv2.CAP_PROP_POS_FRAMES, 0)
        continue

    # Resize the frame to make it smaller
    frame = cv2.resize(frame, (frame.shape[1] // 2, frame.shape[0] // 2))

    # Create different color variations
    frame1 = frame.copy()
    frame2 = cv2.applyColorMap(frame, cv2.COLORMAP_HSV)
    frame3 = cv2.applyColorMap(frame, cv2.COLORMAP_INFERNO)
    frame4 = cv2.applyColorMap(frame, cv2.COLORMAP_DEEPGREEN)
    
    # Create a 2x2 collage
    top_row = np.hstack((frame1, frame2))
    bottom_row = np.hstack((frame3, frame4))
    collage = np.vstack((top_row, bottom_row))

    # Show the result image
    cv2.imshow('Pop Art Effect', collage)

    # Stop the video when the ESC key is pressed
    if cv2.waitKey(20) == 27:
        plt.imshow(cv2.cvtColor(collage, cv2.COLOR_BGR2RGB))
        plt.axis('off')
        plt.show()
        break

# Release the video capture object
vid.release()
# Destroy the windows
cv2.destroyAllWindows()

image

@gitfrandu4 gitfrandu4 requested a review from DerKom September 16, 2024 17:32
@gitfrandu4 gitfrandu4 self-assigned this Sep 16, 2024
@gitfrandu4 gitfrandu4 added the enhancement New feature or request label Sep 16, 2024
@gitfrandu4 gitfrandu4 changed the title Update VC_P1.ipynb and README.md task 6 Sep 16, 2024
@gitfrandu4 gitfrandu4 changed the title task 6 Task 6 Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant