![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
VC++(图像处理篇)
通过简单明朗的知识介绍,让读者能够快速学习VC++,掌握VC++基础知识,体会学习的乐趣。
老狼主
工作中展现自我,学习中完善自我,生活中乐活自我!
展开
-
VC++ CMemDC类的扩展(终结版)
上一版本链接:https://blog.csdn.net/u012156872/article/details/104966445,近期做窗口自绘,发现用该方法绘制非客户区仍存在问题,于是进行了功能简化和补充。定义和声明:#pragma oncenamespace sw { class CMemDC : public CDC { public: //构造函数可应用于非客户区窗口绘制 CCacheDC(CDC& dc, CWnd* pWnd) : m_dc(dc),原创 2021-08-22 11:23:35 · 312 阅读 · 0 评论 -
VC++ HBITMAP保存文件
请先看下面这段代码:BOOL SaveBmp(HBITMAP bmp, string path){ FILE* f = fopen(path.c_str(), "wb"); if (!f) return 0; BITMAP bmpinfo; GetObject(bmp, sizeof(BITMAP), &bmpinfo); DWORD dwBmBitsSize = ((bmpinfo.bmWidth * 32 + 31) / 32) * 3 * bmpinfo.bmHeigh原创 2021-06-02 17:02:41 · 572 阅读 · 0 评论 -
图像算法之局部直方图均衡化(灰度图像)
1、函数定义//局部直方图均衡化 ksize - 领域大小,kstep - 领域中心步长struct stPGMImage* LocalEqualHist(struct stPGMImage* image, int ksize = 3, int kstep = 1);2、函数实现#include <math.h>#include <vector>using namespace std;struct stPGMImage* LocalEqualHist(stru原创 2020-12-30 22:51:58 · 1898 阅读 · 0 评论 -
图像算法之直方图均衡化(灰度图像)
1、函数定义//直方图均衡化struct stPGMImage* EqualHist(struct stPGMImage* image);2、函数实现struct stPGMImage* EqualHist(struct stPGMImage* image_src){ if (image_src == NULL) return NULL; int gray[256] = { 0 }; double gray_prob[256] = { 0 }; double gray_di原创 2020-12-30 22:50:51 · 739 阅读 · 0 评论 -
图像算法之二维傅里叶+低通滤波(灰度图像)
1、函数定义// 二维傅里叶+低通滤波struct stPGMImage* DFT2(struct stPGMImage* image, double D0 = 5.0);2、函数实现inline int Padding(int n){ double lg = log10((double)n) / log10(2.0); if ((lg - (int)lg) == 0) { return n; } int N = pow(2.0, ((int)lg + 1)); re原创 2020-12-30 22:48:39 · 800 阅读 · 1 评论 -
图像算法之双边滤波器(灰度图像)
1、函数定义// 双边滤波器struct stPGMImage* BilateralFilter(struct stPGMImage* image, int filterSize, double sigmaD, double sigmaR);2、函数实现double** get_space_Array(int _size, int channels, double sigmas){ int i, j; double** _spaceArray = (double**)malloc(s原创 2020-12-30 22:45:27 · 439 阅读 · 2 评论 -
图像算法之高斯模糊(灰度图像)
1、函数定义// 高斯模糊struct stPGMImage* GaussianBlur(struct stPGMImage* image, unsigned int radius);2、函数实现struct stPGMImage* GaussianBlur(struct stPGMImage* image, unsigned int radius){ unsigned int width = image->width; unsigned int height =原创 2020-12-30 22:43:59 · 797 阅读 · 0 评论 -
图像算法之双线性差值算法(灰度图像)
1、函数定义// 双线性差值算法struct stPGMImage* BilinearInterpolation(struct stPGMImage* image, double zoom_factor_x, double zoom_factor_y);2、函数实现struct stPGMImage* BilinearInterpolation(struct stPGMImage *image, double zoom_factor_x, double zoom_factor_y){原创 2020-12-30 22:41:50 · 850 阅读 · 0 评论 -
PGM 格式图像数据操作
1、结构定义struct stPGMImage{ int width; // 宽 int height; // 高 int type; // 类型 int maxraw; // 最大像素 unsigned char* data;// 数据};2、文件读取struct stPGMImage* OpenPGM(char* filename){ FILE* fp; if ((fp = fopen(filename, "rb")) == NULL) { printf("re原创 2020-12-30 22:38:12 · 1135 阅读 · 0 评论 -
VC++ 图像数据像素点处理
以下方式都是在UI设计过程中,偶尔涉及到图像像素处理的时候用到的方式。如果追求专业的图像处理技术,还是采用OpenCV比较好,速度更高效,功能接口也更全面。1、GDI方式CImage &img; img.Load(lpszFileName);if (img.IsNull()) return;//确认该图像包含Alpha通道if (img.GetBPP() != 32)...原创 2020-01-03 23:52:44 · 872 阅读 · 0 评论 -
VC++ 图像颜色调节
1、BMP图片在GDI方式下贴图,32位位图,半透明像素会显示黑色或白底,像素处理代码:void CrossImage(CImage &img){ if (img.IsNull()) return; //确认该图像包含Alpha通道 if (img.GetBPP() != 32) return; for (int i = 0; i < img.GetWid...原创 2020-01-03 21:57:00 · 775 阅读 · 0 评论 -
VC++ GDI+将CDC保存为图片文件(bmp、jpg、png)
int GetEncoderClsid(const wchar_t* format, CLSID* pClsid){ UINT num = 0; UINT size = 0; ImageCodecInfo* pImageCodecInfo = NULL; GetImageEncodersSize(&num, &size); if (size == 0) ret...原创 2020-01-02 21:48:38 · 1479 阅读 · 0 评论