diff --git a/Final - Fixed all.ipynb b/Final - Fixed all.ipynb index 79dfa39..4e69df2 100644 --- a/Final - Fixed all.ipynb +++ b/Final - Fixed all.ipynb @@ -10,17 +10,17 @@ "output_type": "stream", "text": [ "(540, 960, 3)\n", - "Currently processing image: ./test_images/solidYellowCurve.jpg\n", - "(540, 960, 3)\n", - "Currently processing image: ./test_images/solidYellowCurve2.jpg\n", + "Currently processing image: ./test_images/challenge_Moment.jpg\n", "(540, 960, 3)\n", "Currently processing image: ./test_images/solidWhiteCurve.jpg\n", "(540, 960, 3)\n", "Currently processing image: ./test_images/solidWhiteRight.jpg\n", "(540, 960, 3)\n", - "Currently processing image: ./test_images/solidYellowLeft.jpg\n", + "Currently processing image: ./test_images/solidYellowCurve.jpg\n", "(540, 960, 3)\n", - "Currently processing image: ./test_images/challenge_Moment.jpg\n", + "Currently processing image: ./test_images/solidYellowCurve2.jpg\n", + "(540, 960, 3)\n", + "Currently processing image: ./test_images/solidYellowLeft.jpg\n", "(540, 960, 3)\n", "Currently processing image: ./test_images/whiteCarLaneSwitch.jpg\n" ] @@ -109,7 +109,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "100%|█████████▉| 221/222 [00:15<00:00, 13.45it/s]\n" + "100%|█████████▉| 221/222 [00:08<00:00, 25.66it/s]\n" ] }, { @@ -119,8 +119,8 @@ "[MoviePy] Done.\n", "[MoviePy] >>>> Video ready: test_videos_output/solidWhiteRight.mp4 \n", "\n", - "CPU times: user 3.78 s, sys: 239 ms, total: 4.02 s\n", - "Wall time: 16.8 s\n" + "CPU times: user 3.22 s, sys: 540 ms, total: 3.76 s\n", + "Wall time: 9.8 s\n" ] } ], @@ -138,8 +138,10 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": {}, + "execution_count": 3, + "metadata": { + "scrolled": true + }, "outputs": [ { "data": { @@ -154,7 +156,7 @@ "" ] }, - "execution_count": 4, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -169,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -188,7 +190,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -203,91 +205,18 @@ "name": "stderr", "output_type": "stream", "text": [ - "\n", - " 0%| | 0/251 [00:00>>> Video ready: test_videos_output/challenge.mp4 \n", "\n", - " 12%|█▏ | 31/251 [00:01<00:10, 20.76it/s]\u001b[A\n", - " 14%|█▎ | 34/251 [00:01<00:10, 21.03it/s]\u001b[A\n", - " 15%|█▍ | 37/251 [00:01<00:10, 21.05it/s]\u001b[A\n", - " 16%|█▌ | 40/251 [00:01<00:09, 21.16it/s]\u001b[A\n", - " 17%|█▋ | 43/251 [00:02<00:13, 15.41it/s]\u001b[A\n", - " 18%|█▊ | 45/251 [00:02<00:14, 14.33it/s]\u001b[A\n", - " 19%|█▊ | 47/251 [00:02<00:15, 13.02it/s]\u001b[A\n", - " 20%|█▉ | 49/251 [00:02<00:16, 12.22it/s]\u001b[A\n", - " 20%|██ | 51/251 [00:02<00:16, 11.80it/s]\u001b[A\n", - " 21%|██ | 53/251 [00:03<00:17, 11.48it/s]\u001b[A\n", - " 22%|██▏ | 55/251 [00:03<00:17, 11.26it/s]\u001b[A\n", - " 23%|██▎ | 57/251 [00:03<00:17, 11.05it/s]\u001b[A\n", - " 24%|██▎ | 59/251 [00:03<00:17, 11.00it/s]\u001b[A\n", - " 24%|██▍ | 61/251 [00:03<00:17, 10.85it/s]\u001b[A\n", - " 25%|██▌ | 63/251 [00:04<00:17, 10.84it/s]\u001b[A\n", - " 26%|██▌ | 65/251 [00:04<00:17, 10.74it/s]\u001b[A\n", - " 27%|██▋ | 67/251 [00:04<00:17, 10.70it/s]\u001b[A\n", - " 27%|██▋ | 69/251 [00:04<00:17, 10.64it/s]\n", - " 28%|██▊ | 71/251 [00:04<00:17, 10.51it/s]\u001b[A\n", - " 29%|██▉ | 73/251 [00:05<00:16, 10.61it/s]\u001b[A\n", - " 30%|██▉ | 75/251 [00:05<00:19, 9.11it/s]\u001b[A\n", - " 31%|███ | 77/251 [00:05<00:18, 9.30it/s]\u001b[A\n", - " 31%|███▏ | 79/251 [00:05<00:17, 9.64it/s]\u001b[A\n", - " 32%|███▏ | 80/251 [00:05<00:17, 9.50it/s]\u001b[A\n", - " 32%|███▏ | 81/251 [00:05<00:18, 9.26it/s]\u001b[A\n", - " 33%|███▎ | 83/251 [00:06<00:17, 9.49it/s]\u001b[A\n", - " 34%|███▍ | 85/251 [00:06<00:17, 9.66it/s]\u001b[A\n", - " 35%|███▍ | 87/251 [00:06<00:16, 9.66it/s]" + "CPU times: user 6.57 s, sys: 600 ms, total: 7.17 s\n", + "Wall time: 15.3 s\n" ] } ], @@ -305,7 +234,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -320,7 +249,7 @@ "" ] }, - "execution_count": 7, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -351,6 +280,13 @@ "\n", "print('Currently processing image: {}'.format('challenge_Moment.jpg'))" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -369,7 +305,11 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.3" + "version": "3.5.2" + }, + "widgets": { + "state": {}, + "version": "1.1.2" } }, "nbformat": 4, diff --git a/__pycache__/lane_finding.cpython-35.pyc b/__pycache__/lane_finding.cpython-35.pyc index 5f2db7e..b08988d 100644 Binary files a/__pycache__/lane_finding.cpython-35.pyc and b/__pycache__/lane_finding.cpython-35.pyc differ diff --git a/lane_finding.py b/lane_finding.py index 39ffb26..b6662e5 100644 --- a/lane_finding.py +++ b/lane_finding.py @@ -113,26 +113,10 @@ def draw_lines(img, lines, color=[255, 0, 0], thickness=2): #print((x2-x1)/(y2-y1)) nR += 1 - if (y1AvgL== y2AvgL) or (y1AvgR==y2AvgR): - for x1,y1,x2,y2 in line: - gh +=1 - if (x2-x1)/(y2-y1) > 0 : - x1AvgL = x1AvgL + (x1 - x1AvgL)/nL - x2AvgL = x2AvgL + (x2 - x2AvgL)/nL - y1AvgL = y1AvgL + (y1 - y1AvgL)/nL - y2AvgL = y2AvgL + (y2 - y2AvgL)/nL - nL += 1 - elif (x2-x1)/(y2-y1) < 0 : - x1AvgR = x1AvgR + (x1 - x1AvgR)/nR - x2AvgR = x2AvgR + (x2 - x2AvgR)/nR - y1AvgR = y1AvgR + (y1 - y1AvgR)/nR - y2AvgR = y2AvgR + (y2 - y2AvgR)/nR - nR += 1 + - if (x1AvgL==0 and x2AvgL==0 and y1AvgL==0 and y2AvgL==0) or (x1AvgR==0 and x2AvgR==0 and y1AvgR==0 and y2AvgR): - print(x1AvgL, x2AvgL, y1AvgL, y2AvgL) - print(x1AvgR, x2AvgR, y1AvgR, y2AvgR) - else: + if (y1AvgL!=y2AvgL) and (y1AvgR!=y2AvgR): + [slopeL, interceptL] = np.polyfit([x1AvgL, x2AvgL], [y1AvgL, y2AvgL], 1) [slopeR, interceptR] = np.polyfit([x1AvgR, x2AvgR], [y1AvgR, y2AvgR], 1) diff --git a/test_images_output/challenge_Moment.jpg b/test_images_output/challenge_Moment.jpg index 20b1f64..bdbf8b1 100644 Binary files a/test_images_output/challenge_Moment.jpg and b/test_images_output/challenge_Moment.jpg differ diff --git a/test_images_output/solidWhiteCurve.jpg b/test_images_output/solidWhiteCurve.jpg index b01a9a8..f718d58 100644 Binary files a/test_images_output/solidWhiteCurve.jpg and b/test_images_output/solidWhiteCurve.jpg differ diff --git a/test_images_output/solidWhiteRight.jpg b/test_images_output/solidWhiteRight.jpg index 1f25115..edb765e 100644 Binary files a/test_images_output/solidWhiteRight.jpg and b/test_images_output/solidWhiteRight.jpg differ diff --git a/test_images_output/solidYellowCurve.jpg b/test_images_output/solidYellowCurve.jpg index a9f20c7..65ea9f1 100644 Binary files a/test_images_output/solidYellowCurve.jpg and b/test_images_output/solidYellowCurve.jpg differ diff --git a/test_images_output/solidYellowCurve2.jpg b/test_images_output/solidYellowCurve2.jpg index 3a1102d..036682e 100644 Binary files a/test_images_output/solidYellowCurve2.jpg and b/test_images_output/solidYellowCurve2.jpg differ diff --git a/test_images_output/solidYellowLeft.jpg b/test_images_output/solidYellowLeft.jpg index 5b76954..a40567d 100644 Binary files a/test_images_output/solidYellowLeft.jpg and b/test_images_output/solidYellowLeft.jpg differ diff --git a/test_images_output/whiteCarLaneSwitch.jpg b/test_images_output/whiteCarLaneSwitch.jpg index f7ab657..0ef25b1 100644 Binary files a/test_images_output/whiteCarLaneSwitch.jpg and b/test_images_output/whiteCarLaneSwitch.jpg differ diff --git a/test_videos_output/challenge.mp4 b/test_videos_output/challenge.mp4 index fcfa287..ede1ab0 100644 Binary files a/test_videos_output/challenge.mp4 and b/test_videos_output/challenge.mp4 differ diff --git a/test_videos_output/solidWhiteRight.mp4 b/test_videos_output/solidWhiteRight.mp4 index 19baf3e..5682d64 100644 Binary files a/test_videos_output/solidWhiteRight.mp4 and b/test_videos_output/solidWhiteRight.mp4 differ