当前位置:网站首页>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 .
边栏推荐
- 洛谷P1102 A-B数对(二分,map,双指针)
- Interesting drink
- Learning record: STM32F103 clock system overview working principle
- JS --- all knowledge of JS objects and built-in objects (III)
- 入门C语言基础问答
- Research Report on market supply and demand and strategy of China's Medical Automation Industry
- 0-1 knapsack problem (I)
- Cost accounting [24]
- China potato slicer market trend report, technical dynamic innovation and market forecast
- HDU-6025-Coprime Sequence(女生赛)
猜你喜欢
随机推荐
想应聘程序员,您的简历就该这样写【精华总结】
JS --- detailed explanation of JS facing objects (VI)
Research Report on pharmaceutical R & D outsourcing service industry - market status analysis and development prospect forecast
Cost accounting [13]
Learning record: understand systick system timer and write delay function
ucorelab3
Cost accounting [24]
C语言是低级和高级的分水岭
Accounting regulations and professional ethics [3]
STM32如何使用STLINK下载程序:点亮LED跑马灯(库版本)
Scoring system based on 485 bus
Stm32 dossiers d'apprentissage: saisie des applications
CS zero foundation introductory learning record
12306: mom, don't worry about me getting the ticket any more (1)
0-1背包問題(一)
China chart recorder market trend report, technology dynamic innovation and market forecast
Take you to use wxpy to create your own chat robot (plus wechat interface basic data visualization)
学习记录:串口通信和遇到的错误解决方法
学习记录:理解 SysTick系统定时器,编写延时函数
Perinatal Software Industry Research Report - market status analysis and development prospect forecast