Skip to content
View watnsy's full-sized avatar

Block or report watnsy

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
watnsy/README.md

<start_of_image>s``` import cv2 import numpy as np

Load the image

image = cv2.imread("pebbles.jpg")

Convert the image to HSV color space

hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)

Create a mask for the pebbles

mask = cv2.inRange(hsv, (30, 30, 30), (180, 255, 255))

Invert the mask

mask = 255 - mask

Create a new image with the sand

sand = cv2.imread("sand.jpg")

Resize the sand image to match the size of the mask

sand = cv2.resize(sand, (mask.shape[1], mask.shape[0]))

Apply the mask to the sand image

masked_sand = cv2.bitwise_and(sand, sand, mask=mask)

Replace the pebbles with the sand

image[mask > 0] = masked_sand[mask > 0]

Convert the image back to BGR color space

image = cv2.cvtColor(image, cv2.COLOR_HSV2BGR)

Save the image

cv2.imwrite("result.jpg", image)

![IMG-20240928-WA0009](https://github.com/user-attachments/assets/eae3c765-b444-4017-90d8-714acf164606)

Popular repositories Loading

  1. docs docs Public

    Forked from BingX-API/docs

    BingX API Docs

    HTML

  2. flask flask Public

    Forked from pallets/flask

    The Python micro framework for building web applications.

    Python

  3. watnsy watnsy Public

    Config files for my GitHub profile.

  4. ton ton Public

    Forked from ton-blockchain/ton

    Main TON monorepo

    C++