当前位置:网站首页>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 .
边栏推荐
- ucore lab5
- Accounting regulations and professional ethics [2]
- 学习记录:使用STM32外部输入中断
- LeetCode#2062. Count vowel substrings in strings
- Research Report of cylindrical grinder industry - market status analysis and development prospect forecast
- ucore lab 2
- Indonesian medical sensor Industry Research Report - market status analysis and development prospect forecast
- Ball Dropping
- csapp shell lab
- Research Report on medical anesthesia machine industry - market status analysis and development prospect prediction
猜你喜欢

Learning record: how to perform PWM output

Crawling cat's eye movie review, data visualization analysis source code operation instructions
![Unpleasant error typeerror: cannot perform 'ROR_‘ with a dtyped [float64] array and scalar of type [bool]](/img/dc/834463f460c085207dc9d531805e90.jpg)
Unpleasant error typeerror: cannot perform 'ROR_‘ with a dtyped [float64] array and scalar of type [bool]

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

Crawler series (9): item+pipeline data storage

Jupyter installation and use tutorial

csapp shell lab

洛谷P1102 A-B数对(二分,map,双指针)

STM32 learning record: play with keys to control buzzer and led

LeetCode#237. Delete nodes in the linked list
随机推荐
Cost accounting [14]
Market trend report, technological innovation and market forecast of pneumonia drugs obtained by Chinese hospitals
ucore lab5
China's earthwork equipment market trend report, technical dynamic innovation and market forecast
12306: mom, don't worry about me getting the ticket any more (1)
差分(一维,二维,三维) 蓝桥杯三体攻击
学习记录:使用STM32外部输入中断
Research Report on surgical fluid treatment industry - market status analysis and development prospect prediction
0-1背包问题(一)
LeetCode#204. Count prime
JS --- all basic knowledge of JS (I)
Shell脚本编程
Medical colposcope Industry Research Report - market status analysis and development prospect forecast
D - Function(HDU - 6546)女生赛
区间和------离散化
SSM框架常用配置文件
JS调用摄像头
Truck History
JS --- JS function and scope (II)
想应聘程序员,您的简历就该这样写【精华总结】