In [ ]:
Copied!
import cv2
from matplotlib import pyplot as plt
import cv2
import albumentations as A
import cv2 from matplotlib import pyplot as plt import cv2 import albumentations as A
In [ ]:
Copied!
def visualize(image):
plt.figure(figsize=(10, 5))
plt.axis('off')
plt.imshow(image)
def visualize(image): plt.figure(figsize=(10, 5)) plt.axis('off') plt.imshow(image)
In [ ]:
Copied!
def load_rgb(image_path):
image = cv2.imread(image_path)
return cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
def load_rgb(image_path): image = cv2.imread(image_path) return cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
Load the image from the disk¶
In [ ]:
Copied!
img_path = "../images/alina_rossoshanska.jpeg"
img = load_rgb(img_path)
img_path = "../images/alina_rossoshanska.jpeg" img = load_rgb(img_path)
Visualize the original image¶
In [ ]:
Copied!
visualize(img)
visualize(img)
Red-blue mode¶
In [ ]:
Copied!
transform = A.Compose([A.ChromaticAberration(mode="red_blue", primary_distortion_limit=0.5, secondary_distortion_limit=0.1, p=1)])
plt.figure(figsize=(15, 10))
num_images = 12
# Loop through the list of images and plot them with subplot
for i in range(num_images):
transformed_image = transform(image = img)["image"]
plt.subplot(4, 3, i + 1)
plt.imshow(transformed_image)
plt.axis('off')
plt.tight_layout()
plt.show()
transform = A.Compose([A.ChromaticAberration(mode="red_blue", primary_distortion_limit=0.5, secondary_distortion_limit=0.1, p=1)]) plt.figure(figsize=(15, 10)) num_images = 12 # Loop through the list of images and plot them with subplot for i in range(num_images): transformed_image = transform(image = img)["image"] plt.subplot(4, 3, i + 1) plt.imshow(transformed_image) plt.axis('off') plt.tight_layout() plt.show()