-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathimageROI.cpp
More file actions
31 lines (28 loc) · 775 Bytes
/
imageROI.cpp
File metadata and controls
31 lines (28 loc) · 775 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
//
// imageROI
// LearningOpenCV
//
// Created by YourtionGuo on 7/28/16.
// Copyright © 2016 Yourtion. All rights reserved.
//
#include <iostream>
#include <highgui.h>
#include <cv.h>
// ./LearningOpenCV 0.jpg 10 10 500 300 100
int main(int argc, const char * argv[]) {
IplImage* src;
if( argc == 7 && ((src = cvLoadImage(argv[1],1)) != 0)) {
int x = atoi(argv[2]);
int y = atoi(argv[3]);
int width = atoi(argv[4]);
int height = atoi(argv[5]);
int add = atoi(argv[6]);
cvSetImageROI(src, cvRect(x, y, width, height));
cvAddS(src, cvScalar(add), src);
cvResetImageROI(src);
cvNamedWindow( "ROI_Add", 1 );
cvShowImage( "ROI_Add", src );
cvWaitKey();
}
return 0;
}