当前位置:网站首页>Playful palette: an interactive parametric color mixer for artists
Playful palette: an interactive parametric color mixer for artists
2022-06-30 02:22:00 【Researcher-Du】
Playful Palette: An Interactive Parametric Color Mixer for Artists Published in TOG 2017, This paper presents a new palette called :Playful Palette. Like the previous palette, for example [Chang 2013] Clustering based palette and [Tan 2017] The difference between convex hull based palettes is , The previous palette can only modify the colors of existing images . But this article has really generated the color palette that can be used by painters , That is, multiple colors can be generated ( Pigment ) Blend gradient colors for .
The customary , Take the last one teaser.(a) Inside the middle circle is the palette generated by several colors currently used , You can see that there is a smooth gradient effect . On the circle are historical color records , And the palette of the moment corresponding to each color outside the circle , This is mainly used to go back to a certain step or change the color .(b) Select a color painting in the palette ;(c) Painting effect ,(d) Modify image colors through palette history .
Paper points out Color Picker The research of has not been paid attention to , The current color user interface has been unable to meet the needs of digital painting . At first, the paper makes a preliminary user survey on the problems of digital painting . Research indicates that there are Color Picker The most obvious drawback is the inability to mix multiple colors , But real painting often needs to make a variety of pigments into new colors to meet the demand . therefore , The most important contribution of this paper is to propose a new palette that can mix multiple colors and generate smooth color gradient effects .
One 、Playful Palette principle
The palette consists of a plurality of circular color drops (Blob) Generate , Each color drop can be represented as a Yuanzu : B i = ( r i , g i , b i , x i , y i , r i ) B_i = (r_i,g_i,b_i,x_i,y_i, r_i) Bi=(ri,gi,bi,xi,yi,ri), among c i = ( r i , g i , b i ) c_i=(r_i,g_i,b_i) ci=(ri,gi,bi) It's the color of this water drop , p i = ( x i , y i ) p_i=(x_i,y_i) pi=(xi,yi) and r i r_i ri The center and radius of the water drop respectively .
Given a rectangular or circular bounding box ( In a word, all color drops are covered ), And multiple color drops inside B { B 1 , B 2 , . . . B k } B\{B_1,B_2,...B_k\} B{ B1,B2,...Bk}, We want to get a palette of these water droplets . Intuitively , Each color drop corresponds to a circular area , The pixels in the bounding box are closer to which water drop is located , The closer the color is . So , We traverse each position in the bounding box and calculate their color .
A pixel in the bounding box p p p Receiving water drop B i B_i Bi The influence weight of can be expressed as :
M i ( p ) = F ( B i , p ) = { 1 − 4 d 6 9 b 6 + 17 d 4 9 b 4 − 22 d 2 9 b 2 d ≤ b 0 else (1) M_i(p) = F(B_i,{p})=\left\{\begin{array}{ll} 1-\frac{4 d^{6}}{9 b^{6}}+\frac{17 d^{4}}{9 b^{4}}-\frac{22 d^{2}}{9 b^{2}} & d \leq b \\ 0 & \text { else } \end{array}\right.\tag1 Mi(p)=F(Bi,p)={ 1−9b64d6+9b417d4−9b222d20d≤b else (1)
among , d d d Express p p p To Water drop B i B_i Bi The center of the circle ( x i , y i ) (x_i,y_i) (xi,yi) Distance of , b b b Is an adjustment parameter, which can be taken as the radius, i.e : b = r i b = r_i b=ri.
During palette drawing , The same pixel is affected by the sum of the weights of multiple water droplets Draw only when it is greater than a given threshold , Otherwise it's white .
c ( p ) = { ∑ i M i ( p ) ⋅ c i ∑ i M i ( p ) ∑ i M i ( p ) > = T w h i t e else (2) c(p) = \left\{\begin{array}{ll} \frac{\sum_i M_i(p) \cdot c_i}{\sum_i M_i(p) } & \sum_i M_i(p) >= T \\ white & \text { else } \end{array}\right. \tag2 c(p)={ ∑iMi(p)∑iMi(p)⋅ciwhite∑iMi(p)>=T else (2)
here T = 0.6 T = 0.6 T=0.6.
Actually , The boundary of the palette of water droplet generation is The formula (2) Corresponding c ( p ) = T c(p) = T c(p)=T The isoline of the , Blogger Birdy_C Draw a diagram showing the composite effect of two water drops .
It should be noted that , Modify the formula (1) in b b b The value of can change the influence range of each water drop . We make z = d / b z = d/b z=d/b, Then the above formula will be d < b d < b d<b When established , M i ( p ) M_i(p) Mi(p) Can be written as :
M i ( p ) = 1 − 4 9 x 6 + 17 9 x 4 − 22 9 x 2 M_i(p) = 1 - \frac{4}{9}x^6 + \frac{17}{9}x^4 - \frac{22}{9}x^2 Mi(p)=1−94x6+917x4−922x2
The image of this function is as follows : It can be seen that the dry function is 0,1 Monotonically decreasing between , That is, when we change, we grow b b b, x = d / b x = d/b x=d/b smaller , thus M i ( p ) M_i(p) Mi(p) Bigger , Therefore, the influence range of water droplets becomes larger .

The color palette effect is obtained by the generation of multiple water drops given in the paper :
Two 、 Simple implementation
#include <vector>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
void DrawPlayfulPalette() {
vector<Vec6d> blobs; //r,g,b,x,y
blobs.push_back(Vec6d(255, 0, 0, 120, 45));
blobs.push_back(Vec6d(0, 0, 255, 120, 135));
blobs.push_back(Vec6d(0, 255, 0, 50, 90));
int rows = 200, cols = 200;
cv::Mat img = cv::Mat(rows, cols, CV_8UC3, Scalar(255, 255, 255));
for (int r = 0; r < rows; r++) {
uchar* data = img.ptr<uchar>(r);
for (int c = 0; c < cols; c++) {
Vec2d pix_pos(r , c);
Vec3d sum_color(0, 0, 0);
Vec3i res_color(0, 0, 0);
double sum_w = 0;
for (int i = 0; i < blobs.size(); i++) {
Vec3d blob_color(blobs[i][0], blobs[i][1], blobs[i][2]);
Vec2d blob_pos(blobs[i][3], blobs[i][4]);
double d2 = (pix_pos - blob_pos).dot(pix_pos - blob_pos);
double b2 = 70 * 70;
double db = d2 / b2;
double w = d2 <= b2 ? 1 - 4 / 9 * pow(db, 3) + 17 / 9 * pow(db, 2) - 22 / 9 * db : 0;
sum_w += w;
sum_color += w * blob_color;
}
res_color = sum_w < 0.6 ? Vec3d(255, 255, 255): sum_color / sum_w;
data[3 * c + 0] = res_color[2];
data[3 * c + 1] = res_color[1];
data[3 * c + 2] = res_color[0];
}
}
imshow("PlayfulPalette", img);
waitKey();
}
Draw a few simple palette effects :
The rest of the article focuses on how to keep historical records , I'm not very interested in , So I won't repeat .
边栏推荐
- Blue Bridge Cup stm32g431 - three lines of code for keys (long press, short press, click, double click)
- True love forever valentine's Day gifts
- Learning C language from scratch day 026
- [naturallanguageprocessing] [multimodality] ofa: unified architecture, tasks and modes through a simple sequence to sequence learning framework
- Copy entire directory to output folder maintain folder structure- Copy entire directory to output folder maintaining the folder structure?
- Shell Sort
- 新考纲下的PMP考试有多难?全面解析
- Bucket sort
- 打造创客教育中精湛技艺
- Est - ce que la bourse en ligne est sécurisée? Dois - je ouvrir un compte pour la spéculation boursière?
猜你喜欢

AutoJS代码能加密吗?YES,AutoJS加密技巧展示

Simple distinction between break and continue

Widget uses setimageviewbitmap method to set bug analysis

SSL证书格式转化的两种方法

有流量,但没有销售?增加网站销量的 6 个步骤

Insert sort directly

33Mysql

快速排序
![[MySQL 05] SUSE 12 SP5 modifies the MySQL password for the first time after installing MySQL](/img/37/d24c9e5fad606d2623900ad018b6af.png)
[MySQL 05] SUSE 12 SP5 modifies the MySQL password for the first time after installing MySQL

【银河麒麟V10】【桌面】火狐浏览器设置主页不生效
随机推荐
What are the payment and distribution systems?
Recheck on February 15, 2022
Traffic, but no sales? 6 steps to increase website sales
DigiCert Smart Seal是什么?
一种跳板机的实现思路
选购通配符SSL证书注意事项
9 - regular check set
How difficult is the PMP Exam under the new syllabus? Comprehensive analysis
Some practical knowledge about PR
Select sort
Le Code autojs peut - il être chiffré? Oui, présentation des techniques de chiffrement autojs
新考纲下的PMP考试有多难?全面解析
SQL injection -day17
Dynamic SQL
Implement vs to run only one source file at a time
JS reverse case -rus5 logic learning
dhu编程练习
什么是自签名证书?自签名SSL证书的优缺点?
[MySQL 05] SUSE 12 SP5 modifies the MySQL password for the first time after installing MySQL
dhu编程练习