473,799 Members | 3,270 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Non-proportional (non Rectangular) resizing

Hi all...

I have developed an application for managing a very large resource of
artist's paintings and posts them to a web site. The application works well.
I'm trying to reduce the complexity of having to work with photoshop and
integrate one feature into the application Distortion Transformations .

Background Information:

When paintings are photographed, it's impossible to get a completely perfect
image that requires straightening prior to cropping for a number of rasons -
the photographer is not standing square on to the painting, the painting is
leaning, the camera is not at the correct height, the camera causes barrel
distortion, etc...

Therefore each image must be loaded into photoshop, all 4 corners selected
using the polygonal lasso tool then manually applying a Distort
Transformation (Edit Transform Distort) on the selected region.

The Problem:

The GDI library comes standard with several rectangular transformations -
stretch, Skew, etc.. But these apply only to a perfect rectangular region
where all points are perpendicular to each other.

I have no problems in selecting the non-rectangular region - this is easy.
I'm stumped at trying to work out how to take this region and applying the
Photoshop like Distort Transformation.

Anyone have any pointers?

Thanks in advance...

Graeme
Jan 26 '07 #1
5 1290
Transformations are all done using Matrix math. This is not going to be an
easy task, because you will have to understand Matrix math to do it. Here
are some articles and sample code to get you started:

http://www.bobpowell.net/transformations.htm
http://www.codeproject.com/csharp/ma...sformation.asp
http://www.euclideanspace.com/maths/...etic/index.htm
http://www.euclideanspace.com/maths/...ion_csharp.htm

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"GraGra33" <gr******@hotma il.comwrote in message
news:e9******** ******@TK2MSFTN GP02.phx.gbl...
Hi all...

I have developed an application for managing a very large resource of
artist's paintings and posts them to a web site. The application works
well.
I'm trying to reduce the complexity of having to work with photoshop and
integrate one feature into the application Distortion Transformations .

Background Information:

When paintings are photographed, it's impossible to get a completely
perfect
image that requires straightening prior to cropping for a number of
rasons -
the photographer is not standing square on to the painting, the painting
is
leaning, the camera is not at the correct height, the camera causes
barrel
distortion, etc...

Therefore each image must be loaded into photoshop, all 4 corners selected
using the polygonal lasso tool then manually applying a Distort
Transformation (Edit Transform Distort) on the selected region.

The Problem:

The GDI library comes standard with several rectangular transformations -
stretch, Skew, etc.. But these apply only to a perfect rectangular region
where all points are perpendicular to each other.

I have no problems in selecting the non-rectangular region - this is easy.
I'm stumped at trying to work out how to take this region and applying the
Photoshop like Distort Transformation.

Anyone have any pointers?

Thanks in advance...

Graeme


Jan 26 '07 #2
Hi...

Thanks for your suggestions - I've had a look at all the links mentioned.
Bob's and the CodeProject artile I've already looked at both and they deal
with rectangular regions (simple transformation) and not 4-point polygons
(complex transformation) .

I've also looked at Gimp and Paint.Net - both only deal with regions (simple
transformation) and don't have Photoshop's distort transformation (complex
transformation) .

I'm trying to do 4-point polygons (complex transformation) and not
rectangular regions (simple transformation) . The GDI+ matrix transformations
only handle rectangular regions (simple transformation) as far as I can
ascertain.

To clarify what I'm trying to do, I'll give you another example - can send
you a sample image if you think that you know how it's done.

Example: The bottom-left and top-right corners are not squared to the
Top-left & bottom-right corners. To square the image, the top-left and
bottom-right must stay anchored whilst the bottom-left must be distorted
towards the top and the top-right corner must be distorted to the right.

Be aware that no two photos are the same and each photo will require
different distort transformation adjustments.

Do you still think that your suggestion will work or do you have another
idea?

Thanks for your help in advance,

Graeme

"Kevin Spencer" <un**********@n othinks.comwrot e in message
news:e2******** ******@TK2MSFTN GP02.phx.gbl...
Transformations are all done using Matrix math. This is not going to be an
easy task, because you will have to understand Matrix math to do it. Here
are some articles and sample code to get you started:

http://www.bobpowell.net/transformations.htm
http://www.codeproject.com/csharp/ma...sformation.asp
http://www.euclideanspace.com/maths/...etic/index.htm
http://www.euclideanspace.com/maths/...ion_csharp.htm

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"GraGra33" <gr******@hotma il.comwrote in message
news:e9******** ******@TK2MSFTN GP02.phx.gbl...
>Hi all...

I have developed an application for managing a very large resource of
artist's paintings and posts them to a web site. The application works
well.
I'm trying to reduce the complexity of having to work with photoshop and
integrate one feature into the application Distortion Transformations .

Background Information:

When paintings are photographed, it's impossible to get a completely
perfect
image that requires straightening prior to cropping for a number of
rasons -
the photographer is not standing square on to the painting, the painting
is
leaning, the camera is not at the correct height, the camera causes
barrel
distortion, etc...

Therefore each image must be loaded into photoshop, all 4 corners
selected
using the polygonal lasso tool then manually applying a Distort
Transformati on (Edit Transform Distort) on the selected region.

The Problem:

The GDI library comes standard with several rectangular transformations -
stretch, Skew, etc.. But these apply only to a perfect rectangular region
where all points are perpendicular to each other.

I have no problems in selecting the non-rectangular region - this is
easy.
I'm stumped at trying to work out how to take this region and applying
the
Photoshop like Distort Transformation.

Anyone have any pointers?

Thanks in advance...

Graeme



Jan 26 '07 #3
Yes, I have a good understanding of what you're trying to do. The Bob Powell
and CodeProject references were just for the purpose of general information
about Matrices. The other 2 references are more specific, one of which goes
well into the mathematics, and one of which provides some samples of C#
Matrix math algorithms, although you will still have to create your own
matrices to do the work. But it WILL involve using Matrix transformation,
and you will have to figure out the Math.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"GraGra33" <gr******@hotma il.comwrote in message
news:uA******** ******@TK2MSFTN GP02.phx.gbl...
Hi...

Thanks for your suggestions - I've had a look at all the links mentioned.
Bob's and the CodeProject artile I've already looked at both and they deal
with rectangular regions (simple transformation) and not 4-point polygons
(complex transformation) .

I've also looked at Gimp and Paint.Net - both only deal with regions
(simple transformation) and don't have Photoshop's distort transformation
(complex transformation) .

I'm trying to do 4-point polygons (complex transformation) and not
rectangular regions (simple transformation) . The GDI+ matrix
transformations only handle rectangular regions (simple transformation) as
far as I can ascertain.

To clarify what I'm trying to do, I'll give you another example - can send
you a sample image if you think that you know how it's done.

Example: The bottom-left and top-right corners are not squared to the
Top-left & bottom-right corners. To square the image, the top-left and
bottom-right must stay anchored whilst the bottom-left must be distorted
towards the top and the top-right corner must be distorted to the right.

Be aware that no two photos are the same and each photo will require
different distort transformation adjustments.

Do you still think that your suggestion will work or do you have another
idea?

Thanks for your help in advance,

Graeme

"Kevin Spencer" <un**********@n othinks.comwrot e in message
news:e2******** ******@TK2MSFTN GP02.phx.gbl...
>Transformation s are all done using Matrix math. This is not going to be
an easy task, because you will have to understand Matrix math to do it.
Here are some articles and sample code to get you started:

http://www.bobpowell.net/transformations.htm
http://www.codeproject.com/csharp/ma...sformation.asp
http://www.euclideanspace.com/maths/...etic/index.htm
http://www.euclideanspace.com/maths/...ion_csharp.htm

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"GraGra33" <gr******@hotma il.comwrote in message
news:e9******* *******@TK2MSFT NGP02.phx.gbl.. .
>>Hi all...

I have developed an application for managing a very large resource of
artist's paintings and posts them to a web site. The application works
well.
I'm trying to reduce the complexity of having to work with photoshop and
integrate one feature into the application Distortion Transformations .

Background Information:

When paintings are photographed, it's impossible to get a completely
perfect
image that requires straightening prior to cropping for a number of
rasons -
the photographer is not standing square on to the painting, the painting
is
leaning, the camera is not at the correct height, the camera causes
barrel
distortion, etc...

Therefore each image must be loaded into photoshop, all 4 corners
selected
using the polygonal lasso tool then manually applying a Distort
Transformatio n (Edit Transform Distort) on the selected region.

The Problem:

The GDI library comes standard with several rectangular
transformatio ns -
stretch, Skew, etc.. But these apply only to a perfect rectangular
region
where all points are perpendicular to each other.

I have no problems in selecting the non-rectangular region - this is
easy.
I'm stumped at trying to work out how to take this region and applying
the
Photoshop like Distort Transformation.

Anyone have any pointers?

Thanks in advance...

Graeme




Jan 26 '07 #4
Thanks for the quick response Kevin.

I've had a good look at GDI+ and Matricies through alot of hand coding and
all I get are simple transformations . I fail to see how GDI+ can handle
complex transformations other than rectangular regions.

Kind Regards,

Graeme

"Kevin Spencer" <un**********@n othinks.comwrot e in message
news:uC******** ******@TK2MSFTN GP02.phx.gbl...
Yes, I have a good understanding of what you're trying to do. The Bob
Powell and CodeProject references were just for the purpose of general
information about Matrices. The other 2 references are more specific, one
of which goes well into the mathematics, and one of which provides some
samples of C# Matrix math algorithms, although you will still have to
create your own matrices to do the work. But it WILL involve using Matrix
transformation, and you will have to figure out the Math.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"GraGra33" <gr******@hotma il.comwrote in message
news:uA******** ******@TK2MSFTN GP02.phx.gbl...
>Hi...

Thanks for your suggestions - I've had a look at all the links mentioned.
Bob's and the CodeProject artile I've already looked at both and they
deal with rectangular regions (simple transformation) and not 4-point
polygons (complex transformation) .

I've also looked at Gimp and Paint.Net - both only deal with regions
(simple transformation) and don't have Photoshop's distort
transformati on (complex transformation) .

I'm trying to do 4-point polygons (complex transformation) and not
rectangular regions (simple transformation) . The GDI+ matrix
transformation s only handle rectangular regions (simple transformation)
as far as I can ascertain.

To clarify what I'm trying to do, I'll give you another example - can
send you a sample image if you think that you know how it's done.

Example: The bottom-left and top-right corners are not squared to the
Top-left & bottom-right corners. To square the image, the top-left and
bottom-right must stay anchored whilst the bottom-left must be distorted
towards the top and the top-right corner must be distorted to the right.

Be aware that no two photos are the same and each photo will require
different distort transformation adjustments.

Do you still think that your suggestion will work or do you have another
idea?

Thanks for your help in advance,

Graeme

"Kevin Spencer" <un**********@n othinks.comwrot e in message
news:e2******* *******@TK2MSFT NGP02.phx.gbl.. .
>>Transformatio ns are all done using Matrix math. This is not going to be
an easy task, because you will have to understand Matrix math to do it.
Here are some articles and sample code to get you started:

http://www.bobpowell.net/transformations.htm
http://www.codeproject.com/csharp/ma...sformation.asp
http://www.euclideanspace.com/maths/...etic/index.htm
http://www.euclideanspace.com/maths/...ion_csharp.htm

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"GraGra33" <gr******@hotma il.comwrote in message
news:e9****** ********@TK2MSF TNGP02.phx.gbl. ..
Hi all...

I have developed an application for managing a very large resource of
artist's paintings and posts them to a web site. The application works
well.
I'm trying to reduce the complexity of having to work with photoshop
and
integrate one feature into the application Distortion
Transformati ons.

Background Information:

When paintings are photographed, it's impossible to get a completely
perfect
image that requires straightening prior to cropping for a number of
rasons -
the photographer is not standing square on to the painting, the
painting is
leaning, the camera is not at the correct height, the camera causes
barrel
distortion , etc...

Therefore each image must be loaded into photoshop, all 4 corners
selected
using the polygonal lasso tool then manually applying a Distort
Transformati on (Edit Transform Distort) on the selected region.

The Problem:

The GDI library comes standard with several rectangular
transformati ons -
stretch, Skew, etc.. But these apply only to a perfect rectangular
region
where all points are perpendicular to each other.

I have no problems in selecting the non-rectangular region - this is
easy.
I'm stumped at trying to work out how to take this region and applying
the
Photoshop like Distort Transformation.

Anyone have any pointers?

Thanks in advance...

Graeme




Jan 26 '07 #5
My point was not about GDI+ as such, but that you need to use Matrix math to
do your transform. In fact, the DirectX library has a matrix class that has
quite a bit of functionality built in, and is completely configurable, which
may be useful to you, or provide you with the knowledge you need to do your
transform. I might mention that what you need is not an affine transform,
which does not provide distortion. What you need to understand is that a
matrix provides a vector-based translation method, so what you need to do is
an orthagonal transform, to change the angle of the corners of your
rectangle. See
http://msdn.microsoft.com/archive/de...rix/matrix.asp.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"GraGra33" <gr******@hotma il.comwrote in message
news:ui******** ********@TK2MSF TNGP03.phx.gbl. ..
Thanks for the quick response Kevin.

I've had a good look at GDI+ and Matricies through alot of hand coding and
all I get are simple transformations . I fail to see how GDI+ can handle
complex transformations other than rectangular regions.

Kind Regards,

Graeme

"Kevin Spencer" <un**********@n othinks.comwrot e in message
news:uC******** ******@TK2MSFTN GP02.phx.gbl...
>Yes, I have a good understanding of what you're trying to do. The Bob
Powell and CodeProject references were just for the purpose of general
information about Matrices. The other 2 references are more specific, one
of which goes well into the mathematics, and one of which provides some
samples of C# Matrix math algorithms, although you will still have to
create your own matrices to do the work. But it WILL involve using Matrix
transformation , and you will have to figure out the Math.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"GraGra33" <gr******@hotma il.comwrote in message
news:uA******* *******@TK2MSFT NGP02.phx.gbl.. .
>>Hi...

Thanks for your suggestions - I've had a look at all the links
mentioned. Bob's and the CodeProject artile I've already looked at both
and they deal with rectangular regions (simple transformation) and not
4-point polygons (complex transformation) .

I've also looked at Gimp and Paint.Net - both only deal with regions
(simple transformation) and don't have Photoshop's distort
transformatio n (complex transformation) .

I'm trying to do 4-point polygons (complex transformation) and not
rectangular regions (simple transformation) . The GDI+ matrix
transformatio ns only handle rectangular regions (simple transformation)
as far as I can ascertain.

To clarify what I'm trying to do, I'll give you another example - can
send you a sample image if you think that you know how it's done.

Example: The bottom-left and top-right corners are not squared to the
Top-left & bottom-right corners. To square the image, the top-left and
bottom-right must stay anchored whilst the bottom-left must be distorted
towards the top and the top-right corner must be distorted to the right.

Be aware that no two photos are the same and each photo will require
different distort transformation adjustments.

Do you still think that your suggestion will work or do you have another
idea?

Thanks for your help in advance,

Graeme

"Kevin Spencer" <un**********@n othinks.comwrot e in message
news:e2****** ********@TK2MSF TNGP02.phx.gbl. ..
Transformati ons are all done using Matrix math. This is not going to be
an easy task, because you will have to understand Matrix math to do it.
Here are some articles and sample code to get you started:

http://www.bobpowell.net/transformations.htm
http://www.codeproject.com/csharp/ma...sformation.asp
http://www.euclideanspace.com/maths/...etic/index.htm
http://www.euclideanspace.com/maths/...ion_csharp.htm

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"GraGra33" <gr******@hotma il.comwrote in message
news:e9***** *********@TK2MS FTNGP02.phx.gbl ...
Hi all...
>
I have developed an application for managing a very large resource of
artist's paintings and posts them to a web site. The application works
well.
I'm trying to reduce the complexity of having to work with photoshop
and
integrate one feature into the application Distortion
Transformat ions.
>
Backgroun d Information:
>
When paintings are photographed, it's impossible to get a completely
perfect
image that requires straightening prior to cropping for a number of
rasons -
the photographer is not standing square on to the painting, the
painting is
leaning, the camera is not at the correct height, the camera causes
barrel
distortio n, etc...
>
Therefore each image must be loaded into photoshop, all 4 corners
selected
using the polygonal lasso tool then manually applying a Distort
Transformat ion (Edit Transform Distort) on the selected region.
>
The Problem:
>
The GDI library comes standard with several rectangular
transformat ions -
stretch, Skew, etc.. But these apply only to a perfect rectangular
region
where all points are perpendicular to each other.
>
I have no problems in selecting the non-rectangular region - this is
easy.
I'm stumped at trying to work out how to take this region and applying
the
Photoshop like Distort Transformation.
>
Anyone have any pointers?
>
Thanks in advance...
>
Graeme
>
>




Jan 29 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2748
by: Arvinder Channey | last post by:
Hello Sir!, i could not find any information on how to make a non-rectangular Frame in JAVA swings.For that i think one has to write own new Frame container,then how to do this?.. If anybody knows about how to do this ,Pls tell me how to do. Thanks regards, Arvinder
2
2397
by: Grzesiek | last post by:
Hello Is it possible to rotate a non-rectangular region ? Rectangular regions, created by CreateRectRgn can be rotated using ExtCreateRegion, but how do the same thing with regions created by CreateEllipticRgn or CombineRgn? I use Borland C++ Builder best regards, Greg
1
1299
by: Tony Reynolds | last post by:
Hi I'm working on a project with a non-rectangular form. I found that if in the form constructor I define a region, say GraphicsPath p = new GraphicsPath() p.AddEllipse(20, 20, 200, 200) this.Region = new Region(p) I get a shaped form with no non-client areas which is exactly what I want. My problem is I don't understand WHY this works. Shouldn't the OnPaint event override my code
5
1749
by: dln | last post by:
Could someone point me to a good reference point (books, websites, etc...) that will show me how to create non-rectangular Windows forms using C# (although I could probably figure things out if the code examples were in any of the .net languages)? Ideally, I would like to learn how to create non-rectangular main form, similar to Windows Media Player. Thanks.
5
1057
by: Tiraman | last post by:
Hi, i have some questions about non-rectangular forms 1) i build a form as a non-rectangular by setting the form background to some bmp file and the transparenceyKey to the color which i want to make transparent and every thing ok BUT when i m replacing the bmp file i can see the new one in the form designer but when i m running the program i m getting the old bmp file.
2
1195
by: Just close your eyes and see | last post by:
hi all I was making a non rectangular form in C# using a bitmap with a white background and set the transparency key property of the form to white and it works but when I color quality from the system properties to 32bit it didn't work is there any way to overcome this or is there a different method for drawing a non rectangular form using images thx for your interest
3
1724
by: dsvagelj | last post by:
Hi. I wanted to create a non rectangular form (Winamp, BSPlayer), and I followed the instructions in MSDN on the topic. Created a bitmap, set the background color of the bitmap to blue 0000ff, set the bitmap as my form background, set the transarency parameter of the form to 0000ff, set border style to none and guess what, nothing happened. :) So I'm asking for help. Thank you...
5
1838
by: GraGra33 | last post by:
Hi all... I have developed an application for managing a very large resource of artist's paintings and posts them to a web site. The application works well. I'm trying to reduce the complexity of having to work with photoshop and integrate one feature into the application Distortion Transformations. Background Information: When paintings are photographed, it's impossible to get a completely perfect
0
10490
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10238
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9077
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7570
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4145
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.