-1

How to get intrinsic parameters of a smartphone camera using a mobile app?

I want to access camera parameters like camera matrix intrinsic parameters and distortion coefficients using a mobile app or using a browser of a smartphone iOS or Android

Ayo
  • 101
  • 5
  • pick an operating system? please review [ask]. present your research. – Christoph Rackwitz Jun 03 '23 at 09:53
  • this question is OS agnostic but I would say iOS & Android – Ayo Jun 03 '23 at 10:15
  • 1
    then I would suggest that you research "augmented reality" libraries for each. those would require intrinsics, so there's a good chance such libraries have ways of getting those. I've seen APIs from iOS itself that can provide the information. – Christoph Rackwitz Jun 03 '23 at 10:27

1 Answers1

0

I tested this of how you can implement the client-side code in JavaScript for capturing calibration images in a web app using the WebRTC API

Then, I added python calibration scripts in my bachend

<div>
  <video id="videoElement" width="640" height="480"></video>
  <button id="captureButton">Capture Image</button>
</div>

<script>
let videoElement = document.getElementById('videoElement');
let captureButton = document.getElementById('captureButton');
let stream;

// Function to start the video stream
async function startVideoStream() {
  try {
    stream = await navigator.mediaDevices.getUserMedia({ video: true });
    videoElement.srcObject = stream;
    videoElement.play();
  } catch (error) {
    console.error('Error accessing camera: ', error);
  }
}

// Function to capture an image from the video stream
function captureImage() {
  let canvas = document.createElement('canvas');
  canvas.width = videoElement.videoWidth;
  canvas.height = videoElement.videoHeight;
  canvas.getContext('2d').drawImage(videoElement, 0, 0, canvas.width, canvas.height);
  let image = canvas.toDataURL('image/jpeg');

  // Send the captured image to the server for processing
  sendImageToServer(image);
}

// Function to send the captured image to the server for processing
function sendImageToServer(image) {
  // Implement code to send the image data to the server using fetch or other AJAX methods
  // The server-side processing should perform the camera calibration and return the distortion parameters
  // Handle the response from the server to access the distortion parameters and use them as needed
}

// Start the video stream when the page loads
document.addEventListener('DOMContentLoaded', startVideoStream);

// Add event listener to the capture button
captureButton.addEventListener('click', captureImage);

</script>
Ayo
  • 101
  • 5