Project: Aspect Ratio Classification for LED Signs
Objective:
Develop a function or script that calculates and categorizes the aspect ratio of an LED sign based on its width and height. The system should be able to determine whether the sign is square, standard, widescreen, or vertical and categorize it accordingly.
Calculation Method
For a given LED sign with:
-
Width (W)
-
Height (H)
Compute the aspect ratio as:
Aspect Ratio = W / H
Categorization Logic
-
Square (1:1) – If W / H = 1, classify as Square.
-
Standard (4:3) – If W / H ≈ 1.33, classify as Standard (4:3).
-
Classic (3:2) – If W / H ≈ 1.5, classify as Photography/Classic (3:2).
-
Widescreen (16:9) – If W / H ≈ 1.78, classify as Widescreen (16:9).
-
Ultrawide (5:2) – If W / H = 2.5, classify as Ultrawide (5:2).
-
Banner (2:1) – If W / H = 2, classify as Banner (2:1).
Orientation Handling
-
If W > H, classify as Landscape.
-
If W < H, classify as Vertical.
-
If W = H, classify as Square.
Output Format
The function should return an object or dictionary with:
{
"width": W,
"height": H,
"aspect_ratio": "Calculated Ratio",
"classification": "Category Name",
"orientation": "Landscape / Vertical / Square"
}
Example Calculations
Width (W) | Height (H) | W / H | Classification | Orientation |
---|---|---|---|---|
5 | 5 | 1.00 | Square (1:1) | Square |
16 | 12 | 1.33 | Standard (4:3) | Landscape |
9 | 16 | 0.56 | Widescreen (9:16) | Vertical |
10 | 5 | 2.00 | Banner (2:1) | Landscape |
40 | 16 | 2.5 | Ultrawide (5:2) | Landscape |
Implementation Suggestions
-
Use a simple if-else structure or lookup table to classify ratios.
-
Implement the function in Python, JavaScript, or any preferred language.
-
Ensure the function can handle integer and decimal inputs.
-
Return rounded values for aspect ratios where necessary.