pr下雪下雨_图像增强:下雨,下雪。 如何修改照片以训练自动驾驶汽车

本文探讨了如何使用图像增强技术模拟雨、雪等天气条件,以训练自动驾驶汽车。通过OpenCV库处理图像,实现了改变光照、添加阴影、模拟雪景和雨天效果,帮助车辆在不同天气状况下提升驾驶能力。作者提供了实现这些效果的Jupyter Notebook代码,供读者参考和实践。
摘要由CSDN通过智能技术生成

pr下雪下雨

by Ujjwal Saxena

由Ujjwal Saxena

图像增强:下雨,下雪。 如何修改照片以训练自动驾驶汽车 (Image Augmentation: Make it rain, make it snow. How to modify photos to train self-driving cars)

Image Augmentation is a technique for taking an image and using it to generating new ones. It’s useful for doing things like training a self-driving car.

图像增强是一种获取图像并将其用于生成新图像的技术。 这对于进行自动驾驶汽车的训练非常有用。

Think of a person driving a car on a sunny day. If it starts raining, they may initially find it difficult to drive in rain. But slowly they get accustomed to it.

想想一个人在晴朗的一天开车。 如果开始下雨,他们最初可能会发现下雨时很难开车。 但是他们逐渐习惯了。

An artificial neural network too finds it confusing to drive in a new environment unless it has seen it earlier. Their are various augmentation techniques like flipping, translating, adding noise, or changing color channel.

人工神经网络也发现在新环境中驾驶时会感到困惑,除非早先见过。 它们是各种增强技术,例如翻转,平移,添加噪声或更改颜色通道。

In this article, I’ll explore the weather part of this. I used the OpenCV library for processing images. I found it pretty easy after a while, and was able to introduce various weather scenarios into an image.

在本文中,我将探讨天气的一部分。 我使用OpenCV库处理图像。 一段时间后,我发现这很容易,并且能够将各种天气情况引入图像中。

I’ve pushed a fully implemented Jupyter Notebook you can play with on GitHub.

我推了一个完全实现的Jupyter Notebook,您可以在GitHub上使用它

Lets’ have a look.

我们来看一下。

I’ll first show you an original test image and will then augment it.

首先,我将向您展示原始测试图像,然后对其进行放大。

阳光明媚和阴暗 (Sunny and Shady)

After adding random sunny and shady effect, the image’s brightness changes. This is an easy and quick transformation to perform.

添加随机的晴天和阴暗效果后,图像的亮度会改变。 这是一个容易快速执行的转换。

def add_brightness(image):    image_HLS = cv2.cvtColor(image,cv2.COLOR_RGB2HLS) ## Conversion to HLS    image_HLS = np.array(image_HLS, dtype = np.float64)     random_brightness_coefficient = np.random.uniform()+0.5 ## generates value between 0.5 and 1.5    image_HLS[:,:,1] = image_HLS[:,:,1]*random_brightness_coefficient ## scale pixel values up or down for channel 1(Lightness)    image_HLS[:,:,1][image_HLS[:,:,1]>255]  = 255 ##Sets all values above 255 to 255    image_HLS = np.array(image_HLS, dtype = np.uint8)    image_RGB = cv2.cvtColor(image_HLS,cv2.COLOR_HLS2RGB) ## Conversion to RGB    return image_RGB

The brightness of an image can be changed by changing the pixel values of “Light

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值