python颜色参数palette_GitHub - alexwoo1900/colorpalette: Color palette written in Python and OpenCV - 调色...

Color palette written in Python and OpenCV

Demo

How to use it

Colorbar

Display Colorbar

colorbar = Colorbar() # Create an instance of Colorbar

bar_matrix = colorbar.get_cm() # Get matrix

cv2.imshow('color_bar_demo', cv2.cvtColor(bar_matrix, cv2.COLOR_HSV2BGR)) # Display colorbar

Colorstrip(slider)

colorstrip = Colorstrip(conf) # Create an instance of Colorstrip

colorstrip.connect(colorbar) # Bind colorstrip to colorbar

colorstrip.slide(x) # Make the strip slide to x

bar_matrix = colorstrip.get_cm() # Get matrix which contains colorbar and colorstrip

cv2.imshow('color_bar_demo', cv2.cvtColor(bar_matrix, cv2.COLOR_HSV2BGR)) # Display colorbar and colorstrip

Colorbar API

Colorbar.get_cm()

Get computational matrix. Format: [row, column, color_in_hsv]

Colorbar.get_color(x)

Get color by x value. Format: [h, s_max, v_max]

Colorstrip API

Colorstrip.connect(bar)

Bind the strip to a colorbar

Colorstrip.slide(x)

Make the strip slide to x

Colorstrip.get_cm()

Get computational matrix. Format: [row, column, color_in_hsv]

Colorboard

Display Colorboard

colorboard = Colorboard(conf) # Create an instance of Colorboard

colorboard.connect(colorbar) # Bind colorboard to colorbar

board_matrix = colorboard.get_subcm(x) # Get matrix

cv2.imshow('color_board_demo', cv2.cvtColor(board_matrix, cv2.COLOR_HSV2BGR) # Display colorboard

Colorpin

colorpin = Colorpin() # Create an instance of Colorpin

colorpin.connect(colorboard) # Bind colorpin to colorboard

colorpin.locate(x, y) # Put the pin to (x, y) in colorboard

board_matrix = colorpin.get_cm() # Get matrix which contains colorboard and colorpin

cv2.imshow('color_board_demo', cv2.cvtColor(board_matrix, cv2.COLOR_HSV2BGR) # Display colorboard and colorpin

Colorboard API

Colorboard.connect(bar)

Bind the board to a colorbar.

Colorboard.get_current_subcm()

Get current sub computational matrix. Format: [row, column, color_in_hsv]

Colorboard.get_subcm(hue)

Get sub computational matrix by a given hue. Format: [row, column, color_in_hsv]

Colorboard.get_color(x, y)

Get color by (x, y). Format: [h, s, v]

Colorboard.get_color_pos(color_in_hsv)

Get Color position by hsv. Format: [hue, row, column]

Colorpin API

Colorpin.connect(board)

Bind the pin to a colorboard

Colorpin.locate(x, y)

put the pin to (x, y) in colorboard

Colorpin.get_cm()

Get computational matrix. Format: [row, column, color_in_hsv]

Configuration

Section

Meaning

use_colorboard_rtcp

Real-time computing colorboard matrix

use_colorboard_cache

Use colorboard matrix cache

TO-DO list

Speed up the display of colorboard. (Optimize matrix calculation and compress cache file)

Add Color-positioning

Add Colorpicker module

License

MIT License

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值