toe_head2001

Quadrilateral Correction v1.2 (July 3, 2018)

Recommended Posts

Quadrilateral Correction

Effects -> Tools -> Quadrilateral Correction

 

Description

This effect is useful for correcting images that have been skewed on multiple axes.

It uses an algorithm from AForge.NET. It works very well, but don't expect miracles if your image is extremely skewed.

 

Before & After

The left face has been selected in the plugin.

before.png — > after.png

 

Screenshot

Spoiler

ui.png

 

Output:

gn.png

 

Control Nubs

The control nubs can be manipulated with the mouse in the following three ways:

- Left Mouse Button — Grab and Drag

- Middle Mouse Button — Grab and Drag with a Dead Zone

- Right Mouse Button — Select nub for Keyboard Arrow manipulation

   - Arrow — 1px

   - Ctrl + Arrow — 5px

 

 

Change Log

v1.2 (July 3, 2018)

  • Added: Support for the Dark Theme
  • Changed: Moved to the 'Tools' menu

v1.1 (Jan 1, 2017)

  • Fixed: Now works properly on HiDPI

v1.0 (Aug 24, 2016)

  • Initial release

 

Download

:RightArrowBlue:  QuadrilateralCorrection.zip

Place all three files in the Effects folder

 

Donate

PP_logo_h_100x26.png

 

Source Code

https://github.com/toehead2001/pdn-quadrilateral-correction

 

 

Icon based on icons from Fugue Icons.

Edited by toe_head2001
  • Upvote 9

Share this post


Link to post
Share on other sites
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

 

Side rant: It really bothers that manufactures are still selling low resolution displays to consumers. The sad part is many of those consumers don't know any better. A vertical resolution of 768? Honestly, that's what we used in the late 90's (1024x768).

I went 1920x1200 in 2004, and never went back (sort of... all my displays these days are slightly lower: 1920x1080.  16:9 killed 16:10).

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.

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" ???

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.

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 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now