Image Processing A Study in Pixel Averaging - Orca

molassesitalianAI and Robotics

Nov 6, 2013 (3 years and 7 months ago)

51 views

Image Processing

A Study in Pixel Averaging

Building a Resolution Pyramid

With Parallel Computing


Denise Runnels and Farnaz Zand

What is Image Processing?



Image processing generally involves
three steps:


Input an Image


Manipulate the image in some way.


Output the result.

Original Image



The master node
divides the image
into tiles of pixel
sets


Each slave node
receives one tile, a
2D array (ex. 4X4)





































































































1











2











3











4



























































































































































5











6











7











8



























































































































































9











1


0








1


1








1


2
























































































































































1


3








1


4








1


5








1


6





















































Processed Image


Each slave node
returns an averaged
tile, a 2D array (ex.
2X2)


The master
consolidates into
one image now
smaller than the
original























1


2





3





4
































5


6





7





8
































9


1


0


1


1


1


2





























3


1


4


1


5


1


6


1












































Resolution Pyramid


A resolution pyramid is a set
of files that contain an image
with decreasing resolution.


One file contains a tile from
the original image with the
best resolution; another
contains a smaller tile that
has been generated by
averaging the pixels of the
first file.


The smaller tile uses less
memory but it has a lower
resolution.
























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































The Problem: Why a Pyramid?


Generate real
-
time immersive applications,
such as an application that allows the viewer
to ‘fly through’ a landscape. For the user to
get real time results the changing scenery
must be rendered very fast.


A problem is encountered when the full scene
will not fit into main memory.



The Solution: How a Pyramid Works


When a viewer is focusing on a certain point
in a scene other points in the distance can be
rendered at a lower resolution.


In this way we can hold several tiles in
memory with varying resolutions



As the viewer changes focal points new tiles
can be loaded into memory to accommodate
the different views.

Things That Make You Go

HMMM


Number of Processors


Too few


Too many


Size of Tiles


What
scalar

value should be used


How much main memory do we have


How much disk space do we have



Constraints & Limitations


Original image must have dimensions
that are a power of two


Graphics Hardware Constraint


Number of processors must be an even
power of two
OR
Original image must
be square


Software Constraint


Prevents “left over edges”, simplifies code

Master’s Responsibilities


Read in Original .tga file


Send Image to Slave Processors


Vs. send tile to slave: which is faster?
Each slave sorting out one tile or the
master sorting out
N

tiles?


Receive Result from Slave Processors


Consolidate Results


Generate a Result .tga file

Slave’s Responsibilities


Receive Image from Master


Sort out tile into
tile

sized array


Begin Loop


Average tiles based on
scalar


Generate .tga file with Proper Name


Base name on
corner
and
scalar
values


Send result tile back to Master


Reduce
scalar


End Loop

Pixel Averaging Algorithm


Partition
tile

into pixel sets


Of Size
scalar
X
scalar


Sum the values in these sets


Divide the Sums by
scalar
2


Store averaged values in Resultant
Array


Algorithm in Action

4 Pixels per Tile

4 Tiles in
Original

From Master

1 Pixel per Tile

4 Tiles Returned

Resultant Tile

Run the Program


With three different sized images


A varying number of processors


For timing comparisons


Scaled down to smallest discernable
resolution


For image quality comparisons


Time Comparison


Different Number of Processors


Are smaller images processed more quickly
with fewer processors


Are larger images processed more quickly
with more processors

Quality Comparison


When is the quality compromised


Averaging with the pixel set produced by
the smallest scalar value (2), is quality
already compromised


How small is too small


Averaging with the pixel set produced by a
larger scalar value, what is that value

Observations


Averaged 2 X 2 set
of pixels


Image quality is
affected by even the
smallest
scalar

value

Observations continued:

Original 1024 X 1024

512 X 512

scalar

= 2

256 X 256

Scalar

= 4


The largest
scalar

value that


produced a discernible image


is 4.


With a
scalar

of 8 the


image becomes indiscernible

Results


Time comparison results showed


5 processors produce the most efficient
results


17 processors produce the least efficient
results


1 processor is faster than 17 but slower
than 5

Original Image Size

256 X 256

0
10
20
30
40
50
60
70
80
90
1
5
17
Number of Processors
Time in
Milliseconds
Resolution 128
Original Image Size

512 X 512

256
128
1
5
17
0
50
100
150
200
250
Time in
Milliseconds
Reduced Resolution
Number of
Processors
1
5
17
Original Image Size

1024 X 1024

512
256
128
1
5
17
0
100
200
300
400
500
600
700
800
900
Time in
Milliseconds
Reduced Resolution
Number of
Processors
1
5
17
Conclusion


Multiple processors can increase the
speed of image processing


There is a threshold number of
processors, after which efficiency
decreases due to message passing

Follow Up


Implement message passing such that
the master sorts out all of the slave tile
pieces and delivers a smaller message
to each slave


Compare times master sorting all tiles vs.
slave sorting one tile each


In conjunction with smaller message sizes