Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

perspectival transformation based on a four-point-path

Community Expert ,
Jan 22, 2009 Jan 22, 2009
Recently over at the Photoshop Forum the matter of automatically placing images into photographs of TV-screens has come up repeatedly. (Possibly for electronics-catalogs I guess.)
Now images are pretty easily placed automatically in frontal shots as long as paths for the screens exist and follow some previously known naming-conventions.
Inserting images into slanted shots of the TV-screens is tougher to automate when they are supposed to show perspectival shortening.
If the vertical lines in the photograph remain parallel to the vertical borders of the document I think Ive more or less got it (depending on the screen-paths being four-points-only); the subPathItems.pathPoints.anchor-values can be used to calculate the necessary shortening, skewing and scaling; not that I could figure out the math myself though. Because I fragmented the operations (thus sacrificing speed I guess) it can be achieved in a loss-free manner only with Smart Objects in CS4.

If all the parallels converge to respective vanishing points on the other hand Im pretty much flabbergasted, because I can hardly make sense of the values I get when recording transformations with the Scripting Listener as it is.
Still I can vaguely see a possible, rather complicated way of achieving it by breaking the transformation down into even more separate operations.
But when considering what Photomerge can do it seems to me that perspectival transformations should indeed be scriptable  

So, does anyone know it its possible to achieve a perspectival transformation in JavaScript by addressing the four corner-points directly, which would seem the easiest way?
Can any of You point me to a source that explains the interaction of the various transformation values?
Or does a functioning Script for perspectival transformation based on a four-point-path exist already anyway?

Its not a matter of urgency, it just seems an interesting problem.
TOPICS
Actions and scripting
738
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jan 25, 2009 Jan 25, 2009
Well, I think Ive found the relevant part in StackSupport.jsx and with a couple of lines from some of the other Stack-Scripts it seems doable to apply the coordinates of the path-points to an ArtLayer directly.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 25, 2009 Jan 25, 2009
I would like to see what you came up with. I thought it was an interesting problem as well but I'm working on another project with a deadline so didn't have time to follow it.

I think it would be useful for more that just matching of angle shots of TV screens.

Mike
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2009 Jan 25, 2009
Im afraid the Script might be too long to post here, a bit over 200 lines, though Im pretty certain one could drop a lot of them without affecting the outcome.
If You email me at pfaffi(at)viennapaint.com I can send it to You.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 26, 2009 Jan 26, 2009
I would be happy to email you. But I think others may like to see the code as well.

Would you be willing to make a post at PS-Scripts? http://ps-scripts.com/bb/

There you can either post the code in the message itself or as a zip in the upload section.

Or may I post your code there if you prefer email?

Thanks,
Mike
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 26, 2009 Jan 26, 2009
LATEST
I hope Im not being too difficult but Im not registered there, and anyway, before being posted, the Script could probably benefit from someone like You looking it over; if You find its not a total insult to good-Scripting-form You can certainly post it.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines