題目:可見浮水印
前言
浮水印的概念其實很簡單,首先我們會有一張底圖,還有一張需要印上去的圖
然後將底圖的顏色全部*某個小於1的係數
將浮水印的圖增加10%~20% 依需求所定
再將兩張圖疊合在一起,看起來就會有浮水印的效果啦
實作
1.輸入浮水印圖先轉化為灰階
2.利用 opencv的函式 addWeighted
void addWeighted(InputArray src1, double alpha, InputArray src2, double beta, double gamma, OutputArray dst, int dtype=-1)
| Parameters: |
- src1 – first input array.
- alpha – weight of the first array elements.
- src2 – second input array of the same size and channel number as src1.
- beta – weight of the second array elements.
- dst – output array that has the same size and number of channels as the input arrays.
- gamma – scalar added to each sum.
- dtype – optional depth of the output array; when both input arrays have the same depth, dtype can be set to -1, which will be equivalent to src1.depth().
|
需要注意的是,輸入的圖片需要相同type和相同size
Demo
底圖:
浮水印圖
結果
沒有留言:
張貼留言