From 6c7b1c3146e16475e49ceb436ec90d8d5b10d1c9 Mon Sep 17 00:00:00 2001 From: UnavailableDev <69792062+UnavailableDev@users.noreply.github.com> Date: Wed, 3 May 2023 09:22:53 +0200 Subject: creation of poc_openmv --- openMV/POC_signs_red.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 openMV/POC_signs_red.py diff --git a/openMV/POC_signs_red.py b/openMV/POC_signs_red.py new file mode 100644 index 0000000..cb521b9 --- /dev/null +++ b/openMV/POC_signs_red.py @@ -0,0 +1,48 @@ +# Hello World Example +# +# Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script! + +import sensor, image, time + +# Color Tracking Thresholds (Grayscale Min, Grayscale Max) +min_rgb = 128 +max_rgb = 255 +threshold_list = [(min_rgb, max_rgb)]# only bright grey colours will get tracked. +threshold_rgb = [(0, 100, 75, 32, 2, 127)] #only find red +#threshold_rgb = [(18, 78, -8, 127, 24, 127)] + +sensor.reset() # Reset and initialize the sensor. +sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) +#sensor.set_pixformat(sensor.GRAYSCALE) +sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) +sensor.skip_frames(time = 2000) # Wait for settings take effect. +clock = time.clock() # Create a clock object to track the FPS. + +while(True): + clock.tick() # Update the FPS clock. + img = sensor.snapshot() # Take a picture and return the image. + + #lines = img.find_lines() + #for i in lines: + #img.draw_line(i.line(), 255, 8) + + #gray = img + #gray.to_grayscale() + #img.find_edges(0) + + + + blobs = img.find_blobs(threshold_rgb) + #blobs.count() + #print(blobs) + ##kpts = img.find_keypoints() + for index, b in enumerate(blobs, 1): + convex = b.convexity() + if convex < 0.8: + img.draw_rectangle(b.rect(),int((512+256)*convex),2) + print(b.convexity()) + + #img.draw_line(12,12,200,200,255,8) + + print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected + # to the IDE. The FPS should increase once disconnected. -- cgit v1.2.3 From ffe58ef884b1d82fcdfff26413989d32913b91eb Mon Sep 17 00:00:00 2001 From: UnavailableDev Date: Wed, 3 May 2023 11:15:35 +0200 Subject: sign detection/recognition --- docs/imgs/signs.png | Bin 0 -> 376970 bytes docs/research_sign_detect.md | 117 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 docs/imgs/signs.png create mode 100644 docs/research_sign_detect.md diff --git a/docs/imgs/signs.png b/docs/imgs/signs.png new file mode 100644 index 0000000..8102ac4 Binary files /dev/null and b/docs/imgs/signs.png differ diff --git a/docs/research_sign_detect.md b/docs/research_sign_detect.md new file mode 100644 index 0000000..075ceca --- /dev/null +++ b/docs/research_sign_detect.md @@ -0,0 +1,117 @@ +# The traffic sign problem: + +We divide the reviewed detection methods into five main categories: color-based methods, shape-based methods, color- and shape-based methods, machine-learning-based methods, and LIDAR-based methods + +# Traffic Sign Detection (TSD) + +## Color based + +The distinct color characteristics of traffic signs can attract drivers’ attention and can also provide important cues to design color based detection methods. In the past decades, a large amount of detection methods are designed to detect distinct traffic sign colors such as blue, red and yellow. These methods can be directly used for traffic sign detection, and can also be used for preliminary reduction of the search space, followed by other detection methods + +### RGB + +One can easily look at the RGB values to detect a certain color. Although the r,g and b values are heavily effected by different illuminations, therefore this isn't a reliable solution in variating lighting conditions. + +An example implementation: + +```py +#Red +if(R >= ThR and G <= thG) + +#Blue +if(B >= thB) + +#Yellow +if((R + G) >= ThY) + +``` + +It is possible to enhance the colors with maximum and minimum operations: + +``` +fR(i) = max(0, min(iR − iG, iR − iB)/s), +fB(i) = max(0, min(iB − iR, iB − iG)/s), +fY(i) = max(0, min(iR − iB, iG − iB)/s). +``` + +This method can result in some issues on the blue channel (see source 1 page 86583 for more explanation). As a solution to this issue use the following formula for the blue channel instead: +``` +f′B(i) = max(0, iB − iR)/s). +``` + +### HSV + +The HSV/HSI color space is more immune to the illumination challenges of RGB. The hue and saturation channels can be calculated using RGB, which increases the processing time. + +The following pseudo code shows how to detect the red, blue and yellow colors in this space. + +```python +#Red +if (H <= Th1 or + H >= Th2) + +#Blue +if (H >= Th1 and + H <= Th2) + +#Yellow + +if (H >= Th1 and + H <= Th2 and + H <= Th3) + +``` + +### LAB + +This color space is used for finding uncorrelated color components, the L\*a\*b\* space was used for detecting blue, red, yellow and green colors. + + +### Pixel classification + +This method avoids the use of fixed thresholds that might need adjusting at times. In order to resolve this some authors tried to transfer the problem into pixel classification where a neural network classifies every pixel in the input image, the pixel classification algorithms are often slower than other color extraction methods. + +### results + +The above described methods where also applied to a database in order to compare each method. This resulted in the conclusion that using a normalized RGB space is giving the most accurate results. See source 1 page 86584 for the full report. + +## Shape based + +Common standard shapes of traffic signs are triangle, circle, rectangle, and octagon. Shape characteristics used for shape detection include standard shapes, boundaries, texture, key points, etc. + +### Hough + + + +### Barnes *et al* (fast radial symmetry) + + +### Fourier + + +### Key points detection + + +## Color & Shape based + + +## Neural networks + + + +# Traffic Sign Recognition (TSR) +After traffic sign detection or tracking, traffic sign recognition is performed to classify the detected traffic signs into correct classes. + +![signs example](imgs/signs.png) + +## Binary tree +The binary-tree-based classification method usually classify traffic signs according to the shapes and colors in a coarse-to-fine tree process. + +## Support Vector Machine (SVM) +As a binary-classification method, SVM classifies traffic signs using one-vs-one or one-vs-others classification process. + + + +# Sources: + +1. [IEEE, Digital Object Identifier June 26, 2019 (pages 86578 - 86596)](https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8746141) \ No newline at end of file -- cgit v1.2.3 From 7a18524a8b97deaafcd93be14e56ce308fe4583c Mon Sep 17 00:00:00 2001 From: UnavailableDev Date: Mon, 8 May 2023 10:45:37 +0200 Subject: updated draft --- docs/research_sign_detect.md | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/docs/research_sign_detect.md b/docs/research_sign_detect.md index 075ceca..b81ab38 100644 --- a/docs/research_sign_detect.md +++ b/docs/research_sign_detect.md @@ -1,6 +1,13 @@ + +# List of abriviations + +- ROI (aRea Of Interest) + + + # The traffic sign problem: -We divide the reviewed detection methods into five main categories: color-based methods, shape-based methods, color- and shape-based methods, machine-learning-based methods, and LIDAR-based methods + # Traffic Sign Detection (TSD) @@ -80,23 +87,29 @@ The above described methods where also applied to a database in order to compare Common standard shapes of traffic signs are triangle, circle, rectangle, and octagon. Shape characteristics used for shape detection include standard shapes, boundaries, texture, key points, etc. ### Hough + - -### Barnes *et al* (fast radial symmetry) +### Barnes *Fang et al* (fast radial symmetry) +Seemingly a 'simpler' method + ### Fourier +This method also deals with occlusion and morphing the shape flat again (when looking at it at an angle). ### Key points detection - +This, simply put, looks at the edges/corners in order to find an ROI. ## Color & Shape based +In some methods, the shape detection methods can be combined with color based methods to fulfill the traffic sign detection work. +For example, using a color based detection to find a ROI and using shape detection in that ROI to determine if it is a sign. -## Neural networks +## Neural networks + # Traffic Sign Recognition (TSR) -- cgit v1.2.3 From 9c77d63265256048eebe242dbcecf89cf2ebb994 Mon Sep 17 00:00:00 2001 From: UnavailableDev Date: Mon, 22 May 2023 10:24:04 +0200 Subject: doc merge --- doc/dui.md | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/img/signs.png | Bin 0 -> 376970 bytes docs/imgs/signs.png | Bin 376970 -> 0 bytes 3 files changed, 131 insertions(+) create mode 100644 doc/img/signs.png delete mode 100644 docs/imgs/signs.png diff --git a/doc/dui.md b/doc/dui.md index 3f72e1c..b8354c0 100644 --- a/doc/dui.md +++ b/doc/dui.md @@ -383,10 +383,141 @@ combination with the standard Pololu boards and Libraries. } \buildSystemConclusion +## Traffic Sign Detection (TSD) + +The following chapters will look at the different methods used to detect signs in order to find a suitable solution for this project. + +### Color based + +The distinct color characteristics of traffic signs can attract drivers’ attention and can also provide important cues to design color based detection methods. In the past decades, a large amount of detection methods are designed to detect distinct traffic sign colors such as blue, red and yellow. These methods can be directly used for traffic sign detection, and can also be used for preliminary reduction of the search space, followed by other detection methods + +#### RGB + +One can easily look at the RGB values to detect a certain color. Although the r,g and b values are heavily effected by different illuminations, therefore this isn't a reliable solution in variating lighting conditions. + +An example implementation: + +```py +#Red +if(R >= ThR and G <= thG) + +#Blue +if(B >= thB) + +#Yellow +if((R + G) >= ThY) +``` + +It is possible to enhance the colors with maximum and minimum operations: + +```py +fR(i) = max(0, min(iR − iG, iR − iB)/s), +fB(i) = max(0, min(iB − iR, iB − iG)/s), +fY(i) = max(0, min(iR − iB, iG − iB)/s). +``` + +This method can result in some issues on the blue channel (see source 1 page 86583 for more explanation). As a solution to this issue use the following formula for the blue channel instead: +```py +f′B(i) = max((0, iB − iR)/s). +``` + +#### HSV + +The HSV/HSI color space is more immune to the illumination challenges of RGB. The hue and saturation channels can be calculated using RGB, which increases the processing time. +The following pseudo code shows how to detect the red, blue and yellow colors in this space. + +```python +#Red +if (H <= Th1 or + H >= Th2) + +#Blue +if (H >= Th1 and + H <= Th2) + +#Yellow + +if (H >= Th1 and + H <= Th2 and + H <= Th3) +``` + +#### LAB + +This color space is used for finding uncorrelated color components, the L\*a\*b\* space was used for detecting blue, red, yellow and green colors. + +#### Pixel classification + +This method avoids the use of fixed thresholds that might need adjusting at times. In order to resolve this some authors tried to transfer the problem into pixel classification where a neural network classifies every pixel in the input image, the pixel classification algorithms are often slower than other color extraction methods. + +#### results + +\def\signDetectionColor{ +The above described methods where also applied to a database in order to compare each method. This resulted in the conclusion that, using a normalized RGB space is giving the a mixture of most detections and least false-positve results. See source 1 page 86584 for the full report. +} +\signDetectionColor + +### Shape based + +Common standard shapes of traffic signs are triangle, circle, rectangle, and octagon. Shape characteristics used for shape detection include standard shapes, boundaries, texture, key points, etc. + +#### Hough + +See line detection hough. + + +#### Barnes *Fang et al* (fast radial symmetry) + +Seemingly a 'simpler' method + + +#### Fourier +This method also deals with occlusion and morphing/rotating the shape flat again (when looking at it at an angle). + +#### Key points detection +This, simply put, looks at the edges/corners in order to find an ROI. + +### Color & Shape based +In some methods, the shape detection methods can be combined with color based methods to fulfill the traffic sign detection work. +For example, using a color based detection to find a ROI and using shape detection in that ROI to determine if it is a sign. + +### Neural networks + + +### results + +\def\signDetectionShape{ +Most shape based recognition methods are more complex than using a color based detection. But the method 'Fourier' seems the most useful as it can also deal with rotated and occluded objects. +} +\signDetectionShape + +## Traffic Sign Recognition (TSR) +After traffic sign detection or tracking, traffic sign recognition is performed to classify the detected traffic signs into correct classes. + +![signs example](img/signs.png) + +### Binary tree +The binary-tree-based classification method usually classify traffic signs according to the shapes and colors in a coarse-to-fine tree process. + +### Support Vector Machine (SVM) +As a binary-classification method, SVM classifies traffic signs using one-vs-one or one-vs-others classification process. + +## results + +\def\signRecognition{ +While making a binary tree is seemingly the most simple, yet effective solution. Using the 'Fourier' method is a bit more complex, it may be a better solution (this requires testing). +} +\signRecognition + # Conclusion \communicationConclusion \buildSystemConclusion +\signDetectionColor +\signDetectionShape +\signRecognition +## Sources: +1. [IEEE, Digital Object Identifier June 26, 2019 (pages 86578 - 86596)](https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8746141) diff --git a/doc/img/signs.png b/doc/img/signs.png new file mode 100644 index 0000000..8102ac4 Binary files /dev/null and b/doc/img/signs.png differ diff --git a/docs/imgs/signs.png b/docs/imgs/signs.png deleted file mode 100644 index 8102ac4..0000000 Binary files a/docs/imgs/signs.png and /dev/null differ -- cgit v1.2.3 From 4eaf61db971fde2a7d2d9fe2e8bb4022554724da Mon Sep 17 00:00:00 2001 From: UnavailableDev Date: Mon, 22 May 2023 10:24:40 +0200 Subject: old folder deleted --- docs/research_sign_detect.md | 130 ------------------------------------------- 1 file changed, 130 deletions(-) delete mode 100644 docs/research_sign_detect.md diff --git a/docs/research_sign_detect.md b/docs/research_sign_detect.md deleted file mode 100644 index b81ab38..0000000 --- a/docs/research_sign_detect.md +++ /dev/null @@ -1,130 +0,0 @@ - -# List of abriviations - -- ROI (aRea Of Interest) - - - -# The traffic sign problem: - - - -# Traffic Sign Detection (TSD) - -## Color based - -The distinct color characteristics of traffic signs can attract drivers’ attention and can also provide important cues to design color based detection methods. In the past decades, a large amount of detection methods are designed to detect distinct traffic sign colors such as blue, red and yellow. These methods can be directly used for traffic sign detection, and can also be used for preliminary reduction of the search space, followed by other detection methods - -### RGB - -One can easily look at the RGB values to detect a certain color. Although the r,g and b values are heavily effected by different illuminations, therefore this isn't a reliable solution in variating lighting conditions. - -An example implementation: - -```py -#Red -if(R >= ThR and G <= thG) - -#Blue -if(B >= thB) - -#Yellow -if((R + G) >= ThY) - -``` - -It is possible to enhance the colors with maximum and minimum operations: - -``` -fR(i) = max(0, min(iR − iG, iR − iB)/s), -fB(i) = max(0, min(iB − iR, iB − iG)/s), -fY(i) = max(0, min(iR − iB, iG − iB)/s). -``` - -This method can result in some issues on the blue channel (see source 1 page 86583 for more explanation). As a solution to this issue use the following formula for the blue channel instead: -``` -f′B(i) = max(0, iB − iR)/s). -``` - -### HSV - -The HSV/HSI color space is more immune to the illumination challenges of RGB. The hue and saturation channels can be calculated using RGB, which increases the processing time. - -The following pseudo code shows how to detect the red, blue and yellow colors in this space. - -```python -#Red -if (H <= Th1 or - H >= Th2) - -#Blue -if (H >= Th1 and - H <= Th2) - -#Yellow - -if (H >= Th1 and - H <= Th2 and - H <= Th3) - -``` - -### LAB - -This color space is used for finding uncorrelated color components, the L\*a\*b\* space was used for detecting blue, red, yellow and green colors. - - -### Pixel classification - -This method avoids the use of fixed thresholds that might need adjusting at times. In order to resolve this some authors tried to transfer the problem into pixel classification where a neural network classifies every pixel in the input image, the pixel classification algorithms are often slower than other color extraction methods. - -### results - -The above described methods where also applied to a database in order to compare each method. This resulted in the conclusion that using a normalized RGB space is giving the most accurate results. See source 1 page 86584 for the full report. - -## Shape based - -Common standard shapes of traffic signs are triangle, circle, rectangle, and octagon. Shape characteristics used for shape detection include standard shapes, boundaries, texture, key points, etc. - -### Hough - - - -### Barnes *Fang et al* (fast radial symmetry) -Seemingly a 'simpler' method - - - -### Fourier -This method also deals with occlusion and morphing the shape flat again (when looking at it at an angle). - - -### Key points detection -This, simply put, looks at the edges/corners in order to find an ROI. - -## Color & Shape based -In some methods, the shape detection methods can be combined with color based methods to fulfill the traffic sign detection work. - -For example, using a color based detection to find a ROI and using shape detection in that ROI to determine if it is a sign. - - -## Neural networks - - - -# Traffic Sign Recognition (TSR) -After traffic sign detection or tracking, traffic sign recognition is performed to classify the detected traffic signs into correct classes. - -![signs example](imgs/signs.png) - -## Binary tree -The binary-tree-based classification method usually classify traffic signs according to the shapes and colors in a coarse-to-fine tree process. - -## Support Vector Machine (SVM) -As a binary-classification method, SVM classifies traffic signs using one-vs-one or one-vs-others classification process. - - - -# Sources: - -1. [IEEE, Digital Object Identifier June 26, 2019 (pages 86578 - 86596)](https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8746141) \ No newline at end of file -- cgit v1.2.3 From 6daf8036c1342899196b2f7830ae5a18f0918d07 Mon Sep 17 00:00:00 2001 From: UnavailableDev Date: Mon, 22 May 2023 10:26:37 +0200 Subject: *file in wrong dir fixed --- assets/signs.png | Bin 0 -> 376970 bytes doc/dui.md | 2 +- doc/img/signs.png | Bin 376970 -> 0 bytes 3 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 assets/signs.png delete mode 100644 doc/img/signs.png diff --git a/assets/signs.png b/assets/signs.png new file mode 100644 index 0000000..8102ac4 Binary files /dev/null and b/assets/signs.png differ diff --git a/doc/dui.md b/doc/dui.md index b8354c0..cbe99e9 100644 --- a/doc/dui.md +++ b/doc/dui.md @@ -494,7 +494,7 @@ Most shape based recognition methods are more complex than using a color based d ## Traffic Sign Recognition (TSR) After traffic sign detection or tracking, traffic sign recognition is performed to classify the detected traffic signs into correct classes. -![signs example](img/signs.png) +![signs example](../assets/signs.png) ### Binary tree The binary-tree-based classification method usually classify traffic signs according to the shapes and colors in a coarse-to-fine tree process. diff --git a/doc/img/signs.png b/doc/img/signs.png deleted file mode 100644 index 8102ac4..0000000 Binary files a/doc/img/signs.png and /dev/null differ -- cgit v1.2.3