当前位置:网站首页>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 .
边栏推荐
- Dynamic SQL
- Le Code autojs peut - il être chiffré? Oui, présentation des techniques de chiffrement autojs
- FDA邮件安全解决方案
- 網上炒股安全麼?炒股需要開戶嗎?
- Encapsulate a complete version of the uniapp image and video upload component, which can be used immediately, switch between images and videos, customize the upload button style, delete the button sty
- 主流CA吊销俄罗斯数字证书启示:升级国密算法SSL证书,助力我国网络安全自主可控
- Realization of a springboard machine
- How difficult is the PMP Exam under the new syllabus? Comprehensive analysis
- Upload, use of Avatar
- 9 — 正则校验集合
猜你喜欢

How to create a CSR (certificate signing request) file?

After the blueprint node of ue5 is copied to UE4, all connections and attribute values are lost

Can autojs code be encrypted? Yes, display of autojs encryption skills

1380. lucky numbers in matrices

DMX configuration

VScode如何Debug(调试)进入标准库文件/第三方包源码

每周推荐短视频:为什么理论正确但得不到预期结果?

如何使用SMS向客户传递服务信息?指南在这里!

33Mysql

桶排序
随机推荐
Global communication infrastructure faces apt, robotics and DDoS; The weakest mobile network
The largest DDoS attack ever peaked at 400 Gbps
实现VS每次只运行一个源文件
PR second training notes
Vs realize quick replacement function
dhu编程练习
速看 2021-2022年23项重大网络犯罪统计数据
DHU programming exercise
Widget uses setimageviewbitmap method to set bug analysis
如何预防钓鱼邮件?S/MIME邮件证书来支招
Weekly recommended short video: why is the theory correct but can not get the expected results?
Blue Bridge Cup stm32g431 - three lines of code for keys (long press, short press, click, double click)
DDoS "fire drill" service urges companies to prepare
8 — router
DDoS attacks and destructive ripple effects against online gamers
希尔排序
每周推荐短视频:为什么理论正确但得不到预期结果?
What is a dangling pointer- What is a dangling pointer?
JS advanced -es6 syntax
dhu编程练习