We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fox.x
fov.y
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>FisheyeGl Demo</title> <script src="./dist/fisheyegl.js"></script> <style> body { font-family: Arial, sans-serif; } .container { max-width: 800px; margin: 0 auto; padding: 20px; } canvas { border: 1px solid #ccc; margin-bottom: 20px; } dl { margin-bottom: 20px; } dt { font-weight: bold; } dd { margin-bottom: 10px; } </style> </head> <body> <div class="container"> <h1>Lens Distortion Removal</h1> <p>Use the sliders to adjust lens distortion parameters and apply fisheye effect removal on the image below.</p> <div> <canvas id="canvas" width="800" height="600"></canvas> </div> <div> <dl> <dt>Fx</dt> <dd> <input id="Fx" type="range" min="0.0" max="2.0" value="1.0" step="0.01"/> </dd> <dt>Fy</dt> <dd> <input id="Fy" type="range" min="0.0" max="2.0" value="1.0" step="0.01"/> </dd> <dt>a</dt> <dd> <input id="a" type="range" min="0.0" max="4.0" value="1.0" step="0.001"/> </dd> <dt>b</dt> <dd> <input id="b" type="range" min="0.0" max="4.0" value="1.0" step="0.001"/> </dd> <dt>scale</dt> <dd> <input id="scale" type="range" min="0.0" max="20.0" value="1.0" step="0.001"/> </dd> <dt>fov x</dt> <dd><input id="fovx" type="range" min="0.0" max="2.0" value="1.0" step="0.001"/></dd> <dt>fov y</dt> <dd><input id="fovy" type="range" min="0.0" max="2.0" value="1.0" step="0.001"/></dd> </dl> </div> </div> <div> </div> <script> // Initialize FisheyeGl with an image var distorter = FisheyeGl({ image: './example/images/grid.jpg', // Make sure this image exists or replace it with a valid one selector: '#canvas'// Attach the canvas }); // Update the distortion parameters when sliders change function readSliders() { distorter.lens.a = parseFloat(document.getElementById("a").value); distorter.lens.b = parseFloat(document.getElementById("b").value); distorter.lens.Fx = parseFloat(document.getElementById("Fx").value); distorter.lens.Fy = parseFloat(document.getElementById("Fy").value); distorter.lens.scale = parseFloat(document.getElementById("scale").value); distorter.fov.x = parseFloat(document.getElementById("fovx").value); distorter.fov.y = parseFloat(document.getElementById("fovy").value); } // Listen to input changes and update the distortion document.querySelectorAll("input[type=range]").forEach(function(input) { input.addEventListener("input", function() { readSliders(); // Read the slider values distorter.run(); // Apply the distortion with updated parameters }); }); // Initial run to display the distortion on the canvas distorter.run(); </script> </body> </html>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: