FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java/adjust_camera.java at main · sksalahuddin2828/Java · GitHub
sksalahuddin2828
/
Java
Public
Notifications
You must be signed in to change notification settings
Fork
59
Star
178
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java
/
adjust_camera.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
47 lines (39 loc) · 1.41 KB
Breadcrumbs
Java
/
adjust_camera.java
Copy path
File metadata and controls
47 lines (39 loc) · 1.41 KB
Raw
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
import
org
.
opencv
.
core
.
Core
;
import
org
.
opencv
.
core
.
Mat
;
import
org
.
opencv
.
core
.
CvType
;
import
org
.
opencv
.
videoio
.
VideoCapture
;
import
org
.
opencv
.
highgui
.
HighGui
;
public
class
VideoCaptureExample
{
public
static
void
main
(
String
[]
args
) {
// Load the OpenCV library
System
.
loadLibrary
(
Core
.
NATIVE_LIBRARY_NAME
);
// Create a VideoCapture object
VideoCapture
capture
=
new
VideoCapture
(
0
);
// Adjust the camera index if needed
if
(!
capture
.
isOpened
()) {
System
.
out
.
println
(
"Failed to open video capture."
);
return
;
}
// Create a Mat object to store the frame
Mat
frame
=
new
Mat
();
// Main loop for video capture
while
(
true
) {
// Read a frame from the video capture
if
(
capture
.
read
(
frame
)) {
// Print the shape of the frame (height, width, channels)
System
.
out
.
println
(
"Shape: "
+
frame
.
size
());
// Display the frame
HighGui
.
imshow
(
"Frame"
,
frame
);
}
else
{
System
.
out
.
println
(
"Failed to read frame"
);
break
;
}
// Exit the loop if 'q' is pressed
if
(
HighGui
.
waitKey
(
1
) ==
'q'
) {
break
;
}
}
// Release the video capture and close the window
capture
.
release
();
HighGui
.
destroyAllWindows
();
}
}
Back
|
FazBrowse Home
|
New Git URL