Open janardhan1212 opened 7 years ago
There is an activity Here. Just run the activity once on your device and you'll be set to go.
I didn't find XML files for this activity and why should i run this activity?
I can't find these XML files either. Any luck @janardhan1212 @jsmith613 ?
Sorry, been busy with schoolwork recently. So basically, lots of openCV and aruco methods require camera parameters as an input. To get those camera parameters, you need to run a calibration activity. You only need to run this once for a device and the parameters can be saved on your device. I believe I posted the wrong calibration activity on here. I'll take a look and see if I can get it working.
Hi all =) Rough and extremely fast solution - instead of loading camera parameters from file, create CameraParameters with some generic hardcoded data...
Add below code to CameraParameters class / -------------- ADD TO CameraParameters -----------/ public void loadConstandCalibration() { cameraMatrix.put(0,0, 100000, 0.0, 960, 0.0, 100000, 540, 0.00000, 0.00000, 1.00000 );
double[] distArray = { 0.0,
0.0,
0.0,
0.0,
0.0
};
distorsionMatrix.fromArray(distArray);
} / ----------------------------------------------------------/ Here is fx fy - focal length; fx=100000, fy=100000 cx cy - camera center in pixels(my camera 1920x1080) cx=960 cy=540 works pretty well on Note 4
Force MarkerTracker to load hardcpded data instead of loading file a) find and comment this line: camParams.readFromFile(Environment.getExternalStorageDirectory().toString() + DATA_FILEPATH); ...it becomes: //camParams.readFromFile(Environment.getExternalStorageDirectory().toString() + DATA_FILEPATH);
b) next to connemted line add this code: camParams.loadConstandCalibration(); ...it becomes //camParams.readFromFile(Environment.getExternalStorageDirectory().toString() + DATA_FILEPATH); camParams.loadConstandCalibration();
b) Move line "newMarkers.add(marker);" outside the IF statement ... int id = marker.calculateMarkerId(); if(id != -1){ // rotate the points of the marker so they are always in the same order no matter the camera orientation Collections.rotate(marker.toList(), 4-marker.getRotations()); newMarkers.add(marker); // inside the IF statement } newMarkers.add(marker); // outside the IF statement ...
Now all the stuff should work... Enjoy =)
Hey. I am trying to get this library to work on Android Studio 3.0. I am still having trouble with trying to run the camera calibration.
Can someone explain to me what I am supposed to do in order to run the camera calibration? Should I change anything in the AndroidManifest.xml in openCVTutorial1CameraPreview?
I tried the FrayaMiner's approach, and it works, but it makes the camera look distorted in color.
Hi, thanks for sharing this project. how to run this calibration?