当前位置:网站首页>Introduction to opencv (II): image color space conversion and image saving
Introduction to opencv (II): image color space conversion and image saving
2022-06-30 08:00:00 【Wheat field CR7】
To facilitate the description of different introductory examples , Add the following example classes :
class OpencvExample
{
public:
void Example_ColorSpace(Mat &image);
private:
};
//example.h
#pragma once
#include <opencv2/opencv.hpp>
using namespace cv;
class OpencvExample
{
public:
void Example_ColorSpace(Mat &image);
private:
};
//example.cpp
#include "example.h"
void OpencvExample::Example_ColorSpace(Mat &image)
{
Mat gray, hsv;
cvtColor(image,hsv,COLOR_BGR2HSV);// Color space conversion
cvtColor(image,gray,COLOR_BGR2GRAY);
imshow("HSV", hsv);
imshow(" Grayscale ", gray);
imwrite("E:/test/opencvexample/tmp/hsv.png", hsv); // Save the picture
imwrite("E:/test/opencvexample/tmp/gray.png", gray);
}
//main.cpp
#include <opencv2/opencv.hpp>
#include <iostream>
#include "example.h"
using namespace cv;
using namespace std;
int main()
{
Mat src = imread("D:/images/gender.jpg");
OpencvExample classExample;
if (src.empty())
{
printf("Can't load image\n");
return -1;
}
namedWindow("InPut", WINDOW_FREERATIO);
imshow("InPut", src);
classExample.Example_ColorSpace(src);// Color space conversion and save the converted image
waitKey(0); // Unit millisecond 0 Unrestricted blocking
destroyAllWindows();
}
边栏推荐
- Combinatorial mathematics Chapter 1 Notes
- Wangbohua: development situation and challenges of photovoltaic industry
- Introduction notes to pytorch deep learning (10) neural network convolution layer
- Pre ++ and post ++ overloads
- Cadence innovus physical implementation series (I) Lab 1 preliminary innovus
- Tencent and Fudan University "2021-2022 yuan universe report" with 102 yuan universe collections
- Construction of module 5 of actual combat Battalion
- 为什么大学毕业了还不知道干什么?
- Network security and data in 2021: collection of new compliance review articles (215 pages)
- February 14, 2022 [reading notes] - life science based on deep learning Chapter 2 Introduction to deep learning (Part 1)
猜你喜欢
![2021-10-29 [microbiology] qiime2 sample pretreatment form automation script](/img/4d/3a3d645a27c3561c3ebe20dcd8e142.jpg)
2021-10-29 [microbiology] qiime2 sample pretreatment form automation script

CRM能为企业带来哪些管理提升

Inversion Lemma

Deep learning - goal orientation

深度学习——使用词嵌入and词嵌入特征

深度学习——特征点检测和目标检测

Cadence innovus physical implementation series (I) Lab 1 preliminary innovus

Examen final - notes d'apprentissage PHP 3 - Déclaration de contrôle du processus PHP

期末复习-PHP学习笔记2-PHP语言基础

F12抓包用于做postman接口测试的全过程解析
随机推荐
February 14, 2022 [reading notes] - life science based on deep learning Chapter 2 Introduction to deep learning (Part 1)
An example of a single service in a cloud project driven by a domain
Conversion between basic data types in go data types
Analysis of cross clock transmission in tinyriscv
【花雕体验】12 搭建ESP32C3之Arduino开发环境
2021.11.20 [reading notes] | differential variable splicing events and DTU analysis
Deep learning - brnn and DRNN
Deep learning - goal orientation
F12 packet capture is used for the whole process analysis of postman interface test
期末複習-PHP學習筆記3-PHP流程控制語句
Personal blog one article multi post tutorial - basic usage of openwriter management tool
6月底了,可以开始做准备了,不然这么赚钱的行业就没你的份了
Deep learning - LSTM
深度学习——LSTM
深度学习——卷积的滑动窗口实现
Construction of module 5 of actual combat Battalion
Hit the industry directly | the flying propeller launched the industry's first model selection tool
CRM&PM如何帮助企业创造最优销售绩效
【笔记】Polygon mesh processing 学习笔记(10)
深度学习——目标定位