一 學習內容
1 獲取影象座標處的畫素值,並修改圖對比度
二 **
#include #include using namespace std;
using namespace cv;
int main(int argc, char** ar**)
char figure_name = "figure1";
namedwindow(figure_name, cv_window_autosize);
imshow(figure_name, src2);
// 學習新內容
//1. 調整影象亮度和對比度
int height = src2.rows;
int width = src2.cols;
double alpha = 1.2;
double beta = 10;
dst = mat::zeros(src2.size(),src2.type());
for (int row = 0; row < height; row++)
else if (src2.channels() == 1)
} } char figure_name2 = "figure2";
namedwindow(figure_name2, cv_window_autosize);
imshow(figure_name2, dst);
//2. 將原影象轉化為vec3f型,並從中讀取資料
mat dst2;
src2.convertto(dst2,cv_32f);
height = src2.rows;
width = src2.cols;
alpha = 1.2;
beta = 10;
dst = mat::zeros(src2.size(), src2.type());
for (int row = 0; row < height; row++)
else if (src2.channels() == 1)
} }char figure_name3 = "figur3";
namedwindow(figure_name3, cv_window_autosize);
imshow(figure_name3, dst);
//3. 將原影象直接轉化為灰度影象,再執行一遍
cvtcolor(src2,src2,cv_bgr2gray);
height = src2.rows;
width = src2.cols;
alpha = 1.2;
beta = 10;
dst = mat::zeros(src2.size(), src2.type());
for (int row = 0; row < height; row++)
else if (src2.channels() == 1)
} }char figure_name4 = "figure4";
namedwindow(figure_name4, cv_window_autosize);
imshow(figure_name4, dst);
waitkey(0);
return 0;
}
三、除錯結果
學習opencv記錄 三)
include include highgui.h include cv.h 這種訪問操作比cvget系列函式更快,因為不需要入棧出棧,只是通過指標偏移來進行的 int main int argc,char argv cvmat mat cvinitmatheader mat,3,6,cv 32fc...
OpenCV學習記錄5
一 學習內容 1 兩張影象按權重相加 2 兩張影象相乘 應該可用於頻域濾波吧 二 include include using namespace std using namespace cv int main int argc,char ar if src2.data namedwindow fig...
OpenCV學習記錄11
一 學習內容 1 開操作 2 閉操作 3 形態學梯度操作 4 頂帽 5 黑帽 二 記錄 include include include using namespace cv mat src,dst1,dst2,dst3,dst4,dst5 dst6 int element default size ...