当前位置:网站首页>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();
}
边栏推荐
- Deep learning - networks in networks and 1x1 convolution
- Cadence physical library lef file syntax learning [continuous update]
- MySQL加索引语句不加锁:ALGORITHM=INPLACE, LOCK=NONE
- 深度学习——特征点检测和目标检测
- Deep learning vocabulary representation
- Efga design open source framework openlane series (I) development environment construction
- Multi whale capital: report on China's education intelligent hardware industry in 2022
- Vulfocus entry target
- 2021-10-29 [microbiology] a complete set of 16s/its analysis process based on qiime2 tool (Part I)
- December 4, 2021 [metagenome] - sorting out the progress of metagenome process construction
猜你喜欢

Final review -php learning notes 3-php process control statement

Deep learning - residual networks resnets

Examen final - notes d'apprentissage PHP 5 - Tableau PHP

Want to change careers, but don't know what to do? This article is written for you who are confused

Final review -php learning notes 1

期末複習-PHP學習筆記3-PHP流程控制語句
![February 14, 2022 [reading notes] - life science based on deep learning Chapter 2 Introduction to deep learning (Part 1)](/img/ff/e4df5a66cda74ee0d71015b7d1a462.jpg)
February 14, 2022 [reading notes] - life science based on deep learning Chapter 2 Introduction to deep learning (Part 1)

多快好省,低门槛AI部署工具FastDeploy测试版来了!

Palindrome substring, palindrome subsequence

回文子串、回文子序列
随机推荐
TP5 set direct download file
JS代码案例
Hit the industry directly | the flying propeller launched the industry's first model selection tool
Introduction notes to pytorch deep learning (11) neural network pooling layer
2021 private equity fund market report (62 pages)
Permutation and combination of probability
Want to change careers, but don't know what to do? This article is written for you who are confused
Use of nested loops and output instances
Distance from point to line
C. Fishingprince Plays With Array
Deep learning - LSTM
Deep learning - bounding box prediction
Go 数据类型篇之基本数据类型之间的转化
December 13, 2021 [reading notes] | understanding of chain specific database building
tp5设置直接下载文件
November 16, 2021 [reading notes] - macro genome analysis process
How CRM & PM helps enterprises create optimal sales performance
期末複習-PHP學習筆記5-PHP數組
Halcon12+vs2013 C # configuration
November 19, 2021 [reading notes] a summary of common problems of sneakemake (Part 2)