Experiments to evaluate distance
In order to find a distance that can give us better results with the camera that we are using, we did several experiments to see which one gave us a better answer. We are using always a resolution of 2448 x 3264.
To calculate the length of the object in the following five experiments we used this program:
And to calculate the % error we used the following program:
We used this picture:
To calculate the length of the object in the following five experiments we used this program:
#include <iostream>
using namespace std;
float lmc, lmp, lop, w, h;
void calc_length(float a, float b, double c){
double scale, loc;
scale= a/b; //We get how many centimeters a pixels is
loc= c*scale;
cout<<"The length of your object is of: "<<loc<<" cm. "<<loc*0.39370079<<" inches.";
}
int main() {
cout<<"I give the lengths of an object in centimeters and inches, or angles in radians and degrees, all of this using a digital picture with a marker information."<<endl<<endl;
cout<<"Tell me the length of your marker (in cm.): ";
cin>>lmc;
cout<<"Tell me the length of your marker (in pixels): ";
cin>>lmp;
cout<<"Tell me the length of your object (in pixels): ";
cin>>lop;
while(((lmp>=2448)&&(lmp>=3264))||((lop>=2448)&&(lop>=3264))){
cout<<"You are giving a pixel size of one of your objects bigger than your actual image, the objects you want to measure MUST be inside the image.\n";
cout<<"Tell me again the length of your marker (in pixels): ";
cin>>lmp;
cout<<"Tell me again the length of your object (in pixels): ";
cin>>lop;
}
calc_length(lmc, lmp, lop);//We still need to make the program to only show either measures or angles
}
And to calculate the % error we used the following program:
#include <iostream>
using namespace std;
float mr, mo, per;
int main() {
cout<<"Value of measure with ruler (real value): ";
cin>>mr;
cout<<"Value of measure obtained: ";
cin>>mo;
per=((mr-mo)/mr)*100;
cout<<"The error obtained was of: "<<per<<"%"<<endl<<endl;
return 0;
}
We used this picture:
1.-
Resolution: 2448 x 3264
Marker size: 21cm.- 476pixels.
Object size: 1405 pixels.
Inclination of the camera of 0º with respect of the object.
Distance from the object: 1.4 meters.
Actual size of the object I want to measure: 60 cm. - 23.62 inches.
%Error: 3.08817 %
1 pixel :: 0.04411764 cm.
Object size: 1405 pixels.
Inclination of the camera of 0º with respect of the object.
Distance from the object: 1.4 meters.
Actual size of the object I want to measure: 60 cm. - 23.62 inches.
%Error: 3.08817 %
1 pixel :: 0.04411764 cm.
2.-
Resolution: 2448 x 3264 pixels.
Marker size: 21cm.-318 pixels.
Object size: 919 pixels.
Inclination of the camera of 0º with respect of the object.
Distance from the object: 2 m.
Actual size of the object I want to measure: 60 cm. - 23.62 inches.
%Error: 1.1478%
1 pixel :: 0.066038 cm.
Marker size: 21cm.-318 pixels.
Object size: 919 pixels.
Inclination of the camera of 0º with respect of the object.
Distance from the object: 2 m.
Actual size of the object I want to measure: 60 cm. - 23.62 inches.
%Error: 1.1478%
1 pixel :: 0.066038 cm.
3.-
Resolution: 2448 x 3264
Marker size: 21cm.- 307pixels.
Object size: 901 pixels.
Inclination of the camera of 0º with respect of the object.
Distance from the object: 2.15 meters.
Actual size of the object I want to measure: 60 cm. - 23.62 inches.
%Error: 2.7198%
1 pixel :: 0.0684039 cm.
Object size: 901 pixels.
Inclination of the camera of 0º with respect of the object.
Distance from the object: 2.15 meters.
Actual size of the object I want to measure: 60 cm. - 23.62 inches.
%Error: 2.7198%
1 pixel :: 0.0684039 cm.
4.-
Resolution: 2448 x 3264
Marker size: 21cm.- 289 pixels.
Object size: 842 pixels.
Inclination of the camera of 0º with respect of the object.
Distance from the object: 2.3 meters.
Actual size of the object I want to measure: 60 cm. - 23.62 inches.
%Error: 1.97233%
1 pixel :: 0.0726643 cm.
Object size: 842 pixels.
Inclination of the camera of 0º with respect of the object.
Distance from the object: 2.3 meters.
Actual size of the object I want to measure: 60 cm. - 23.62 inches.
%Error: 1.97233%
1 pixel :: 0.0726643 cm.
5.-
Resolution: 2448 x 3264
Marker size: 21cm.- 254 pixels.
Object size: 746 pixels.
Inclination of the camera of 0º with respect of the object.
Distance from the object: 2.6 meters.
Actual size of the object I want to measure: 60 cm. - 23.62 inches.
%Error: 2.79533%
1 pixel :: 0.0826771 cm.
Object size: 746 pixels.
Inclination of the camera of 0º with respect of the object.
Distance from the object: 2.6 meters.
Actual size of the object I want to measure: 60 cm. - 23.62 inches.
%Error: 2.79533%
1 pixel :: 0.0826771 cm.
After doing all these experiments, it seems that working 2 meters away from the image would be the best, which seems odd, because one would think that if you get closer to the image, one would get better results. Later on we'll do more experiments in order to prove or disprove this assumption.
No hay comentarios:
Publicar un comentario