Solved

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

Posted on 2001-07-09
7
456 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Is there a maximum column width (in pixels) in a TListView? 22 102
Delphi Form ownership 4 70
Reconfigure Delphi Install? 2 45
Find and Replace Stream with 0s 8 56
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

919 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

17 Experts available now in Live!

Get 1:1 Help Now