Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I change a non-rectangular portion of an image into an image?

Posted on 2010-09-19
9
Medium Priority
?
355 Views
Last Modified: 2012-08-14
This is a problem for image manipulation using visual studio.

I have a photo of a part.  The part is rectangular, but the image of the part may not be rectangular. It will be quadrilateral of course.

I want to create an image by identifying the four corners of the object, clipping to that area and putting that into a rectangular bit map. Another way to think of it is to skew the original image so the part is rectangular and then crop there.

I know that i can do a pixel by pixel creation of the new image, but I'm guessing that's computationally slow.

Is there a way to skew, distort, or translate an object within .net to achieve the new rectangular image?
0
Comment
Question by:6rant6
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 13

Assisted Solution

by:SameerJagdale
SameerJagdale earned 500 total points
ID: 33713949
if you are using a picturebox / image control they have an option to Fill, Uniform, UniformToFill, Strech, etc. does this not solve your purpose?
0
 
LVL 1

Author Comment

by:6rant6
ID: 33714150
I am not aware of any way that you can set the image to anything that is not rectangular.  So I don't see how it helps.  

I think by definition bitmap is rectangular.
0
 
LVL 13

Expert Comment

by:SameerJagdale
ID: 33714323
whats your container for image?
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 4

Assisted Solution

by:kjetilroe
kjetilroe earned 1500 total points
ID: 33714659
From what you want to achive, it is possible to extract a non rectangular portion of an image, and create anoter image from it. I suggest you investigate the use of masked bitmap.

After doing some investigation, seems like the best way is to use BitBlt for this. See this article about how to do this:

http://msdn.microsoft.com/en-us/library/dd756625(VS.85).aspx

0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 33715866
Can you post the source image?

Is the non-rectangular area supposed to be detected automatically and then rotated?
...or are you looking for some way to allow the user to select the image visually at run-time and then have that rotated?

If "auto" rotated, will it always be in the same spot with the same size?
...does this need to be done with more than one image?

Details, details, details, please!...   =)
0
 
LVL 1

Author Comment

by:6rant6
ID: 33717076
An example in pictures:
Step 1: the original picture
Step 2: the user picks the corners visually
Step 3: The selected portion is all that matters
Step 4: The selected portion is "squared up" [This is where I need help]
Step 5: the new image is stored at the same size as the original

I did this example in a photo editing program. This is not an option for this application. The pictures are taken manually, so each one is a little different. But all objects are rectangular.
filmstrip.png
0
 
LVL 1

Author Comment

by:6rant6
ID: 33717104
The control I'm using is a picturebox; if you have another solution that uses a different control, that's fine.

The initial photos will by jpgs.
0
 
LVL 4

Accepted Solution

by:
kjetilroe earned 1500 total points
ID: 33717295
The picturebox does not seem to cover your need. Maybe you should take a look at these two articles done in C#:

http://www.codeproject.com/KB/GDI-plus/MomentsTracking.aspx

http://www.codeproject.com/KB/GDI-plus/ImageMultification.aspx

No matter what, I think you need to program some GDI+ to do what you are asking about.
0
 
LVL 1

Author Closing Comment

by:6rant6
ID: 33739412
I'm sure there's a reasonable way to do what I want without using GDI, but for now, I'll have to work around,.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

636 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