toe_head2001

Quadrilateral Correction v1.2 (July 3, 2018)

Recommended Posts

17 hours ago, flaner said:

does not show online
It prevents the plugin window

I'm not sure what you're trying to say. Something is preventing the plugin's window from showing? Please provide specific details.

Share this post


Link to post
Share on other sites

I finally had a chance to download and try this plugin, and it's very interesting and useful. (I wish the initial comment had a bit more detail on how it's used and perhaps a image of the UI.)

 

Share this post


Link to post
Share on other sites

Thanks toe_head2001,

 

This effect is great for correcting skewed images such as photos of documents, posters, etc.

 

perspective-correction-503babd.png

Share this post


Link to post
Share on other sites

Is moving the canvas to one side so hard? Even on your low resolution, you'll see most of your image.
 

Spoiler

canvasMoved.jpg

Edited by toe_head2001

Share this post


Link to post
Share on other sites

For those interested, I've uploaded the source code to GitHub (see first post). Sorry for the delay, I've been without my Windows computer for more than a week.

Share this post


Link to post
Share on other sites

toe_head2001, in the source code, I can't find the implementation of the QuadrilateralTransformation class.

Share this post


Link to post
Share on other sites
On 1/2/2017 at 2:08 PM, MJW said:

toe_head2001, in the source code, I can't find the implementation of the QuadrilateralTransformation class.

I just created the GUI, so the QuadrilateralTransformation class is in the AForge.NET libraries.

https://github.com/andrewkirillov/AForge.NET/blob/master/Sources/Imaging/Filters/Transform/QuadrilateralTransformation.cs

  • Upvote 1

Share this post


Link to post
Share on other sites

Quadrilateral Correction always crops to the quadrilateral. I think that's often undesirable. When doing perspective correction, the typical approach would be to select some perspective-transformed rectangle in the scene, and put the nubs at its four corners. The purpose is not to isolate that particular region, but to provide the inverse-perspective information. I think Quadrilateral Correction would be more useful if the entire scene, outside the quadrilateral, could be displayed. That would probably require the ability to offset, scale, and modify the XY proportions of the transformed image.

 

Also, as with any plugin of this sort, it should have the option of antialiasing.

  • Upvote 1

Share this post


Link to post
Share on other sites

I like it when the effect isolates a region, there is no need to crop it manually. But I also like MJW's idea, some people may want to keep the outer parts of the image.

Share this post


Link to post
Share on other sites

How about BOTH?

 1) User places nubs on convenient "rectangle" in picture

      2) QC Plugin performs correction on THE WHOLE IMAGE.

          (QC also auto-crops the image so there's no transparent area on any edge -- done to minimize croppage.)

      3) QC Plugin SELECTS the orginal, now orthogonal, rectangle.
 4) User has option to now CROP to the selected rectangle.  As with any rectangular selection.

 

In other words, I agree with MJW.

Edited by Thorntod
It used to say "bloody potatoe" ???
  • Upvote 1

Share this post


Link to post
Share on other sites

Version 1.2 posted. I've added support for the Dark Theme, and moved it to the 'Tools' menu.

 

 

On 12/27/2017 at 9:52 AM, Eli said:

But I also like MJW's idea, some people may want to keep the outer parts of the image.

Feel free to enlarge the canvas before running the plugin. I think that's the simplest solution.

  • Like 2
  • Upvote 1

Share this post


Link to post
Share on other sites
On 7/3/2018 at 5:39 PM, toe_head2001 said:

Feel free to enlarge the canvas before running the plugin. I think that's the simplest solution.

 

I don't think that solves the problem (assuming it's considered a problem -- which it is by me). No matter how big the canvas is, the image is still clipped to the rectangle that corresponds to the transformed quadrilateral. Increasing the canvas size would merely increase the size of the transparent area surrounding the rectangle. I would like the option of preserving the region outside the rectangle. In that case, first increasing the canvas size would be useful, if the plugin didn't have the option of scaling and moving the transformed image, since otherwise either some areas of the image would move outside the  canvas, or the transformed image would need to be downsized to fit the canvas.

 

If you  consider Eli's Aug. 26, 2016 example image it may be clearer. In many cases I'd want to use the picture Eli selects with the nubs to establish the perspective transformation, but keep all the surrounding structure in the transformed image, not just the picture, itself.

  • Upvote 1

Share this post


Link to post
Share on other sites
On 7/5/2018 at 1:10 AM, MJW said:

 

No matter how big the canvas is, the image is still clipped to the rectangle that corresponds to the transformed quadrilateral.

i think he means to make the canvas bigger and eyeball the sheet shape as if it was zoomed to the size of the entire image at the edges. like in my post.

but this is hardly very scientific, a bit of a workaround and i agree we need this feature where you still choose the object corners but still get the full image morphed.

but mostly, baby steps, i want anti-alias on/off.

quad_example-3.png

  • Like 1
  • Upvote 2

Share this post


Link to post
Share on other sites

This is a great plugin. Whilst the "cropping" is a great feature (and much used), I would also like to support the ability to make the crop "optional" - as discussed above. So that the transformation can optionally apply to the entire image (which probably means the canvas would need to be enlarged in these cases).

 

Sometimes the convenient cues that you wish to use to straighten an image do not constitute the entire image.

 

The equivalent "perspective correction" tool in "Paint Shop Pro" (PSP) does not crop by default and instead applies the transformation to the entire image. In these cases I crop the image after having performed the transformation.

 

For example: (Screenshots from PSP)

 

 

Cards-Example-Final-Resized.jpg

Share this post


Link to post
Share on other sites

@DocRoot, Sorry, no can do (in this implementation anyway). :(  Perhaps you missed the explanation I previously posted; here is the excerpt:

 

Quote

It uses an algorithm from AForge.NET.  ...  I just created the GUI

 

In essence, the AForge.NET library is processing the image, and cropping it. I have no control over that.

Plus, this plugin wouldn't be able to enlarge the canvas size to accommodate the larger image.

 

 

I see you gave rep points to for the workaround that I and @thejack473 talked about. I suggest you use it. Or just use PSP.  Sure it's not ideal, but there's no reason you can't have more than one graphic program in your workflow. Use the right tool for the job.

Edited by toe_head2001

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.