当前位置:网站首页>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 .
边栏推荐
- Configure cross domain requests
- 代码签名、驱动签名的常见问题解答
- 银行的理财产品一般期限是多久?
- dhu编程练习
- 记录生产的一次OOM异常
- [protection mode] segment descriptor
- [MySQL 06] backup and restore MySQL database in Linux + docker container environment
- DDoS threat situation gets worse
- 希尔排序
- Est - ce que la bourse en ligne est sécurisée? Dois - je ouvrir un compte pour la spéculation boursière?
猜你喜欢

Matlab 2012a drawing line segment with arrow

Traffic, but no sales? 6 steps to increase website sales

【干货分享】最新WHQL徽标认证申请流程

Shell Sort

Jenkins continuous integration environment construction VII (Jenkins parametric construction)

CTF入门学习(Web方向)

33Mysql

主流CA吊销俄罗斯数字证书启示:升级国密算法SSL证书,助力我国网络安全自主可控

Quick sort

33Mysql
随机推荐
dhu编程练习
走进江苏作家诗人胭脂茉莉|世界读书日
widget使用setImageViewBitmap方法设置bug分析
26.算法常用面试题
归并排序
Global communication infrastructure faces apt, robotics and DDoS; The weakest mobile network
如何预防钓鱼邮件?S/MIME邮件证书来支招
Can autojs code be encrypted? Yes, display of autojs encryption skills
9 — 正则校验集合
What are the payment and distribution systems?
Large scale DDoS attacks and simulated DDoS tests against VoIP providers
PR second training notes
Illustration Google V8 19: asynchronous programming (II): how does V8 implement async/await?
Internet Crime Complaint Center reports an increase in DDoS Attacks
论文回顾:Playful Palette: An Interactive Parametric Color Mixer for Artists
Digicert、Sectigo、Globalsign代码签名证书的区别
Openlayers 3 built in interaction
dhu编程练习
1380. lucky numbers in matrices
VScode如何Debug(调试)进入标准库文件/第三方包源码