diff --git a/ext/opencv/gstdisparity.cpp b/ext/opencv/gstdisparity.cpp
index f3f9d64..6752b3b 100644
--- a/ext/opencv/gstdisparity.cpp
+++ b/ext/opencv/gstdisparity.cpp
@@ -138,6 +138,7 @@ enum
 {
   PROP_0,
   PROP_METHOD,
+  PROP_MAX_DISP,
 };
 
 typedef enum
@@ -149,6 +150,7 @@ typedef enum
 } GstDisparityMethod;
 
 #define DEFAULT_METHOD METHOD_SGBM
+#define DEFAULT_MAX_DISPARITY 16
 
 #define GST_TYPE_DISPARITY_METHOD (gst_disparity_method_get_type ())
 static GType
@@ -232,6 +234,11 @@ gst_disparity_class_init (GstDisparityClass * klass)
           GST_TYPE_DISPARITY_METHOD, DEFAULT_METHOD,
           (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
 
+  g_object_class_install_property (gobject_class, PROP_MAX_DISP,
+      g_param_spec_uint ("max-disparity", "Max-disparity",
+          "Maximun disparity", 0, 255, DEFAULT_MAX_DISPARITY,
+          (GParamFlags) (G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS)));
+
   element_class->change_state = gst_disparity_change_state;
 
   gst_element_class_set_static_metadata (element_class,
@@ -284,6 +291,7 @@ gst_disparity_init (GstDisparity * filter)
   g_cond_init (&filter->cond);
 
   filter->method = DEFAULT_METHOD;
+  filter->max_disp = DEFAULT_MAX_DISPARITY;
 }
 
 static void
@@ -295,6 +303,9 @@ gst_disparity_set_property (GObject * object, guint prop_id,
     case PROP_METHOD:
       filter->method = g_value_get_enum (value);
       break;
+    case PROP_MAX_DISP:
+      filter->max_disp = g_value_get_uint (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -311,6 +322,9 @@ gst_disparity_get_property (GObject * object, guint prop_id,
     case PROP_METHOD:
       g_value_set_enum (value, filter->method);
       break;
+    case PROP_MAX_DISP:
+      g_value_set_uint (value, filter->max_disp);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -687,7 +701,7 @@ initialise_sbm (GstDisparity * filter)
   filter->sgc = cvCreateStereoGCState (16, 2);
 
   ((cv::StereoBM *) filter->sbm)->state->SADWindowSize = 9;
-  ((cv::StereoBM *) filter->sbm)->state->numberOfDisparities = 32;
+  ((cv::StereoBM *) filter->sbm)->state->numberOfDisparities = filter->max_disp;
   ((cv::StereoBM *) filter->sbm)->state->preFilterSize = 9;
   ((cv::StereoBM *) filter->sbm)->state->preFilterCap = 32;
   ((cv::StereoBM *) filter->sbm)->state->minDisparity = 0;
@@ -698,7 +712,7 @@ initialise_sbm (GstDisparity * filter)
   ((cv::StereoBM *) filter->sbm)->state->disp12MaxDiff = 0;
 
   ((cv::StereoSGBM *) filter->sgbm)->minDisparity = 1;
-  ((cv::StereoSGBM *) filter->sgbm)->numberOfDisparities = 64;
+  ((cv::StereoSGBM *) filter->sgbm)->numberOfDisparities = filter->max_disp;
   ((cv::StereoSGBM *) filter->sgbm)->SADWindowSize = 3;
   ((cv::StereoSGBM *) filter->sgbm)->P1 = 200;;
   ((cv::StereoSGBM *) filter->sgbm)->P2 = 255;
@@ -731,7 +745,7 @@ initialise_sbm (GstDisparity * filter)
   filter->sgc->interactionRadius = 1;
   filter->sgc->occlusionCost = 10000;
   filter->sgc->minDisparity = 0;
-  filter->sgc->numberOfDisparities = 16;        /* Coming from constructor too */
+  filter->sgc->numberOfDisparities = filter->max_disp;        /* Coming from constructor too */
   filter->sgc->maxIters = 1;    /* Coming from constructor too */
 
   return (0);
diff --git a/ext/opencv/gstdisparity.h b/ext/opencv/gstdisparity.h
index a1e0bdc..dd283c1 100644
--- a/ext/opencv/gstdisparity.h
+++ b/ext/opencv/gstdisparity.h
@@ -76,6 +76,7 @@ struct _GstDisparity
   int width;
   int height;
   int actualChannels;
+  unsigned int max_disp;
 
   GstBuffer *buffer_left;
   GMutex lock;
