-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmagnify.cpp
More file actions
35 lines (32 loc) · 800 Bytes
/
magnify.cpp
File metadata and controls
35 lines (32 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <stdio.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include<opencv2/core/core.hpp>
using namespace cv;
using namespace std;
int main(){
namedWindow( "OP", WINDOW_AUTOSIZE );
Mat src=imread("img.jpg",1);
int VAL;
int sr,sc,nr,nc;
VAL=1;
while(1){
createTrackbar("X","OP",&VAL,5);
nr=VAL*(src.rows);
nc=VAL*(src.cols);
Mat nxt(5*(src.rows),5*src.cols,CV_8UC3,Scalar(0,0,0));
for(int i=0;i<nr;i++){
for(int j=0;j<nc;j++){
sr=i/VAL;
sc=j/VAL;
nxt.at<Vec3b>(i,j)[0]=src.at<Vec3b>(sr,sc)[0];
nxt.at<Vec3b>(i,j)[1]=src.at<Vec3b>(sr,sc)[1];
nxt.at<Vec3b>(i,j)[2]=src.at<Vec3b>(sr,sc)[2];
}
}
imshow("OP",nxt);
waitKey(2);
}
return 0;
}