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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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.

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 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