How to capture an image in java?

[Closed]
Report
Posts
13
Registration date
Monday May 8, 2017
Status
Member
Last seen
September 13, 2020
-
Posts
1
Registration date
Saturday August 21, 2021
Status
Member
Last seen
August 21, 2021
-
Hello,

How to capture an image in java !!
I wanted to have some clear explanations

1 reply

Posts
1
Registration date
Saturday August 21, 2021
Status
Member
Last seen
August 21, 2021

Java usually doesn't like accessing hardware, so you will need a driver program of some sort, as goldenmean said. I've done this on my laptop by finding a command line program that snaps a picture. Then it's the same as goldenmean explained; you run the command line program from your java program in the takepicture() routine, and the rest of your code runs the same.

Except for the part about reading pixel values into an array, you might be better served by saving the file to BMP, which is nearly that format already, then using the standard java image libraries on it.

Using a command line program adds a dependency to your program and makes it less portable, but so was the webcam, right?