Camera tracking: forbid focal length=0 and small code cleanup
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 16 Nov 2011 10:00:02 +0000 (10:00 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 16 Nov 2011 10:00:02 +0000 (10:00 +0000)
extern/libmv/libmv-capi.cpp
source/blender/makesrna/intern/rna_tracking.c

index 9d6cfd5d17a7c9931d167c5a1dd8f3b95f5e4679..8c453944e9de780485a2631d341da0a33af12bbb 100644 (file)
@@ -368,14 +368,11 @@ libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyfra
        intrinsics->SetPrincipalPoint(principal_x, principal_y);
        intrinsics->SetRadialDistortion(k1, k2, k3);
 
-       if(focal_length) {
-               /* do a lens undistortion if focal length is non-zero only */
-               for (int i = 0; i < markers.size(); ++i) {
-                       intrinsics->InvertIntrinsics(markers[i].x,
-                               markers[i].y,
-                               &(markers[i].x),
-                               &(markers[i].y));
-               }
+       for (int i = 0; i < markers.size(); ++i) {
+               intrinsics->InvertIntrinsics(markers[i].x,
+                       markers[i].y,
+                       &(markers[i].x),
+                       &(markers[i].y));
        }
 
        libmv::Tracks normalized_tracks(markers);
index 368359925c416e72ce5b90a92f5e192959a06c43..73b2914fba1b52650f94c5300697c31f88d1c221 100644 (file)
@@ -169,7 +169,8 @@ static void rna_trackingCamera_focal_mm_set(PointerRNA *ptr, float value)
        if(clip->lastsize[0])
                value= clip->lastsize[0]*value/camera->sensor_width;
 
-       camera->focal= value;
+       if(value>=0.0001)
+               camera->focal= value;
 }
 
 static int rna_track_2d_stabilization(CollectionPropertyIterator *UNUSED(iter), void *data)
@@ -372,7 +373,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna)
        /* Focal Length */
        prop= RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "focal");
-       RNA_def_property_range(prop, 0.0f, 5000.0f);
+       RNA_def_property_range(prop, 0.0001f, 5000.0f);
        RNA_def_property_float_funcs(prop, "rna_trackingCamera_focal_mm_get", "rna_trackingCamera_focal_mm_set", NULL);
        RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length");
        RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);