createTrackbar warns that value pointer is deprecated. But is there any other way to set trackbar's initial position?

use a pattern like:

createTrackbar( "Canny thresh:", source_window, nullptr, thresh_max, thresh_callback );
setTrackbarPos( "Canny thresh:", source_window, thresh);

also, docs:
https://docs.opencv.org/4.x/d7/dfc/group__highgui.html#ga67d73c4c9430f13481fd58410d01bd8d

2 Likes