How can I set the default position of a trackbar in OpenCV?
<p>In OpenCV, using the createTrackbar function, how can someone set the default slider position to a maximum?</p>

<p>I have several sliders, some representing minimum values, and some representing maximum values. It would be nice, if the sliders for a max value, started out at the maximum (255), rather than the minimum (0). </p>

<p>I have looked around on the <a href="http://docs.opencv.org/2.4/modules/highgui/doc/user_interface.html" rel="nofollow">OpenCV documentation pages</a>, but I have not located a solution.</p>

<pre><code>import cv2
import numpy as np

def nothing(x):
    pass

# Create a black image, a window
#img = np.zeros((300,512,3), np.uint8)
cv2.namedWindow('image')
cv2.namedWindow('hsv')
cv2.namedWindow('masq')
cap = cv2.VideoCapture(0)

# create trackbars for color change
cv2.createTrackbar('R-low','image',0,255,nothing)
cv2.createTrackbar('R-high','image',0,255,nothing)

cv2.createTrackbar('G-low','image',0,255,nothing)
cv2.createTrackbar('G-high','image',0,255,nothing)

cv2.createTrackbar('B-low','image',0,255,nothing)
cv2.createTrackbar('B-high','image',0,255,nothing)


while(1):
    ret, img = cap.read()
    # Convert BGR to HSV
    hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)

    cv2.imshow('image',img)
    k = cv2.waitKey(1) &amp; 0xFF
    if k == 27:
        break

    # get current positions of four trackbars
    rl = cv2.getTrackbarPos('R-low','image')
    rh = cv2.getTrackbarPos('R-high','image')

    gl = cv2.getTrackbarPos('G-low','image')
    gh = cv2.getTrackbarPos('G-high','image')

    bl = cv2.getTrackbarPos('B-low','image')
    bh = cv2.getTrackbarPos('B-high','image')

    lower = np.array([rl,gl,bl])
    upper = np.array([rh,gh,bh])

    print(rl)

    img[:] = [bl,gl,rl]

    # Threshold the HSV image to get only certain colors
    mask = cv2.inRange(hsv, lower, upper)    


    res = cv2.bitwise_and(img,img, mask= mask)

    cv2.imshow('image',img)
    cv2.imshow('masq',mask)
    cv2.imshow('hsv',hsv)


cv2.destroyAllWindows()
</code></pre>

<p>On load, it ends up looking like this:</p>

<p><a href="http://i.stack.imgur.com/6psbg.png" rel="nofollow"><img src="http://i.stack.imgur.com/6psbg.png" alt="enter image description here"></a></p>

<p>I think you didn't pay much attention reading documentation, there you can find:<br>
<strong>value</strong> â Optional pointer to an integer variable whose value reflects the position of the slider. Upon creation, the slider position is defined by this variable.<br>
<strong>count</strong> â Maximal position of the slider. The minimal position is always 0.<br></p>

<p>As i can understand this, you need just to set a <code>value</code> to the same like a <code>count</code> </p>

python opencv