Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Trackbar in opencv

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you how to use Trackbar in opencv. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Code display:

Import numpy as npimport cv2 as cvdef nothing (x): # callback function, x is the value of the cursor on the current trackbar # print (x) pass # do nothing # Create a black image, a windowimg = np.zeros ((500 image4LinMaZi' 1000 image4LinMaZi' 3), np.uint8) cv.namedWindow ('image4LinMaZi') # create trackbars for color changecv.createTrackbar (' Randall name, default value, maximum value, callback function cv.createTrackbar ('greenen`) 'image4LinMaZi',0,255,nothing) cv.createTrackbar (' Bamboo bluetooth recordings image4LinMaZiqi repositories 0pc255 nothing) # create switch for ON/OFF functionalityswitch = '0:OFF\ n1:ON'cv.createTrackbar (switch,' image4LinMaZi',0,1,nothing) while True:cv.imshow ('image4LinMaZi',img) k = cv.waitKey (1) & 0xFFif k = = 27:break# get current positions of four trackbarsr = cv.getTrackbarPos (' rattled blueprints heroic image4LinMaZi') g = cv.getTrackbarPos ('green.' 'image4LinMaZi') b = cv.getTrackbarPos (' Bamboo bluetooth recording image4LinMaZi') s = cv.getTrackbarPos (switch,'image4LinMaZi') if s = = 0:img [:] = 0else:img [:] = [bmaegMagne r] cv.destroyAllWindows ()

The screenshot of the running result shows:

The above is how to use Trackbar in opencv. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report