AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

Transform any quadrilateral bitmap into rectangular

The forum is to discuss topics related to different areas of image processing and computer vision.

Transform any quadrilateral bitmap into rectangular

Postby FileteConPatatas » Thu Feb 12, 2009 6:05 pm

Hello this is my first post(I`m from Spain), first thanks very much Andrew for the organization of the documentation it is wonderfull.

I have a question,I took a few months studying Aforge.Net, but now I am looking for a function to transform any quadrilateral bitmap (including convex/complex quadrilaterals) into rectangular bitmap. Is it possible whit Aforge?

Otherwise, Have you got any idea how I could implement it using any function of Aforge..?

I find this artticle http://vbcity.com/forums/topic.asp?tid=117397 where there is information about geometry concepts, to do that.

Thanks very much
FileteConPatatas
 
Posts: 6
Joined: Thu Feb 12, 2009 5:50 pm

Re: Transform any quadrilateral bitmap into rectangular

Postby andrew.kirillov » Thu Feb 12, 2009 7:54 pm

Hello,

Unfortunately this is not something, what is implemented already in AForge.NET Framework, but something we would like to have soon.

If I understand you correctly, you would like to have something like Affine Transformation. If it is so, then you may continue the searching starting from this.

Also if you could provide some sample images, which could clarify a bit more what you are looking for, this could help.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3453
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: Transform any quadrilateral bitmap into rectangular

Postby FileteConPatatas » Thu Feb 12, 2009 9:23 pm

Hy, thanks for the example "Affine Transformation" it is perfect. I want to do the transformation "Object Alignment",

Image
Image

Now I know the name of the transformation that I want to implement, so I can start looking for more information.

You will be notice of my progress... thanks again
FileteConPatatas
 
Posts: 6
Joined: Thu Feb 12, 2009 5:50 pm

Re: Transform any quadrilateral bitmap into rectangular

Postby FileteConPatatas » Sun Mar 08, 2009 3:51 pm

Hello Andrew, I'm here again... :D
Now I have read more, and I get a example code, and functionall with good result, but very slowly, I'm using videosource that on newFrame evet call the function "Transform" and show the result in a picturebox.

Have you got any idea to do this more quickly? .... Thanks very much


LINKs:

My example code
http://rapidshare.com/files/206836729/FileteConPatatas.rar.html

Information
http://freespace.virgin.net/hugo.elias/graphics/x_persp.htm
http://www.codeguru.com/forum/showthread.php?t=347379
FileteConPatatas
 
Posts: 6
Joined: Thu Feb 12, 2009 5:50 pm

Re: Transform any quadrilateral bitmap into rectangular

Postby andrew.kirillov » Sun Mar 08, 2009 4:19 pm

Hello,

The problem of your code is that it does its work in the slowest possible way. Look on these lines from your code:
Code: Select all
// Copy a pixel
c = bmp.GetPixel((int)(xs) + view_org_xs, (int)(ys) + view_org_ys);
bmp.SetPixel((int)(xt + 0.5) + view_org_xt, (int)(yt + 0.5) + view_org_yt, c);


Of course it will be slow ... None of image processing routines in AForge.NET Framework are done in this way.

If you start doing image processing in C#, then you need to work in unsafe section with pointers. You may take a look at AForge.NET Framework's sources to get a sample of working with unsafe sections. Or you may find some information on CodeProject.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3453
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: Transform any quadrilateral bitmap into rectangular

Postby FileteConPatatas » Sun Mar 08, 2009 4:58 pm

Ok, Thanks again Adrew :mrgreen: , Im going to read more about unsafe sections at CodeProject and AForge.NET Framework's sources, I supposed that the problem should be something similar to what you commented, but
I was not sure.

I will show you the results.
FileteConPatatas
 
Posts: 6
Joined: Thu Feb 12, 2009 5:50 pm

Re: Transform any quadrilateral bitmap into rectangular

Postby Surreal » Thu Nov 19, 2009 9:14 am

Good morning everyone.
Given my interest in teaching purposes the recognition of license plates, surfing the forum I came across this discussion, I wanted to download the sample code posted by FileteConPatatas (http://rapidshare.com/files/206836729/F ... atatas.rar . html
) But unfortunately no longer available. Can someone put it back online?
Thank you very much and excuse my English.
Surreal
 
Posts: 3
Joined: Fri Nov 13, 2009 8:59 pm

Re: Transform any quadrilateral bitmap into rectangular

Postby andrew.kirillov » Thu Nov 19, 2009 10:06 am

Hello

Just in case if you did not read release notes for the latest version, the quadrilateral transformation is already available in AForge.NET framework.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3453
Joined: Fri Jan 23, 2009 9:12 am
Location: UK




Return to Image Processing and Computer Vision

cron