Google Answers Logo
View Question
 
Q: Fast bilinear / bicubic / any method of 2-D image interpolation (enlarge) ( No Answer,   1 Comment )
Question  
Subject: Fast bilinear / bicubic / any method of 2-D image interpolation (enlarge)
Category: Computers > Algorithms
Asked by: picco-ga
List Price: $12.00
Posted: 30 Jan 2004 04:05 PST
Expires: 22 Feb 2004 23:09 PST
Question ID: 301735
In C, using the most basic operators, +, -, *, >>, << etc. (no
division pls, if possible, no multiply operation), to enlarge a 2-D
image data. We need a very very fast algorithm, with only integer
involved in the process.

The input is simply a byte array of image data, let it image[x].

The problem is to multiply the width and height of image[x] by a
factor of n, so the new image will have dimension of n*width by
n*height, where n is large around 20 - 60.

We are looking for the complete C code:

Input:

image_in; // the input image data byte array. (which is an rgb image
data, 24 biy per pixel.)
image_h; // original image height
image_w; // original image width
image_out; // the output image data byte array.
scale_factor; // an integer > 1 of scale factor

.
. (please fill in)
.

// we can use the image_out data here.

Or the algorithm that we can write in C for fast 2-D intepolation.

Request for Question Clarification by maniac-ga on 04 Feb 2004 15:48 PST
Hello Picco,

I read your question with quite a bit of interest, but finding an
algorithm that has
 - scaling using bilinear interpolation
 - integer arithmetic only (otherwise called fixed point)
 - no division
 - prefer no multiplication
is very hard. There does not seem to be a public implementation like
this. I certainly did a lot of similar work in the mid 70's, but it
seems to be rare today.

I can provide an answer describing
 - bilinear interpolation (lots of sites - good references)
 - suggestions for doing fixed point arithmetic (personal experience, a few sites)
 - suggestions for avoiding multiply / divide (personal experience)
but getting source code for all that seems to be unavailable.

If this kind of answer is OK, please also indicate the constraints you
have related to
 - word size (8, 16, 32, 64)
 - if you can do integer multiply with double precision result
 - if you can do integer divide (double precision / single precision)
== single precision result and remainder
 - if you can do single precision add / subtract with carry / borrow
 - if you have serious limits in storing intermediate values / auxillary data
I realize that some of these may require machine code insertions - let
me know if you need help on that as well [if so, what processor /
compiler].

I am also a little concerned about the range of image magnification
(20-60) since bilinear interpolation may cause some effects you don't
expect. If adjacent pixels are relatively close in color, it should be
OK, but let's say RED is adjacent to GREEN and BLUE (perhaps a
dithered image), the result will go through a range of colors. You may
want to comment on that issue as well.

  --Maniac
Answer  
There is no answer at this time.

Comments  
Subject: Re: Fast bilinear / bicubic / any method of 2-D image interpolation (enlarge)
From: mathtalk-ga on 04 Feb 2004 18:04 PST
 
Maniac-ga's remarks were very interesting to me.  From a mathematical
perspective I had some ideas about an algorithm to do what is asked,
but as Maniac-ga points out, interpolating colors is probably a poor
idea for visual fidelity.

In fact one could make an argument that enlarging an image should not
introduce any new colors.  Such an approach might also yield a faster
algorithm.

Dealing with the jagged visual artifacts introduced by directly
scaling pixels to blocks of pixels is probably best done by edge
detection.  How much of this "image enhancement" fits into the
processing time-scale would depend on the relative merits of image
quality vs. speed.

regards, mathtalk-ga

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy