添加图像opencv(线道路检测)

发布于 2025-01-18 18:21:52 字数 1867 浏览 2 评论 0原文

我希望每个人都过得很好, 我正在研究一个道路泳道检测项目(道路上的白色标记),并且需要在检测前对图像进行预处理,此预处理是添加了连续的图像(例如10 IMG)。

我的目的是:应用算法,该算法添加了所选图像基础的连续图像,然后将结果保存在新基础中。 我只有一个信息是: 用于添加连续图像的方程是: i(k)= max {i(k-1),i(k-2),....,i(kp)}

i(k)是时间k的图像。 P是要添加的连续图像的数量。

我使用了Python编程语言和OPENCV库。

这是我为下载并显示包含60张图像的图像的第一个代码: 下载图像:

images = [cv2.imread(file) for file in glob.glob("drive/MyDrive/Test1_lane_detection_/BDD/*.png")]

显示图像:

    def list_images(images, cols = 4, rows = 15, cmap='gray'):

    for i in range(0, len(images), rows*cols):
            plt.figure(figsize=(50,50))
            for j in range(0, rows*cols):
                    plt.subplot(rows, cols, j+1)
                    plt.imshow(images[i+j], cmap = cmap)
                    plt.axis("off")
                    plt.xticks([])
                    plt.yticks([])
                    plt.tight_layout(pad=0, h_pad=0, w_pad=0)        
            plt.show()

list_images(图像),

这里有5个来自数据库的图像: [3]: https://i.sstatic.net/z2o6a.png [4]: https://i.sstatic.net/5bv1w.png [5]: https://i.sstatic.net/4lfbl.png [6]: https://i.sstatic.net/y5b7q.png [7]: https://i.sstatic.net/ypubj.png

一个显示结果我将尝试实现的示例,目标是改善白色标记并避免不连续的标记: 此图像在添加10次连续图像后的左侧表示原始图像和右侧: [8]: https://i.sstatic.net/69h0k.png.png

I hope everyone is doing well,
I am working on a road lane detection project (white marking on the road), and I need to apply a pre-processing to the images before the detection, this pre-processing is the addition of successive images (10 img for example).

My objective is: Apply an algorithm which adds the successive images of the chosen image base, then save the result in a new base.
I only have one information which is:
The equation used to addition successive images is:
I(k)=max{ I(k-1), I(k-2), ...., I(k-p) }

I(k) is the image at time k. P is the number of successive images to be added.

I used Python programming language and OpenCV library.

Here is the first code I made to download and display the images from the database which contains 60 images:
download images:

images = [cv2.imread(file) for file in glob.glob("drive/MyDrive/Test1_lane_detection_/BDD/*.png")]

Display the images:

    def list_images(images, cols = 4, rows = 15, cmap='gray'):

    for i in range(0, len(images), rows*cols):
            plt.figure(figsize=(50,50))
            for j in range(0, rows*cols):
                    plt.subplot(rows, cols, j+1)
                    plt.imshow(images[i+j], cmap = cmap)
                    plt.axis("off")
                    plt.xticks([])
                    plt.yticks([])
                    plt.tight_layout(pad=0, h_pad=0, w_pad=0)        
            plt.show()

list_images(images)

Here are 5 images from the database:
[3]: https://i.sstatic.net/Z2O6A.png
[4]: https://i.sstatic.net/5bv1w.png
[5]: https://i.sstatic.net/4lFbL.png
[6]: https://i.sstatic.net/Y5B7Q.png
[7]: https://i.sstatic.net/yPUBJ.png

And here is an example that shows the result I will try to achieveso, the goal is to improve the white markings and avoid discontinuous markings :
This image represents, on the left the original image and on the right after the addition of 10 successive images:
[8]: https://i.sstatic.net/69h0K.png

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文