You are on page 1of 10

Image acquisition and parallel image processing

1- Introduction
The basic data structure in MATLAB is the array, an ordered set of real or
complex elements. This object is naturally suited to the representation of
images, real-valued, ordered sets of color or intensity data. MATLAB stores
most images as two-dimensional arrays (i.e., matrices), in which each
element of the matrix corresponds to a single pixel in the displayed image.
(Pixel is derived from picture element and usually denotes a single dot on a
computer display.) For example, an image composed of 200 rows and 300
columns of different colored dots would be stored in MATLAB as a 200-by-
300 matrix. Some images, such as RGB, require a three-dimensional array,
where the first plane in the third dimension represents the red pixel
intensities, the second plane represents the green pixel intensities, and the
third plane represents the blue pixel intensities. This convention makes
working with images in MATLAB similar to working with any other type of
matrix data, and makes the full power of MATLAB available for image
processing applications.

1.1 Problem statements


How to take an image via a computer as an input and process it in parallel
on more than one processor using the techniques image acquisition toolbox,
image processing toolbox and parallel processing toolbox.

1.2 Image Processing Toolbox

The Image Processing Toolbox (IPT) is a collection of functions that extend


the capability of the MATLAB numeric computing environment.

The toolbox supports a wide range of image processing operations,


including:
 Geometric operations
 Neighborhood and block operations
 Linear filtering and filter design
 Transforms
 Image analysis and enhancement
 Binary image operatio
1.3 Image Acquisition Toolbox

The MATLAB Image Acquisition Toolbox is a collection of functions that


extend the capability of MATLAB, allowing image acquisition operations
from a variety of image acquisition devices, from professional-grade frame
grabbers to USB- based webcams.
The IAT software uses components called hardware device
adaptors to connect to devices through their drivers as figure
below. At the time of this writing, the IAT supports a variety of
devices and drivers, such as the IIDC 1394-based Digital
Camera Specification (DCAM), and devices that provide
Windows Driver Model (WDM) or Video for Windows (VFW)
drivers, such as USB and IEEE 1394 (FireWire, i.LINK) Web
cameras, digital video (DV) camcorders, and TV tuner cards.
Since the release of Version 3.0, the functionality of the IAT
software is available in a desktop application.
1.4 Parallel Computing toolbox

Parallel Computing Toolbox lets you solve computationally and data-


intensive problems using multicore processors, GPUs, and computer
clusters. High-level constructs—parallel for-loops, special array types, and
parallelized numerical algorithms—let you parallelize MATLAB
applications without CUDA or MPI programming. You can use the toolbox
with Simulink to run multiple simulations of a model in parallel.
The toolbox lets you use the full processing power of multicore desktops by
executing applications on workers (MATLAB computational engines) that
run locally. Without changing the code, you can run the same applications
on a computer cluster or a grid computing service (using MATLAB
Distributed Computing ServerTM). You can run parallel
applications interactively or in batch.

1.5 Proposed solution

Using Matlab, a three-part code is executed. The first part will be


responsible for executing, the second part will perform image acquisition
and the third parts will performs image blurring filter in parallel, by using
Low-Light Image Enhancement (Dehazing Algorithm).

1.6 What about Dehazing Algorithm?


Multiple images of the same scene are captured under different
weather conditions to be used as reference images with clear weather
conditions this leads the researchers to focus the dehazing method with a
single reference image. Single image based methods rely on the typical
characteristics of haze-free images. Tan [1] proposed a method that takes
into account the characteristic that a haze-free image has a higher contrast
than ahazy image. By maximizing the local contrast of the input hazy
image, it enhances the visibility but introduces blocking artifacts around
depth discontinuities. Fattal [2] proposed a method that infers the medium
transmission by estimating the albedo of the scene. The underlying
assumption is that the transmission and surface shading are locally
uncorrected, which does not hold under a dense haze. Observing the
property of haze-free outdoor images, He [3] proposed a novel prior—dark
channel prior (DCP). The DCP is based on the property of “dark pixels,”
which have a very low intensity in at least one color channel, except for the
sky region. Owing to its effectiveness in dehazing, the majority of recent
dehazing techniques [3–4] have adopted the DCP. The DCP-based dehazing
techniques are composed of four major steps: atmospheric light estimation,
transmission map estimation, transmission map refinement, and image
reconstruction.
2- Flow Chart

Process1
Main Process

Process2 Process3
Send Image frames
Acquire Image Process Image

Process4
Display Image
3- Application Code

%________________the main program______________________


% we have two functions one funtion will perform image
acquisition
% and the other funtion will perform image bluring
filter in parallel
% while acquising image from webcam of the labtop
% 1- Start a parallel pool with one worker on the local
cluster.
% 2- create a DataQueue object.To send information back
from the worker to
% the MATLAB client.
% 3- Create a figure object, and set 'Visible' to 'on'.
% .To display images every time they arrive from the
DataQueue object,
% we use afterEach.
% 4- determine the frequency of acquisition
% 5- To start data acquisition on the parallel worker,
call parfeval and
% pass the acquisition function, the DataQueue
object,
% and the acquisition rate as arguments.
clear
clc

parpool('local',4);
D = parallel.pool.DataQueue;
fig = figure('Visible','on');
afterEach(D,@processDisp);
freq = 5;
f = parfeval(@getFrameFromCamera,0,D,freq);
pause(30);
cancel(f);

% The getFrameFromCamera function will acquire images


frame from webcam,
% and sends them to the DataQueue
% object in an infinite loop.

function getFrameFromCamera(D,freq)
cam = webcam;
while true
img = snapshot(cam);
send(D,img);
pause(1/freq);
end
end

______________Low-Light Image
Enhancement________________

% Enhance Low Light Image using Dehazing Algorithm


% Using haze removal techniques to enhance low-light
images comprises three steps:
%
% Step 1: Invert the low-light image.
%
% Step 2: Apply the haze removal algorithm to the
inverted low-light image.
%
% Step 3: Invert the enhanced image.

function processDisp1(img)
A = img;
AInv = imcomplement(A);

BInv = imreducehaze(AInv);

B = imcomplement(BInv);

BInv = imreducehaze(AInv,
'Method','approx','ContrastEnhancement','boost');
BImp = imcomplement(BInv);
imshow([img, BImp],'Parent',gca);

end

The Final Obtain Result


By executing the above code in Matlab , obtained below results , the left
image is original image and the left image is image after implementation of
enhancement.

4- Further work
For enhance the output image, use one type of methods
histogram, filters, equalization ... this can be as future work.
5- Conclusion
In conclusion, MATLAB is a useful tool for prototyping, developing and
testing image processing algorithms and pipelines. It provides the user
with the option of either using the functions of the IPT or leveraging the
capabilities of a high-level programming language combined with many
built-in standard functions to create their own algorithms.

6- Reference
[1] RT Tan, Visibility in bad weather from a single image, in Proceedings of IEEE Computer Society
Conference on Computer Vision and Pattern Recognition (CVPR, Anchorage, 2008).

[2] R Fattal, Single image dehazing. ACM Trans. Graph. 72(3), 72:1-72:9 (2008).

[3] K He, J Sun, X Tang, Proceedings of IEEE Computer Society Conference on Computer Vision and
Pattern Recognition (CVPR, Miami, 2009), pp. 1956–1963.

[4] T Yu, I Riaz, J Piao, H Shin, Real-time single image dehazing using block-topixel interpolation and
adaptive dark channel prior. IET Image Process. 9(9), 725–734 (2015).

[5] Image Processing Toolbox for use with matlab,.


[6] http://www.mathworks.com, The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098.
[7]Practical Image and video processing using matlab,OGE marques , Florida Atlantic University.
[8] review on dark channel prior based image dehazing algorithms, Sungmin Lee1, Seokmin Yun1, Ju-Hun
Nam2, Chee Sun Won1 and Seung-Won Jung3*

You might also like