Distortion parameters from vision sensor?
Distortion parameters from vision sensor?
Hey again,
I'm looking for a way to fill in the sensor_msgs/CameraInfo fields from a vision sensor. What's the best way to get the values for distortion parameters and everything ROS needs in order to work with it?
And thanks again!
Cheers,
Hendrik
I'm looking for a way to fill in the sensor_msgs/CameraInfo fields from a vision sensor. What's the best way to get the values for distortion parameters and everything ROS needs in order to work with it?
And thanks again!
Cheers,
Hendrik
Re: Distortion parameters from vision sensor?
Hello Hendrik,
not sure about the distorsion parameter. The vision sensors are software sensors and normally ideal, i.e. no distorsion. I guess it also really depends on what the other application is relying on (what of those parameters the other application is really using), but maybe you can find some answers around OpenGL, since the vision sensors are using it.
Cheers
not sure about the distorsion parameter. The vision sensors are software sensors and normally ideal, i.e. no distorsion. I guess it also really depends on what the other application is relying on (what of those parameters the other application is really using), but maybe you can find some answers around OpenGL, since the vision sensors are using it.
Cheers
Re: Distortion parameters from vision sensor?
I somehow figured it out myself. The easiest way to get the required parameters is by using camera calibration tools provided by the corresponding ROS package and creating an appropriate checker board in V-REP by hand (I used a texture made with The Gimp).
Re: Distortion parameters from vision sensor?
Hello Hendrik, you can find a simple way to compute the camera_info for a vision sensor in the ros plugin. In particular in the file ROS_server.cpp you can find the following code:
I have however a related question: how can one set more advanced camera parameters such as different pixel sizes for x and y and non-centered coordinates of the focal axis? This is very important for simulating a real camera for which a simple single focal-length model is not sufficient.
Even the possibility to simulate distortion would be very useful.
I will ask this in a separate faq.
Code: Select all
if (publishers[pubI].cmdID==simros_strmcmd_get_vision_sensor_info)
{
int resol[2];
int handle = publishers[pubI].auxInt1;
if (simGetVisionSensorResolution(handle,resol)!=-1)
{
sensor_msgs::CameraInfo info;
info.header.stamp = inf.headerInfo.stamp;
char* objName=simGetObjectName(handle);
info.header.frame_id = objNameToFrameId(objName);
simReleaseBuffer(objName);
info.width = resol[0];
info.height = resol[1];
simFloat view_angle = M_PI/4;
const unsigned int viewing_angle_id = 1004;
simGetObjectFloatParameter(handle, viewing_angle_id, &view_angle);
double f_x = (info.width/2.) / tan(view_angle/2.);
double f_y = f_x;
info.distortion_model = sensor_msgs::distortion_models::PLUMB_BOB;
info.D.resize(5);
info.D[0] = 0;
info.D[1] = 0;
info.D[2] = 0;
info.D[3] = 0;
info.D[4] = 0;
info.K[0] = f_x; info.K[1] = 0; info.K[2] = info.width/2;
info.K[3] = 0; info.K[4] = f_y; info.K[5] = info.height/2;
info.K[6] = 0; info.K[7] = 0; info.K[8] = 1;
info.R[0] = 1; info.R[1] = 0; info.R[2] = 0;
info.R[3] = 0; info.R[4] = 1; info.R[5] = 0;
info.R[6] = 0; info.R[7] = 0; info.R[8] = 1;
info.P[0] = info.K[0]; info.P[1] = 0; info.P[2] = info.K[2]; info.P[3] = 0;
info.P[4] = 0; info.P[5] = info.K[4]; info.P[6] = info.K[5]; info.P[7] = 0;
info.P[8] = 0; info.P[9] = 0; info.P[10] = 1; info.P[11] = 0;
publishers[pubI].generalPublisher.publish(info);
}
Even the possibility to simulate distortion would be very useful.
I will ask this in a separate faq.
Re: Distortion parameters from vision sensor?
Hello, SeveQ. Excuse me. I imported a texture to make a chessboard. Would you please tell me how to determine the size of the texture in order to determine the position of the chessboard on the object? Thanks in advance.
Re: Distortion parameters from vision sensor?
Hello,
how did you import the texture? (via GUI or via API, and how) And what is your goal?
Cheers
how did you import the texture? (via GUI or via API, and how) And what is your goal?
Cheers
Re: Distortion parameters from vision sensor?
Hello.Thank you for your reply!
I wanna achieve the robot positioning using markers such as chessboards and Aruco markers. So I loaded my texture via a PNG format image.
I need the size of the texture loaded into Coppeliasim but I can't.
I tried the point-point distance tool to measure the size of the chessboard. However, because the tool does not accurately select points, the true physical size cannot be measured.
I wanna achieve the robot positioning using markers such as chessboards and Aruco markers. So I loaded my texture via a PNG format image.
I need the size of the texture loaded into Coppeliasim but I can't.
I tried the point-point distance tool to measure the size of the chessboard. However, because the tool does not accurately select points, the true physical size cannot be measured.
Re: Distortion parameters from vision sensor?
So you already have your textured shape in a CoppeliaSim scene, and you need to know its size?
You have several possibilities:
You have several possibilities:
- if the shape is a cuboid or a primitive shape, then in the shape dialog, click View/modify geometry
- if the shape is a cuboid or a primitive shape, you can use sim.getShapeBB to get the shape's bounding box dimensions
- you can select the shape, then enter the shape vertex edit mode. Select 2 vertices, and it should display the distance between those 2 vertices.
Re: Distortion parameters from vision sensor?
Hello, thanks for your reply!
Maybe you didn't understand me or I didn't make it clear. As far as I know, there is no guarantee that the imported texture will exactly cover my shape. So setting the shape size cannot equal setting the texture size. So, how to determine the texture size?Any suggestions would be appreciated.
Thanks in advance.
Maybe you didn't understand me or I didn't make it clear. As far as I know, there is no guarantee that the imported texture will exactly cover my shape. So setting the shape size cannot equal setting the texture size. So, how to determine the texture size?Any suggestions would be appreciated.
Thanks in advance.
Re: Distortion parameters from vision sensor?
if you import a shape that is textured, then you can't know the size of the texture, or how the texture is scaled or applied to the surface, since this is usually done via texture coordinates, and a texture map can be highly fragmented and parts applied here and there on a shape..
But what you can do is create a planar surface with a specific texture on it. Have a look at sim.createTexture
Cheers
But what you can do is create a planar surface with a specific texture on it. Have a look at sim.createTexture
Cheers