当前位置:网站首页>Opencv learning log 19 skin grinding
Opencv learning log 19 skin grinding
2022-07-06 15:43:00 【@Spring sauce】
Preface
This article is mainly about opencv Application of skin grinding algorithm in image processing .
One 、 Skin grinding algorithm
// Fifth question Skin grinding
/* notes : image.copyTo(imageROI,mask); hold image Copy this picture (copy to) To imageROI On , And image Corresponding mask The pixel value in is 0( black ) None of the pixels will be pasted imageROI On . */
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
VideoCapture cap("C://Users//john//Desktop//VID1.mp4");
double scale = 0.5;
//0-188
// Skin colour
double i_minH = 0;
double i_maxH = 20;
//0-255
double i_minS = 43;
double i_maxS = 255;
//0-255
double i_minV = 55;
double i_maxV = 255;
while (1)
{
Mat frame;
Mat hsvMat;
Mat detectMat;
Mat finalpicture;
Mat rframetemp;
Mat backskin;
cv::Size rect;
rect.width = 3;
rect.height = 3;
cap >> frame;
Size ResImgSiz = Size(frame.cols*scale, frame.rows*scale);
Mat rFrame = Mat(ResImgSiz, frame.type());
resize(frame, rFrame, ResImgSiz, INTER_LINEAR);
cvtColor(rFrame, hsvMat, COLOR_BGR2HSV); //HSV
rFrame.copyTo(rframetemp);
GaussianBlur(rFrame, rframetemp, rect, 5, 5); // Mean filter grinding
rframetemp.copyTo(detectMat);
cv::inRange(hsvMat, Scalar(i_minH, i_minS, i_minV), Scalar(i_maxH, i_maxS, i_maxV), detectMat);// Binarization to obtain mask
rframetemp.copyTo(finalpicture,detectMat); // Copy after grinding
bitwise_not(detectMat, backskin);
rFrame.copyTo(finalpicture, backskin); // Copy the ungrined part of the original drawing
cv::imshow("rFrame", rFrame);
cv::imshow("finalpicture", finalpicture);
waitKey(0);
}
}
summary
1. The code can run directly , If you don't understand, please leave a message directly .
边栏推荐
- 7-1 懂的都懂 (20 分)
- 动态规划前路径问题优化方式
- mysql导入数据库报错 [Err] 1273 – Unknown collation: ‘utf8mb4_0900_ai_ci’
- JS --- detailed explanation of JS DOM (IV)
- Borg Maze (BFS+最小生成树)(解题报告)
- Learning record: STM32F103 clock system overview working principle
- ucorelab3
- Cost accounting [13]
- Research Report on market supply and demand and strategy of Chinese hospital cleaning chemicals industry
- Research Report of exterior wall insulation system (ewis) industry - market status analysis and development prospect prediction
猜你喜欢
Learning records: serial communication and solutions to errors encountered
Scoring system based on 485 bus
TCP的三次握手与四次挥手
Learning record: use stm32f1 watchdog
Borg Maze (BFS+最小生成树)(解题报告)
LeetCode#36. Effective Sudoku
C语言学习笔记
Visual analysis of data related to crawling cat's eye essays "sadness flows upstream into a river" | the most moving film of Guo Jingming's five years
Learning record: Tim - capacitive key detection
STM32学习记录:玩转按键控制蜂鸣器和LED
随机推荐
Cost accounting [14]
学习记录:使用STM32外部输入中断
Opencv learning log 12 binarization of Otsu method
C语言数组的概念
Record of force deduction and question brushing
Learning record: use STM32 external input interrupt
Research Report on printed circuit board (PCB) connector industry - market status analysis and development prospect forecast
差分(一维,二维,三维) 蓝桥杯三体攻击
ucore lab 6
csapp shell lab
LeetCode#62. Different paths
ucorelab4
cs零基础入门学习记录
Jupyter installation and use tutorial
编程到底难在哪里?
Cost accounting [13]
LeetCode#19. Delete the penultimate node of the linked list
Learning record: Tim - capacitive key detection
Stm32 dossiers d'apprentissage: saisie des applications
B - 代码派对(女生赛)