Image capturing from web camera
We are starting our introduction to advanced image processing with capturing the content from a video camera.
Capturing frame from the camera is be done in multiple steps:
- Identifying the camera
- Capturing the frame
- Converting the frame to Julia images
- Previewing the result
We will also find the most efficient way of getting the results to Julia images; that is, running the conversion process from C++ on a Julia side or saving and reloading the image.
First, we start by initializing libraries and configuration parameters:
ENV["PKG_CONFIG_PATH"] = "/Users/dc/anaconda/envs/python35/lib/pkgconfig" using OpenCV using Images using Cxx
Next, we proceed with defining the function to convert Open CV images to Julia images:
function opencv_to_image(img_opencv) converted_image = zeros(Float16, (3, rows(img_opencv), cols(img_opencv))); for i = 1:size(converted_image, 2) for j = 1:size(converted_image, 3) pixel_value = @cxx at_v3b(img_opencv...