Solved

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

Posted on 2001-07-09
7
455 Views
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:

http://www.cs.indiana.edu/hyplan/tkeahey/research/nlm/nlm.html

maybe i missed something.  pay special attention to

http://www.cs.indiana.edu/hyplan/tkeahey/research/nlm/images/introImage.gif

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?
0
Comment
Question by:felonious
7 Comments
 
LVL 5

Expert Comment

by:TheNeil
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:

CONST
  deg2rad = PI / 180;
...

IF x < (Dest.Width DIV 2)
THEN
  sx := ROUND((Dest.Width DIV 2) * COS(deg2rad * (90 - (x / Dest.Width DIV 2))))
ELSE
  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
THEN
  Dest.Pixels[x, y] := clSilver  //Pixel out of range - Blank it
ELSE
  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 =:)
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6274586
listening
0
 

Author Comment

by:felonious
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.

-felonious
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 5

Expert Comment

by:TheNeil
ID: 6282478
Felonius,

I'd be interested in having a look at the code (TheNeil@Eudoramail.com). 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 =:)
0
 

Author Comment

by:felonious
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:

http://www.cs.indiana.edu/hyplan/tkeahey/research/nlm/images/introImage.gif

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

felonious
0
 
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.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0
 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 8818642
Per recommendation

PashaMod
CS Moderator @Experts Exchange
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now