Graphic Manipulation: Nonlinear Magnification ("fisheye views", "distortion-oriented presentation", or "focus+context")

Posted on 2001-07-09
Last Modified: 2010-04-06
Hi all,
  back with another question about magnification.  straight forward magnification in easy, but i wanted to look into "nonlinear magnification" a bit, but can not find any routines/algorithms/etc to even play with.  here is one of the links i have been looking at:

maybe i missed something.  pay special attention to

this is something i would very much like to learn how to do.  it looks like you could apply a lookup table to a grabbed image and get the right effect, but unfortunately i have not been able to find one of those either.  maybe a modified "magnifying glass" lookup table?  

anyone know anything about this?

also, assuming i do find a lookup table, is there a fast way to apply one to a bitmap?
Question by:felonious

Expert Comment

ID: 6269747
I've looked at this in the past (with better and worse results) and what I did was to come up with a function that translates the destination position to a position on the source image. You probably already know that. What I've always used is the trig functions SIN and COS and (this is off the top of my head so no promises) done something like this:

  deg2rad = PI / 180;

IF x < (Dest.Width DIV 2)
  sx := ROUND((Dest.Width DIV 2) * COS(deg2rad * (90 - (x / Dest.Width DIV 2))))
  sx := (Dest.Width DIV 2) + ROUND((Dest.Width DIV 2) * COS(deg2rad * (90 - (x / Dest.Width DIV 2))));

IF (sx < 0) OR (sx > Dest.Width) //Check that the pixel is not off the edge of the image
  Dest.Pixels[x, y] := clSilver  //Pixel out of range - Blank it
  Dest.Pixels[x, y] := Source[sx, y];

That only demonstrates scaling in one direction but once you've got it working happily in one direction you simpyl apply the same scaling process to the y value and it should give you a fisheye lens effect. Apologies for using Pixels but I can't remember the scanline code off the top of my head (besides which, pixels are easier to debug. I will work with scanlines though)

Hope that's some help (probably won't be though)

The neil =:)

Expert Comment

ID: 6274586

Author Comment

ID: 6282283
The Neil,
  Sorry I took so long to get back to you.  I had a chance to mess around with the above code and after a bit to tweaking I got it to compile.  I tried it on a number of different size images and it never seemed to produce the right kind of effect.

  I've found a few different pieces of code to do whats called a 'lens effect' in the demo scene.  So far only one looks promising.  Ofcourse this isn't *exactly* the effect I wanted, but maybe with some tweaking it will work for my purposes.  

  If either of you would like to see this code, tell me and I will either post a link to it or send you the files directly to mess around with.  I haven't had much luck 'ripping' the code that I want to use from it (mainly because I don't know how it works yet), but I haven't really taken the time to study it in depth.  Maybe one of you could figure it out for me :)  If you interested, comment.

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!


Expert Comment

ID: 6282478

I'd be interested in having a look at the code ( Mine is awkward at the best of times and lacks any sort of control. It does work but probably isn't what you were after in the first place

The Neil =:)

Author Comment

ID: 6282514
I've sent the neil two program sources I had found a few days ago.  if anyone else would like to look at them, feel free to comment here with your email address and I will be happy to send you them.  The first source achieves the same effect you see in the above link:

the second is much faster but does something a bit different (it's called a lens effect)

LVL 26

Expert Comment

by:Russell Libby
ID: 8702723
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

To be PAQ/Refund

Please leave any comments here within the next seven days.
Thank you,

EE Cleanup Volunteer

Accepted Solution

PashaMod earned 0 total points
ID: 8818642
Per recommendation

CS Moderator @Experts Exchange

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
delphi exception 7 64
Process Javascript errors with Delphi TWebBrowser 1 138
Delphi selector screen 2 80
Print Graphic and Text to Epson TM-T88v 12 260
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question