当前位置:网站首页>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 .
边栏推荐
- Research Report on medical toilet industry - market status analysis and development prospect forecast
- Report on the market trend, technological innovation and market forecast of printing and decorative paper in China
- STM32 learning record: input capture application
- Cost accounting [18]
- LeetCode#36. Effective Sudoku
- Research Report on market supply and demand and strategy of China's earth drilling industry
- C语言数组的概念
- Research Report on market supply and demand and strategy of Chinese graphic screen printing equipment industry
- Shell脚本编程
- Opencv learning log 12 binarization of Otsu method
猜你喜欢
Crawler series (9): item+pipeline data storage
12306: mom, don't worry about me getting the ticket any more (1)
ucore lab5
Nodejs+vue网上鲜花店销售信息系统express+mysql
Learning record: use STM32 external input interrupt
UCORE Lab 1 system software startup process
JS --- all knowledge of JS objects and built-in objects (III)
csapp shell lab
Scoring system based on 485 bus
STM32 how to use stlink download program: light LED running light (Library version)
随机推荐
Cost accounting [13]
JS --- detailed explanation of JS facing objects (VI)
Cost accounting [18]
csapp shell lab
Research Report on market supply and demand and strategy of geosynthetics industry in China
Accounting regulations and professional ethics [3]
学习记录:STM32F103 时钟系统概述工作原理
通俗地理解什么是编程语言
csapp shell lab
力扣刷题记录--完全背包问题(一)
Cost accounting [14]
学习记录:使用STM32F1看门狗
想应聘程序员,您的简历就该这样写【精华总结】
UCORE Lab 1 system software startup process
STM32 learning record: play with keys to control buzzer and led
ucorelab4
Learning records: serial communication and solutions to errors encountered
nodejs爬虫
学习记录:如何进行PWM 输出
Borg Maze (BFS+最小生成树)(解题报告)