Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
76 lines (62 loc) · 2.17 KB

File metadata and controls

76 lines (62 loc) · 2.17 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package opencvtutorial;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.scijava.nativelib.NativeLoader;
class PyramidsRun {
String window_name = "opencvtutorial.Pyramids Demo";
public void run(String[] args) {
/// General instructions
System.out.println("\n" + " Zoom In-Out demo \n" + "------------------ \n" + " * [i] -> Zoom [i]n \n"
+ " * [o] -> Zoom [o]ut \n" + " * [ESC] -> Close program \n");
// ! [load]
String filename = ((args.length > 0) ? args[0] : "data/chicky_512.png");
// Load the image
Mat src = Imgcodecs.imread(filename);
// Check if image is loaded fine
if (src.empty()) {
System.out.println("Error opening image!");
System.out.println("Program Arguments: [image_name -- default data/chicky_512.png] \n");
System.exit(-1);
}
// ! [load]
// ! [loop]
while (true) {
// ! [show_image]
HighGui.imshow(window_name, src);
// ! [show_image]
char c = (char) HighGui.waitKey(0);
c = Character.toLowerCase(c);
if (c == 27) { // ESC
break;
// ![pyrup]
} else if (c == 'i') {
Imgproc.pyrUp(src, src, new Size(src.cols() * 2, src.rows() * 2));
System.out.println("** Zoom In: Image x 2");
// ![pyrup]
// ![pyrdown]
} else if (c == 'o') {
Imgproc.pyrDown(src, src, new Size(src.cols() / 2, src.rows() / 2));
System.out.println("** Zoom Out: Image / 2");
// ![pyrdown]
}
}
// ! [loop]
System.exit(0);
}
}
public class Pyramids {
static {
try {
// Load the native OpenCV library
NativeLoader.loadLibrary(Core.NATIVE_LIBRARY_NAME);
} catch (Exception e) {
}
}
public static void main(String[] args) {
new PyramidsRun().run(args);
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.