Jump to content
How to Install Plugins ×

Quadrilateral Correction v1.3.1 (Dec 16, 2021)


Recommended Posts

Link to comment
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

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

  • 11 months later...

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

  • 1 month later...

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
Link to comment
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

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

  • toe_head2001 changed the title to Quadrilateral Correction v1.2 (July 3, 2018)
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
Link to comment
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
Link to comment
Share on other sites

  • 4 months later...

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

Link to comment
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

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

  • 6 months later...

I haven't thought this through properly, but to increase the size of the transformed area, could the coordinates of the control rectangle be massaged a bit, e.g. scaling it up to the edge of the image, before passing it to the AForge algorithm? This would provide some attempt at transforming the surroundings. I don't know if naively scaling it would change the perspective effect though, I haven't looked at the maths.

 

A cheap fix for the anti-aliasing would be to enlarge the picture x2, perform the transform, then shrink it x2 again. There is a property on the transform that "specifies if bilinear interpolation should be used or not" which defaults to "true" so maybe it is doing it already.

Link to comment
Share on other sites

  • 8 months later...

Great tool for fixing documents shot with a phone camera.  I've learned to expand the canvas size if I don't want to lose any of the image, though the result is sometimes living with a clipped corner.  My main reason for writing though is to ask if a reset function can be added.  I work with groups of images and it slows me down having to reset the control nubs to each corner.  Once in awhile it helps to have the last setting, but that tends to be the exception when shooting images with a hand held phone.  A simple "reset" would be awesome.  Thanks.

Link to comment
Share on other sites

  • toe_head2001 changed the title to Quadrilateral Correction v1.3 (March 13, 2021)

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.

×
×
  • Create New...