int main() {
/* creates a new object device1 */
initCapture device1;
/* Read Camera settings from kernel */
ReadCameraSettings(&device1);
/* Initialise Camera and opens it */
initCamera(&device1);
/* Captures frame and save it into memory */
CaptureFrame(&device1);
Mat image=FrametoMem(&device1);
/* Saves frame to disk */
CaptureFrametoDisk(&device1);
/* Displays the image to a new window named "Name" */
DisplayImage("Name",image);
return 0;
}
This function Parse and store JSON document into global variable
initialise a var ret = -1 for returning
Open the config.json file in read mode
if file is not empty{
Declare readbuffer
Declare stream for reading the config file
Parse config.json and store it in config global var
Store the result in ok
if it is empty{
Print the JSON parse error
end
}
set ret = 0;
end
}
else if file is empty{
Print Error in reading JSON file
end
}
close the file
return -1
end
This Function Prints out all the available device
It Uses <glob.h>
and <unistd.h>
libraries to do so
It Initialises the camera by opening it's location and returns
the following integer variable i.e.fd
This function Prints out the Settings of the device entered by user which is stored in the respective Object in the main function
This function Starts the following device and captures a frame and store it into Memory
This function Parse and store JSON document into global variable
This function Saves the frame into Disk
This function Saves the Stream into Disk
It contains The Device Number