How to convert the radius from meter to pixel?

2024/11/18 9:32:59

I have a camera with these specs:

  • full resolution 1280x1024
  • pixel size 0.0048mm
  • focal length 8 mm

I need to detect a ball in this image. It is 4 meters away and its radius is 0.0373 meter.

How to convert the radius to from meter to pixel in this case?

the reason is that I need to use cv2.HoughCircles() and need to have the value for this function.

Answer

Pinhole camera model.

  • Focal length (mm): 8 mm
  • Sensor pixel pitch: 4.8 µm/px
  • Focal length (px): 8 mm / (4.8 µm/px) = 1667 px =: f

Object:

  • Width: 0.0373 m
  • Distance: 4 m

Projection of object (px): (0.0373 m / 4 m) * f = 15.5 px

So that ball will appear to be 15.5 pixels in size.

https://en.xdnf.cn/q/118691.html

Related Q&A

Calculting GPA using While Loop (Python)

A GPA, or Grade point Average, is calculated by summing the grade points earned in a student’s courses and then dividing by the total units. The grade points for an individual course are calculated by…

Return function that modifies the value of the input function

How can I make a function that is given a function as input and returns a function with the value tripled. Here is some pseudo code for what Im looking for. Concrete examples in Python or Scala would b…

how to access the list in different function

I have made a class in which there are 3 functions. def maxvalue def min value def getActionIn the def maxvalue function, I have made a list of actions. I want that list to be accessed in def getaction…

Replacing numpy array with max value [duplicate]

This question already has answers here:numpy max vs amax vs maximum(4 answers)Closed 2 years ago.I have an array, a = np.array([[0,9,8],[5,6,4]])how to replace the each array in axis 1 with the max val…

Finding the max and min in dictionary as tuples python

so given this dictionary im trying to find the max value and min value {Female :[18,36,35,49,19],Male :[23,22,6,36,46]}the output should be in tuples for example key: (min,max)Female: (18,49) Male: (6,…

Flask sqlalchemy relations across multiple files

Im new to Flask Sqlalchemy and I want to declare multiple models and relate them to each other, I followed the example in the documentation but I keep getting this error sqlalchemy.exc.InvalidRequestEr…

Parsing XML with Pykml

I have the following xml file I got from QGIS<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.…

Python Google App Engine Receiving a string in stead of JSON object

I am sending a HTTP POST request from android to a server using the script belowURI website = new URI("http://venkygcm.appspot.com");HttpClient client = new DefaultHttpClient();HttpPost reque…

Creating Gui for python client server

Help needed with my python project. Unable to get the code for the client or server implemented with the Gui i created. it is one based on book seller where the client is the buyer and the server is th…

Maximum Subarray sum - Where is my solution wrong? Kadanes Algorithm

Here is a description of the problem:The maximum sum subarray problem consists in finding the maximum sum of a contiguous subsequence in an array or list of integers: max_sequence([-2, 1, -3, 4, -1, 2,…