├── README.md └── toll_collection.cpp /README.md: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Toll Collection System 4 | 5 | This project demonstrates a toll collection system using OpenCV for image processing, Tesseract for OCR, and FreeGLUT for OpenGL rendering. 6 | 7 | ## Step 1: Install Necessary Dependencies 8 | 9 | Make sure you have the required libraries installed. Open a terminal and run the following commands: 10 | 11 | ```bash 12 | sudo apt install build-essential cmake pkg-config 13 | sudo apt install libopencv-dev 14 | sudo apt install tesseract-ocr libtesseract-dev libleptonica-dev 15 | sudo apt install freeglut3 freeglut3-dev 16 | sudo apt install libglu1-mesa libglu1-mesa-dev mesa-common-dev 17 | sudo apt install tesseract-ocr-eng 18 | ``` 19 | 20 | ## Step 2: Copy the Code 21 | 22 | Save the following code as `toll_collection.cpp`: 23 | 24 | ```cpp 25 | // Add toll_collection.cpp C++ code here 26 | ``` 27 | 28 | ## Step 3: Compile the Program 29 | 30 | Run the following command to compile the program: 31 | 32 | ```bash 33 | g++ -o toll_collection toll_collection.cpp -lGL -lGLU -lglut `pkg-config --cflags --libs opencv4` -ltesseract -llept 34 | ``` 35 | 36 | ## Step 4: Run the Program 37 | 38 | Execute the compiled program with: 39 | 40 | ```bash 41 | ./toll_collection 42 | ``` 43 | 44 | ## Step 5: Interact with the Program 45 | 46 | Use the keyboard as described in the code comments: 47 | 48 | - Press `1-9` to add different types of vehicles. 49 | - Press `Space Bar` to start/stop the vehicle movement. 50 | - Press `Enter` to process an image for license plate detection. 51 | - Press `i` for instructions. 52 | - Press `p` for toll prices. 53 | - Press `q` to exit and show the total collected toll. 54 | 55 | ## Troubleshooting 56 | 57 | - **Missing Image**: Ensure the image path provided in the code exists. If not, change the path to an existing image. 58 | - **Compilation Errors**: If you encounter any errors during compilation, ensure all dependencies are correctly installed, and paths are correctly set. 59 | 60 | --- 61 | 62 | ## Check The Result 63 | 64 | Starting Window 65 | 66 | ![image](https://github.com/Karthikg1908/Toll-Collection-and-License-Plate-Recognition-System/assets/86306862/bacce3bf-e68e-4ef6-88e1-503b35c2e2c5) 67 | 68 | Home Page 69 | 70 | ![image](https://github.com/Karthikg1908/Toll-Collection-License-Plate-Recognition-System/assets/86306862/ea1cca46-ac7e-4dbd-9e1d-248a4fc38170) 71 | 72 | Instructions Window 73 | 74 | ![image](https://github.com/Karthikg1908/Toll-Collection-License-Plate-Recognition-System/assets/86306862/d12f6e42-f035-43a4-b53f-f15ff97ed5bc) 75 | 76 | Vehicle Toll Prices 77 | 78 | ![image](https://github.com/Karthikg1908/Toll-Collection-License-Plate-Recognition-System/assets/86306862/aa9c3b0e-9c00-4ad0-8266-6dc0714503bc) 79 | 80 | Vehicles Starting Point 81 | 82 | ![image](https://github.com/Karthikg1908/Toll-Collection-License-Plate-Recognition-System/assets/86306862/45855f2f-68fd-4193-b519-c4119b3ccc91) 83 | 84 | Vehicle Movement 85 | 86 | ![image](https://github.com/Karthikg1908/Toll-Collection-License-Plate-Recognition-System/assets/86306862/4b52e720-5a1e-46f3-b195-89cdf01f6012) 87 | 88 | Total Amount Collected 89 | 90 | ![image](https://github.com/Karthikg1908/Toll-Collection-License-Plate-Recognition-System/assets/86306862/597f35e1-29c6-4b85-a9a4-76035eab2734) 91 | 92 | Sample Number Plate 1 93 | 94 | ![image](https://github.com/Karthikg1908/Toll-Collection-License-Plate-Recognition-System/assets/86306862/c2dc842b-57b4-4d45-9ace-b828780b33ab) 95 | 96 | Number Plate Recognition 97 | 98 | ![image](https://github.com/Karthikg1908/Toll-Collection-License-Plate-Recognition-System/assets/86306862/7c5f4c45-da0a-45ef-b7e6-ce597996ec75) 99 | 100 | Sample Number Plate 2 101 | 102 | ![image](https://github.com/Karthikg1908/Toll-Collection-License-Plate-Recognition-System/assets/86306862/114ceb54-9c4b-4023-ab20-2bae90f4a234) 103 | 104 | Number Plate Recognition 105 | 106 | ![image](https://github.com/Karthikg1908/Toll-Collection-License-Plate-Recognition-System/assets/86306862/7d67964e-ab5f-4071-8705-a2712f77b847) 107 | -------------------------------------------------------------------------------- /toll_collection.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace cv; 15 | 16 | // Global variables for OpenGL window 17 | int windowWidth = 600; 18 | int windowHeight = 600; 19 | bool spacePressed = false; // Flag to track if space button is pressed 20 | bool showInstructions = false; 21 | bool showPrices = false; 22 | bool countdownStarted = false; 23 | int countdownTime = 5; // Countdown time in seconds 24 | int frameCount = 0; 25 | 26 | // Vehicle parameters 27 | float vehicleSpeed = 2.0; 28 | 29 | // Toll parameters 30 | float tollBoothPosition = 400.0; 31 | float motorcycleTollAmount = 25.0; 32 | float carTollAmount = 50.0; 33 | float busTollAmount = 80.0; 34 | float truckTollAmount = 110.0; 35 | float vanTollAmount = 70.0; 36 | float bicycleTollAmount = 10.0; 37 | 38 | float collectedTolls = 0.0; 39 | 40 | // Enum for vehicle types 41 | typedef enum { 42 | BICYCLE, 43 | MOTORCYCLE, 44 | CAR, 45 | VAN, 46 | BUS, 47 | TRUCK, 48 | SUV, 49 | TAXI, 50 | AMBULANCE, 51 | } VehicleType; 52 | 53 | // Structure for vehicles 54 | typedef struct { 55 | float position; 56 | VehicleType type; 57 | bool passedToll; // Flag to indicate if the vehicle has passed the toll 58 | } Vehicle; 59 | 60 | // Array of vehicles 61 | Vehicle vehicles[50]; // Increased the size to accommodate more vehicles 62 | int numVehicles = 0; 63 | 64 | // Project details 65 | const char* projectName = "Toll Collection & License Plate Recognition System"; 66 | const char* studentName = "Karthik G"; 67 | const char* guideName = "Prof. Usha M"; 68 | const char* teammate1 = " Karthik G"; 69 | const char* teammate2 = " Abhishek B C"; 70 | const char* teammate3 = " Prashanth"; 71 | const char* teammate4 = " Lakshminarsimha P K"; 72 | 73 | // Function declarations 74 | Mat preprocessImage(Mat img); 75 | std::vector detectNumberPlates(Mat edged); 76 | std::string recognizeNumberPlate(Mat img, Rect plateRect); 77 | void drawVehicle(float xPos, float yPos, VehicleType type); 78 | void drawTollBooth(float xPos); 79 | void drawText(float x, float y, const char* text); 80 | void updateVehicles(); 81 | void drawInstructions(); 82 | void drawPrices(); 83 | void processImage(); // Function to process image when Enter key is pressed 84 | void startCountdown(); // Function to start the countdown 85 | 86 | // Function to preprocess the image 87 | Mat preprocessImage(Mat img) { 88 | Mat gray, blurred, edged; 89 | cvtColor(img, gray, COLOR_BGR2GRAY); 90 | GaussianBlur(gray, blurred, Size(5, 5), 0); 91 | Canny(blurred, edged, 50, 200, 3); 92 | return edged; 93 | } 94 | 95 | // Function to detect potential number plates 96 | std::vector detectNumberPlates(Mat edged) { 97 | std::vector> contours; 98 | std::vector plates; 99 | 100 | findContours(edged, contours, RETR_TREE, CHAIN_APPROX_SIMPLE); 101 | for (size_t i = 0; i < contours.size(); i++) { 102 | Rect rect = boundingRect(contours[i]); 103 | if (rect.width > rect.height && rect.area() > 1000) { 104 | plates.push_back(rect); 105 | } 106 | } 107 | return plates; 108 | } 109 | 110 | // Function to perform OCR on detected number plates 111 | std::string recognizeNumberPlate(cv::Mat img, cv::Rect plateRect) { 112 | // Extract the region of interest (ROI) from the input image 113 | cv::Mat croppedImage = img(plateRect); 114 | 115 | // Convert the cropped image to a Pix structure 116 | std::vector buf; 117 | cv::imencode(".png", croppedImage, buf); 118 | Pix *pixImage = pixReadMem(buf.data(), buf.size()); 119 | 120 | if (!pixImage) { 121 | printf("Error: Could not convert Mat to Pix.\n"); 122 | return ""; 123 | } 124 | 125 | // Initialize Tesseract API 126 | TessBaseAPI *api = TessBaseAPICreate(); 127 | if (TessBaseAPIInit3(api, NULL, "eng")) { 128 | printf("Error: Could not initialize Tesseract.\n"); 129 | TessBaseAPIDelete(api); 130 | pixDestroy(&pixImage); 131 | return ""; 132 | } 133 | 134 | // Set image 135 | TessBaseAPISetImage2(api, pixImage); 136 | 137 | // Perform OCR 138 | TessBaseAPIRecognize(api, NULL); 139 | char *text = TessBaseAPIGetUTF8Text(api); 140 | std::string numberPlate(text); 141 | 142 | // Clean up 143 | TessDeleteText(text); 144 | TessBaseAPIDelete(api); 145 | pixDestroy(&pixImage); 146 | 147 | return numberPlate; 148 | } 149 | 150 | // Function to draw a vehicle 151 | void drawVehicle(float xPos, float yPos, VehicleType type) { 152 | switch (type) { 153 | case BICYCLE: 154 | // Draw line for bicycle 155 | glColor3f(0.1, 0.7, 0.3); // Green color 156 | glBegin(GL_LINES); 157 | glVertex2f(xPos - 10, yPos); 158 | glVertex2f(xPos + 10, yPos); 159 | glVertex2f(xPos + 10, yPos); 160 | glVertex2f(xPos + 20, yPos + 10); 161 | glVertex2f(xPos + 10, yPos); 162 | glVertex2f(xPos + 20, yPos - 10); 163 | glEnd(); 164 | break; 165 | case MOTORCYCLE: 166 | // Draw circle for motorcycle 167 | glColor3f(0.9, 0.1, 0.1); // Red color 168 | glBegin(GL_POLYGON); 169 | for (int i = 0; i < 360; i++) { 170 | float theta = i * M_PI / 180; 171 | glVertex2f(xPos + 10 * cos(theta), yPos + 10 * sin(theta)); 172 | } 173 | glEnd(); 174 | break; 175 | case CAR: 176 | // Draw square for car 177 | glColor3f(0.5, 0.5, 0.5); // Gray color 178 | glBegin(GL_POLYGON); 179 | glVertex2f(xPos - 10, yPos - 10); 180 | glVertex2f(xPos + 10, yPos - 10); 181 | glVertex2f(xPos + 10, yPos + 10); 182 | glVertex2f(xPos - 10, yPos + 10); 183 | glEnd(); 184 | break; 185 | case VAN: 186 | // Draw hexagon for van 187 | glColor3f(0.7, 0.5, 0.3); // Brown color 188 | glBegin(GL_POLYGON); 189 | glVertex2f(xPos - 10, yPos - 5); 190 | glVertex2f(xPos + 10, yPos - 5); 191 | glVertex2f(xPos + 15, yPos); 192 | glVertex2f(xPos + 10, yPos + 5); 193 | glVertex2f(xPos - 10, yPos + 5); 194 | glVertex2f(xPos - 15, yPos); 195 | glEnd(); 196 | break; 197 | case BUS: 198 | // Draw triangle for bus 199 | glColor3f(0.8, 0.6, 0.2); // Yellowish color 200 | glBegin(GL_POLYGON); 201 | glVertex2f(xPos, yPos - 10); 202 | glVertex2f(xPos + 20, yPos + 10); 203 | glVertex2f(xPos - 20, yPos + 10); 204 | glEnd(); 205 | break; 206 | case TRUCK: 207 | // Draw pentagon for truck 208 | glColor3f(0.3, 0.3, 0.7); // Blue color 209 | glBegin(GL_POLYGON); 210 | glVertex2f(xPos - 10, yPos - 5); 211 | glVertex2f(xPos + 10, yPos - 5); 212 | glVertex2f(xPos + 15, yPos); 213 | glVertex2f(xPos, yPos + 10); 214 | glVertex2f(xPos - 15, yPos); 215 | glEnd(); 216 | break; 217 | case SUV: 218 | // Draw trapezoid for SUV 219 | glColor3f(0.4, 0.2, 0.1); // Dark brown color 220 | glBegin(GL_POLYGON); 221 | glVertex2f(xPos - 15, yPos - 5); 222 | glVertex2f(xPos + 15, yPos - 5); 223 | glVertex2f(xPos + 20, yPos + 5); 224 | glVertex2f(xPos - 20, yPos + 5); 225 | glEnd(); 226 | break; 227 | case TAXI: 228 | // Draw rectangle for taxi 229 | glColor3f(1.0, 0.8, 0.0); // Yellow color 230 | glBegin(GL_POLYGON); 231 | glVertex2f(xPos - 10, yPos - 5); 232 | glVertex2f(xPos + 10, yPos - 5); 233 | glVertex2f(xPos + 10, yPos + 5); 234 | glVertex2f(xPos - 10, yPos + 5); 235 | glEnd(); 236 | break; 237 | case AMBULANCE: 238 | // Draw cross for ambulance 239 | glColor3f(1.0, 0.0, 0.0); // Red color 240 | glBegin(GL_LINES); 241 | glVertex2f(xPos - 10, yPos - 5); 242 | glVertex2f(xPos + 10, yPos + 5); 243 | glVertex2f(xPos - 10, yPos + 5); 244 | glVertex2f(xPos + 10, yPos - 5); 245 | glEnd(); 246 | break; 247 | } 248 | } 249 | 250 | // Function to draw the toll booth 251 | void drawTollBooth(float xPos) { 252 | glColor3f(0.3, 0.7, 0.3); // Green color 253 | glBegin(GL_POLYGON); 254 | glVertex2f(xPos, 0); 255 | glVertex2f(xPos + 100, 0); 256 | glVertex2f(xPos + 100, windowHeight); 257 | glVertex2f(xPos, windowHeight); 258 | glEnd(); 259 | } 260 | 261 | // Function to display text 262 | void drawText(float x, float y, const char* text) { 263 | glColor3f(0.0, 0.0, 0.0); // Black color 264 | glRasterPos2f(x, y); 265 | 266 | // Enable UTF-8 character encoding 267 | for (const char* c = text; *c != '\0'; ++c) { 268 | glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, *c); 269 | } 270 | } 271 | 272 | // Function to update vehicle positions 273 | void updateVehicles() { 274 | for (int i = 0; i < numVehicles; ++i) { 275 | if (!vehicles[i].passedToll) { 276 | vehicles[i].position += vehicleSpeed; 277 | if (vehicles[i].position >= tollBoothPosition) { 278 | switch (vehicles[i].type) { 279 | case BICYCLE: 280 | collectedTolls += bicycleTollAmount; 281 | break; 282 | case MOTORCYCLE: 283 | collectedTolls += motorcycleTollAmount; 284 | break; 285 | case CAR: 286 | collectedTolls += carTollAmount; 287 | break; 288 | case VAN: 289 | collectedTolls += vanTollAmount; 290 | break; 291 | case BUS: 292 | collectedTolls += busTollAmount; 293 | break; 294 | case TRUCK: 295 | collectedTolls += truckTollAmount; 296 | break; 297 | case SUV: 298 | collectedTolls += carTollAmount * 1.5; // SUV toll is 1.5 times car toll 299 | break; 300 | case TAXI: 301 | collectedTolls += carTollAmount; // Taxi toll same as car toll 302 | break; 303 | case AMBULANCE: 304 | // Ambulance toll exempted 305 | break; 306 | default: 307 | break; 308 | } 309 | vehicles[i].passedToll = true; 310 | } 311 | } 312 | } 313 | 314 | // Remove vehicles that have passed the toll 315 | int newNumVehicles = 0; 316 | for (int i = 0; i < numVehicles; ++i) { 317 | if (!vehicles[i].passedToll) { 318 | vehicles[newNumVehicles++] = vehicles[i]; 319 | } 320 | } 321 | numVehicles = newNumVehicles; 322 | } 323 | 324 | void drawInstructions() { 325 | // Display toll collection instructions on the screen 326 | glColor3f(0.2, 0.2, 0.8); // Navy blue color 327 | drawText(10, windowHeight - 30, "Toll Collection and License Plate Recognition System Instructions"); 328 | 329 | // Display instructions for adding vehicles 330 | glColor3f(0.0, 0.0, 0.0); // Black color 331 | drawText(10, windowHeight - 60, "Press 1-9 to add vehicles like bicycle, motorcycle, car, van, bus, truck, SUV, taxi, or ambulance."); 332 | drawText(10, windowHeight - 90, "Press 'Space Bar': Start/Stop"); 333 | drawText(10, windowHeight - 110, "Hit 'Enter' to begin number plate detection."); 334 | drawText(10, windowHeight - 140, "Press 'P' for price details"); 335 | } 336 | 337 | // Function to draw vehicle toll prices 338 | void drawPrices() { 339 | // Display vehicle toll prices 340 | glColor3f(0.0, 0.0, 0.0); // Black color 341 | drawText(10, windowHeight - 200, "Vehicle Toll Prices:"); 342 | drawText(10, windowHeight - 220, "Bicycle: ₹10.00"); 343 | drawText(10, windowHeight - 240, "Motorcycle: ₹25.00"); 344 | drawText(10, windowHeight - 260, "Car: ₹50.00"); 345 | drawText(10, windowHeight - 280, "Van: ₹70.00"); 346 | drawText(10, windowHeight - 300, "Bus: ₹80.00"); 347 | drawText(10, windowHeight - 320, "Truck: ₹110.00"); 348 | drawText(10, windowHeight - 340, "SUV: ₹75.00"); 349 | drawText(10, windowHeight - 360, "Taxi: ₹50.00"); 350 | drawText(10, windowHeight - 380, "Ambulance: Toll Exempted"); 351 | } 352 | 353 | // Function to process image 354 | void processImage() { 355 | // Load the image 356 | Mat image = imread("/home/karthi/Documents/n3.jpeg"); 357 | if (image.empty()) { 358 | printf("Error: Could not read the image.\n"); 359 | return; 360 | } 361 | 362 | // Preprocess the image 363 | Mat processedImage = preprocessImage(image); 364 | 365 | // Detect number plates 366 | std::vector plates = detectNumberPlates(processedImage); 367 | 368 | // Recognize number plates and print them 369 | for (size_t i = 0; i < plates.size(); i++) { 370 | std::string plateText = recognizeNumberPlate(image, plates[i]); 371 | printf("Detected Number Plate: %s\n", plateText.c_str()); 372 | } 373 | } 374 | 375 | // Function to start the countdown 376 | void startCountdown() { 377 | countdownStarted = true; 378 | } 379 | 380 | // Function to display teammate names 381 | void displayTeammates() { 382 | drawText(10, windowHeight - 80, "Project Developed By:"); 383 | drawText(10, windowHeight - 100, teammate1); 384 | drawText(10, windowHeight - 120, teammate2); 385 | drawText(10, windowHeight - 140, teammate3); 386 | drawText(10, windowHeight - 160, teammate4); 387 | } 388 | 389 | 390 | // Display callback function 391 | void display() { 392 | glClear(GL_COLOR_BUFFER_BIT); 393 | 394 | if (!countdownStarted) { 395 | // Display project details and countdown 396 | drawText(10, windowHeight - 20, projectName); 397 | drawText(windowWidth / 2 - 100, windowHeight / 2, "Designed by : "); 398 | drawText(windowWidth / 2 + 50, windowHeight / 2, studentName); 399 | drawText(windowWidth / 2 - 100, windowHeight / 2 - 20, "Under the guidance of : "); 400 | drawText(windowWidth / 2 + 50, windowHeight / 2 - 20, guideName); 401 | char countdownText[50]; 402 | sprintf(countdownText, "Starting in %d seconds...", countdownTime); 403 | drawText(windowWidth / 2 - 70, windowHeight / 2 - 50, countdownText); 404 | displayTeammates(); // Call to display teammates 405 | } else { 406 | if (showInstructions) { 407 | drawInstructions(); // Display instructions if needed 408 | } else if (showPrices) { 409 | drawPrices(); // Display vehicle toll prices if needed 410 | } else { 411 | drawTollBooth(tollBoothPosition); // Draw toll booth 412 | // Draw vehicles 413 | for (int i = 0; i < numVehicles; ++i) { 414 | drawVehicle(vehicles[i].position, 100 + i * 40, vehicles[i].type); 415 | } 416 | // Display collected toll amount 417 | char tollText[100]; 418 | sprintf(tollText, "Collected Tolls: ₹%.2f", collectedTolls); 419 | drawText(10, windowHeight - 20, tollText); 420 | } 421 | } 422 | 423 | // Display additional messages at the bottom left corner 424 | drawText(10, 20, "Press 'i' for instructions"); 425 | drawText(10, 40, "Press 'q' to exit"); 426 | 427 | glutSwapBuffers(); 428 | } 429 | 430 | 431 | 432 | // Keyboard callback function 433 | void keyboard(unsigned char key, int x, int y) { 434 | switch (key) { 435 | // Existing key cases... 436 | case 27: // ESC key 437 | exit(0); 438 | break; 439 | case 'i': 440 | case 'I': 441 | showInstructions = !showInstructions; // Toggle instructions display 442 | break; 443 | case 'p': 444 | case 'P': 445 | showPrices = !showPrices; // Toggle vehicle toll prices display 446 | break; 447 | case '1': 448 | vehicles[numVehicles++] = (Vehicle){0, BICYCLE, false}; 449 | break; 450 | case '2': 451 | vehicles[numVehicles++] = (Vehicle){0, MOTORCYCLE, false}; 452 | break; 453 | case '3': 454 | vehicles[numVehicles++] = (Vehicle){0, CAR, false}; 455 | break; 456 | case '4': 457 | vehicles[numVehicles++] = (Vehicle){0, VAN, false}; 458 | break; 459 | case '5': 460 | vehicles[numVehicles++] = (Vehicle){0, BUS, false}; 461 | break; 462 | case '6': 463 | vehicles[numVehicles++] = (Vehicle){0, TRUCK, false}; 464 | break; 465 | case ' ': 466 | spacePressed = !spacePressed; // Toggle space button state 467 | break; 468 | case '7': 469 | vehicles[numVehicles++] = (Vehicle){0, SUV, false}; 470 | break; 471 | case '8': 472 | vehicles[numVehicles++] = (Vehicle){0, TAXI, false}; 473 | break; 474 | case '9': 475 | vehicles[numVehicles++] = (Vehicle){0, AMBULANCE, false}; 476 | break; 477 | case '\r': // Enter key 478 | processImage(); 479 | break; 480 | case 'q': // Stop toll collection and display total amount collected 481 | printf("Total amount collected: ₹%.2f\n", collectedTolls); 482 | exit(0); 483 | break; 484 | } 485 | } 486 | // Timer callback function 487 | void timer(int value) { 488 | if (!countdownStarted) { 489 | // Countdown before starting simulation 490 | if (frameCount % 60 == 0 && countdownTime > 0) { 491 | countdownTime--; 492 | } 493 | if (countdownTime == 0) { 494 | startCountdown(); 495 | } 496 | } else { 497 | if (spacePressed) { 498 | updateVehicles(); // Update vehicle positions only when space is pressed 499 | } 500 | } 501 | frameCount++; 502 | glutPostRedisplay(); 503 | glutTimerFunc(1500 / 60, timer, 0); // 60 fps 504 | } 505 | 506 | // Reshape callback function 507 | void reshape(int w, int h) { 508 | glViewport(0, 0, (GLsizei)w, (GLsizei)h); 509 | glMatrixMode(GL_PROJECTION); 510 | glLoadIdentity(); 511 | gluOrtho2D(0.0, (GLdouble)w, 0.0, (GLdouble)h); 512 | glMatrixMode(GL_MODELVIEW); 513 | glLoadIdentity(); 514 | 515 | windowWidth = w; 516 | windowHeight = h; 517 | } 518 | 519 | // Main function 520 | int main(int argc, char** argv) { 521 | glutInit(&argc, argv); 522 | glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); 523 | glutInitWindowSize(windowWidth, windowHeight); 524 | 525 | // Create main window 526 | glutCreateWindow("Toll Collection and License Plate Recognition System"); 527 | glClearColor(1.0, 1.0, 1.0, 1.0); // White background 528 | glutDisplayFunc(display); 529 | glutKeyboardFunc(keyboard); 530 | glutReshapeFunc(reshape); 531 | glutTimerFunc(0, timer, 0); 532 | 533 | glutMainLoop(); 534 | return 0; 535 | } --------------------------------------------------------------------------------