POV-Ray : Newsgroups : povray.advanced-users : Image Enhancement Server Time
25 Nov 2024 05:38:38 EST (-0500)
  Image Enhancement (Message 1 to 9 of 9)  
From: Tim Attwood
Subject: Image Enhancement
Date: 6 Jun 2003 23:09:21
Message: <3ee15761$1@news.povray.org>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
The other day on a science channel I saw a demonstration of the VISAR<br>
image stabilization and enhancement software/hardware.<br>
<a href="http://science.nasa.gov/headlines/y2000/ast31aug_1.htm">Visar
Story</a><br>
<a href="http://solutions.intergraph.com/hardware/vas/">Video Analyst®
System</a><br>
They used it to look at a licence plate, stabilize a guy's water skiing
video, and<br>
some other stuff.  They explained that it takes information from
multiple frames to<br>
form the higher resolution output.  The demonstration of the priciple
was with an <br>
overhead projector and multiple blurry transparencies of Albert
Einstein that when<br>
lined up formed a clearer image.  <br>
<br>
So I figured this sort of thing was right up POV's alley =)  Just map a
few images<br>
and filter a bit and voila!  Unfortunately, I found that judging off
hand the placement<br>
in a scene of a flat box to correct for perspective correction
unrewarding, even if the<br>
image_map seems lined up, when it is squared to viewer (bringing image
along) it is <br>
obvious that the image is still distorted.<br>
<br>
What I would like to do is map the image to an object first, and then
stretch it to be<br>
correct.  In other word given 4 points representing something
rectangular in RL that<br>
is in a image, to then stretch the image to match some other set of 4
points (hopefuly<br>
correcting for perspective in the process)  Is there some way to do
this sort of thing?<br>
Any input would be helpful.<br>
<br>
Tim Attwood<br>
#macro T(I M)cylinder{0,I*x,.2 rotate 15*M*z translate A pigment{rgb
E}finish<br>
{ambient 1}}#end#macro Y(E O)#local A=y-x+O;T(1,0)T(2,18)T(1,12)#local
A=x+y<br>
+O;T(2,17)T(2,19)#local A=.7*x-.5*y+O;T(.6,0)#end#local
D=seed(2);#local W=1;<br>
#while(W<35)Y(rand(D)*z<9*rand(D)-5,9*rand(D)-5,9>)#local
W=W+1;#end Y(1,4*z)<br>
</body>
</html>


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: Image Enhancement
Date: 7 Jun 2003 05:08:15
Message: <3ee1ab7f$1@news.povray.org>
You could use two triangles to form a rectangular
section, and use UV-Mapping to stitch the corners
of the image-map to the corners of the triangles.
So, placing the triangles in any fashion will distort
the image to your liking.

-- 
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: Tim### [at] gmxde

> The other day on a science channel I saw a demonstration of the VISAR
> image stabilization and enhancement software/hardware.
> Visar Story

> They used it to look at a licence plate, stabilize a guy's water skiing
video, and
> some other stuff.  They explained that it takes information from multiple
frames to
> form the higher resolution output.  The demonstration of the priciple was
with an
> overhead projector and multiple blurry transparencies of Albert Einstein
that when
> lined up formed a clearer image.
>
> So I figured this sort of thing was right up POV's alley =)  Just map a
few images
> and filter a bit and voila!  Unfortunately, I found that judging off hand
the placement
> in a scene of a flat box to correct for perspective correction
unrewarding, even if the
> image_map seems lined up, when it is squared to viewer (bringing image
along) it is
> obvious that the image is still distorted.
>
> What I would like to do is map the image to an object first, and then
stretch it to be
> correct.  In other word given 4 points representing something rectangular
in RL that
> is in a image, to then stretch the image to match some other set of 4
points (hopefuly
> correcting for perspective in the process)  Is there some way to do this
sort of thing?
> Any input would be helpful.
>
> Tim Attwood
> #macro T(I M)cylinder{0,I*x,.2 rotate 15*M*z translate A pigment{rgb
E}finish
> {ambient 1}}#end#macro Y(E O)#local A=y-x+O;T(1,0)T(2,18)T(1,12)#local
A=x+y
> +O;T(2,17)T(2,19)#local A=.7*x-.5*y+O;T(.6,0)#end#local D=seed(2);#local
W=1;
> #while(W<35)Y(rand(D)*z<9*rand(D)-5,9*rand(D)-5,9>)#local W=W+1;#end
Y(1,4*z)
>


Post a reply to this message

From: Christopher James Huff
Subject: Re: Image Enhancement
Date: 7 Jun 2003 10:11:50
Message: <cjameshuff-097423.09031007062003@netplex.aussie.org>
In article <3ee15761$1@news.povray.org>,
 Tim Attwood <tim### [at] worldnetattnet> wrote:

> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
>   <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
>   <title></title>
> </head>
> <body text="#000000" bgcolor="#ffffff">

Do not post in HTML on these groups. Your newsreader software will have 
an option for "plain text", this is the correct setting to use here.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Tim Attwood
Subject: Re: Image Enhancement
Date: 7 Jun 2003 14:14:28
Message: <3ee22b84$1@news.povray.org>
Christopher James Huff wrote:

>In article <3ee15761$1@news.povray.org>,
> Tim Attwood <tim### [at] worldnetattnet> wrote:
>
>  
>
>><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>><html>
>><head>
>>  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
>>  <title></title>
>></head>
>><body text="#000000" bgcolor="#ffffff">
>>    
>>
>
>Do not post in HTML on these groups. Your newsreader software will have 
>an option for "plain text", this is the correct setting to use here.
>
>  
>
Oops


Post a reply to this message

From: Tim Attwood
Subject: Re: Image Enhancement
Date: 7 Jun 2003 14:42:24
Message: <3ee23210$1@news.povray.org>
Tim Nikias v2.0 wrote:

>You could use two triangles to form a rectangular
>section, and use UV-Mapping to stitch the corners
>of the image-map to the corners of the triangles.
>So, placing the triangles in any fashion will distort
>the image to your liking.
>  
>
That was the second thing I tried...  this ends up with right sized
object, but there is a nasty UV-map artifact... somewhere I read a thread
about that for a trapezoid...

Currently I'm working on achieving this deform by setting up nested loops to
space vertexs in a mesh2 appropriatly, then UV-map the vertexs to the 
pixel collors
read from the image map (via a function). I'm sure this will work, it 
just seems like
overkill.

Tim Attwood


Post a reply to this message

From: Alf Peake
Subject: Re: Image Enhancement
Date: 8 Jun 2003 16:45:38
Message: <3ee3a072@news.povray.org>
Maybe worth checking astro stuff?
Adaptive optics where the image is distorted to remove atmospheric
distortions. Perhaps the way images from multiple sites are combined.


Alf


Post a reply to this message

From: Tim Attwood
Subject: Re: Image Enhancement
Date: 8 Jun 2003 17:52:50
Message: <3ee3b032$1@news.povray.org>
Alf Peake wrote:

>Maybe worth checking astro stuff?
>Adaptive optics where the image is distorted to remove atmospheric
>distortions. Perhaps the way images from multiple sites are combined.
>
>
>Alf
>
VISAR came from NASA where they were using it to look at sunspots I 
believe...
still, I understand that the commercial set up goes for about $20k, if 
you have any
idea of where to look for free software from astronomical places....

So far I've managed to straighten one of my test images, but it still 
seems a bit off
of true...

#version 3.5;
#include "colors.inc" 
#include "math.inc"
global_settings { assumed_gamma 1.0 }
// ----------------------------------------
camera {
  orthographic
  location  <1, 1, -2.0>
  look_at   <1, 1, 0>
}
background {rgb <0.5, 0.5, 0.5>}

// show the X and Y Axis
// cylinder {-200*x, 200*x, 0.01 pigment {checker Red White translate 
-0.5*y} finish {ambient 1}}
// cylinder {-200*y, 200*y, 0.01 pigment {checker Red White translate 
-0.5*x} finish {ambient 1}}

#declare xsize = 100;       // image size
#declare ysize = 100;

#declare AX = 18 /xsize;    // coords of rectangle in image to be 
straightened
#declare AY = 5  /ysize;
#declare BX = 84 /xsize;
#declare BY = 12 /ysize;
#declare CX = 6  /xsize;
#declare CY = 84 /ysize;
#declare DX = 94 /xsize; 
#declare DY = 96 /ysize; 

#declare fn_image = function {   // the input image
  pigment {
    image_map {
      png "testimg.png"
      once
    }
    scale <xsize, ysize, 1>      // pixel units
  }
}
#local SAB = (BY-AY)/(BX-AX);  // slope along AB = (BY-AY)/(BX-AX)
#local SCD = (DY-CY)/(DX-CX);  // slope along CD = (DY-CY)/(DX-CX)
#local SACr = (CX-AX)/(CY-AY); // slope along AC (rotated) = (CX-AX)/(CY-AY)
#local SBDr = (DX-BX)/(DY-BY); // slope along BD (rotated) = (DX-BX)/(DY-BY)
#local IA = 1-(AY - SAB*AX);   // intersect of AB with Y axis = AY - 
slope at A * AX
#local IC = 1-(CY - SCD*CX);   // intersect of CD with Y axis = CY - 
slope at C * CX  
#local IB = (CX - SACr*CY);    // intersect of AC with X axis = CX - 
slope at AC* CY
#local ID = (DX - SBDr*DY);    // intersect of BD with X axis = CX - 
slope at AC* CY
#local fn_I = function(v) { ((IA-IC)*v )}; // ((IA-IC)*v + IC)}; // (min 
- max)*v -max
#local fn_S = function(v) { (SAB-SCD)*v + SCD};
#local fn_Ib = function(u) { ((IB-ID)*u + ID)};
#local fn_Sb = function(u) { ((SACr-SBDr)*u + SBDr)};
#local fn_deformy = function(u,v) { (fn_S(v)*u + fn_I(v)) };  // u
#local fn_deformx = function(u,v) { (1-(fn_Sb(u)*v + fn_Ib(u))) };  // v

mesh2 {
  vertex_vectors {
    xsize*ysize,
#local ypix = 0;
#while (ypix != ysize)
  #local xpix = 0;
  #while (xpix != xsize)
    
<fn_deformx(xpix/xsize,ypix/ysize),fn_deformy(xpix/xsize,ypix/ysize),0>,   
    #local xpix = xpix +1;
  #end
  #local ypix = ypix +1;
#end
  }
  texture_list {
    xsize*ysize,
#local ypix = 0;
#while (ypix != ysize)
  #local xpix = 0;
  #while (xpix != xsize)
      texture {
        pigment {
          rgb <fn_image(xpix,ypix,0).x,
               fn_image(xpix,ypix,0).y,
               fn_image(xpix,ypix,0).z>
        }
        finish {ambient 1}     
      }
    #local xpix = xpix +1;
  #end
  #local ypix = ypix +1;
#end
  }
  face_indices {
    (xsize-1)*(ysize-1)*2,
#local ypix = 0;
#while (ypix != (ysize-1))
  #local xpix = 0;
  #while (xpix != (xsize-1))
    <ypix*xsize+xpix, ypix*xsize+xpix+1, (ypix+1)*xsize+xpix>,
     ypix*xsize+xpix, ypix*xsize+xpix+1, (ypix+1)*xsize+xpix,

    <ypix*xsize+xpix+1, (ypix+1)*xsize+xpix+1, (ypix+1)*xsize+xpix>,
     ypix*xsize+xpix+1, (ypix+1)*xsize+xpix+1, (ypix+1)*xsize+xpix,
          
    #local xpix = xpix +1;
  #end
  #local ypix = ypix +1;
#end
  }
  scale 2
}


Post a reply to this message

From: Alf Peake
Subject: Re: Image Enhancement
Date: 9 Jun 2003 09:54:22
Message: <3ee4918e@news.povray.org>
> >Maybe worth checking astro stuff?
> >Adaptive optics where the image is distorted to remove atmospheric
> >distortions. Perhaps the way images from multiple sites are
combined.
>
> still, I understand that the commercial set up goes for about $20k,
if
> you have any
> idea of where to look for free software from astronomical places....

I just found this in my cache
http://www.gemini.edu/project/announcements/press/2003-2.html

I thought that if you Googled enuf you may find some useful crumbs to
give you some ideas on this. There must be many applications, besides
PC Plod and astronomy, where images are enhanced the way you require.
I can't think of any right now. Medical X-rays?

Alf


Post a reply to this message

From: Tom York
Subject: Re: Image Enhancement
Date: 10 Jun 2003 11:30:01
Message: <web.3ee5f91ea2ab178c541c87100@news.povray.org>
Tim Attwood wrote:
>still, I understand that the commercial set up goes for about $20k, if
>you have any
>idea of where to look for free software from astronomical places....
>
>So far I've managed to straighten one of my test images, but it still
>seems a bit off
>of true...

Astronomical software may be of minimal use for this, because in a lot of
optical astronomy the field of view is usually small enough that you can
relate one image to another by a linear transform (no perspective
problems). However, if your images can be related to each other with simple
shifts, shears and rotations, astronomical packages may be of some use.
Unless you really, really have to do this, or just want to play about with
similar concepts in POV, I'd avoid attempting to use the full-blown astro
software. These packages are not really orientated to anything but
astronomical images and the procedures are time-consuming and still
undergoing refinement to an extent. Having said that, you may want to look
at the dither tools in STSDAS/IRAF (http://iraf.noao.edu and
http://stsdas.stsci.edu) or the CCDPACK component from STARLINK
(http://www.starlink.rl.ac.uk). These tools will not work on anything but
properly headed astronomical images, so the documentation might be of more
use than the packages themselves.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.