[Hugin-devs] [Bug 679939] Re: add quick crop

2023-04-16 Thread Alex Kent Hajnal
I've created a patch that implements the 'outside' autocrop.  See
https://bugs.launchpad.net/hugin/+bug/2016362

-- 
You received this bug notification because you are a member of Hugin
Developers, which is subscribed to Hugin.
https://bugs.launchpad.net/bugs/679939

Title:
  add quick crop

Status in Hugin:
  Triaged

Bug description:
  in the crop tool of the fast preview add this functionality: 
  doubleclick (left) sets the left (/upper/right/lower) crop side to the 
  leftmost "black" pixel, ie everything left from this line has at least 
  one colored pixel. a right doubleclick sets it such that there is at 
  least one colored pixel to the right and none to the left. 

  
  as double right click does not really exist, a shift left click could be 
implemented as this as well...

To manage notifications about this bug go to:
https://bugs.launchpad.net/hugin/+bug/679939/+subscriptions


___
Mailing list: https://launchpad.net/~hugin-devs
Post to : hugin-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~hugin-devs
More help   : https://help.launchpad.net/ListHelp


[Hugin-devs] [Bug 679939] Re: add quick crop

2023-04-16 Thread tmodes
- A reset crop button (removing all cropping is currently quite fiddly).
- Some preset grid overlays for composition (rule of thirds, corner diagonals, 
golden ratio etc...).
These were already implemented in 2011

- Shift-drag at the centre would move only horizontally or vertically similar 
to the Drag mode.
- Shift-drag on corners or edges would resize symmetrically about the centre.
- Ctrl-drag would preserve aspect ratio.
- An 'outside' autocrop in addition to the existing 'inside' autocrop.
- A series of preset aspect ratios (1:1, 2:1, 3:2, 4:3, 16:9, 1.618:1, etc...).
These are implemented in default branch. (If further aspect ratios are needed, 
they can be easily added.)

** Changed in: hugin
   Status: Triaged => Fix Committed

** Changed in: hugin
Milestone: None => 2023.0beta1

-- 
You received this bug notification because you are a member of Hugin
Developers, which is subscribed to Hugin.
https://bugs.launchpad.net/bugs/679939

Title:
  add quick crop

Status in Hugin:
  Fix Committed

Bug description:
  in the crop tool of the fast preview add this functionality: 
  doubleclick (left) sets the left (/upper/right/lower) crop side to the 
  leftmost "black" pixel, ie everything left from this line has at least 
  one colored pixel. a right doubleclick sets it such that there is at 
  least one colored pixel to the right and none to the left. 

  
  as double right click does not really exist, a shift left click could be 
implemented as this as well...

To manage notifications about this bug go to:
https://bugs.launchpad.net/hugin/+bug/679939/+subscriptions


___
Mailing list: https://launchpad.net/~hugin-devs
Post to : hugin-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~hugin-devs
More help   : https://help.launchpad.net/ListHelp


[Hugin-devs] [Bug 2016362] Re: Feature request: Add "Fit crop around images" button

2023-04-16 Thread tmodes
*** This bug is a duplicate of bug 679939 ***
https://bugs.launchpad.net/bugs/679939

> This was done for speed (see below). As I understand it, for 
> non-masked/non-cropped images _some_ point on the source image's edge will be 
> at its largest/smallest projected X/Y position in the final panorama; is this 
> not the case?
Only for this special case. But not in the general case with fisheye lenses or 
cropping or masking.

>Aren't their edges always outside their interiors once projected?
No. The projection formula is only well-defined in the crop area. Outside of 
the crop it can remap points *far* away from the cropped edge. It can even be 
the case that the remapping operation is not (mathematically) defined 
(transformImgCoord returning false). So the calculation of the crop is wrong.

This is not addressed in the new patch.

I committed some changes to the repository which should implement an
outside crop.

-- 
You received this bug notification because you are a member of Hugin
Developers, which is subscribed to Hugin.
https://bugs.launchpad.net/bugs/2016362

Title:
  Feature request: Add "Fit crop around images" button

Status in Hugin:
  New

Bug description:
  It would be useful to have a button that sets the crop so that all of
  the pixels in the source images are in the final image (i.e. set the
  bounding box to surround all of the source images).

  This is similar (kind of opposite) in behavior to the "Stitcher→Fit
  Crop to Images" button that sets the crop so that there are no non-
  image pixels in final image.

  This is useful for when you want to be able to see all of the source
  images in the final image and don't care if it looks pretty.  The
  specific use-case that I have is documenting locations for
  cartography.  I want to be able to see all of a location and currently
  I have to manually set the crop for each panorama.

To manage notifications about this bug go to:
https://bugs.launchpad.net/hugin/+bug/2016362/+subscriptions


___
Mailing list: https://launchpad.net/~hugin-devs
Post to : hugin-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~hugin-devs
More help   : https://help.launchpad.net/ListHelp


[Hugin-devs] [Bug 2016362] Re: Feature request: Add "Fit crop around images" button

2023-04-16 Thread tmodes
*** This bug is a duplicate of bug 679939 ***
https://bugs.launchpad.net/bugs/679939

Testing only the first/last row/column of each image is not enough. It
will fail e.g. for fisheye images and images with crop or masks.

Also please use only whitespace for indentation. The patch contains mixed tab 
and white space indentation.
It needs also more clean up from copying from existing code.

-- 
You received this bug notification because you are a member of Hugin
Developers, which is subscribed to Hugin.
https://bugs.launchpad.net/bugs/2016362

Title:
  Feature request: Add "Fit crop around images" button

Status in Hugin:
  New

Bug description:
  It would be useful to have a button that sets the crop so that all of
  the pixels in the source images are in the final image (i.e. set the
  bounding box to surround all of the source images).

  This is similar (kind of opposite) in behavior to the "Stitcher→Fit
  Crop to Images" button that sets the crop so that there are no non-
  image pixels in final image.

  This is useful for when you want to be able to see all of the source
  images in the final image and don't care if it looks pretty.  The
  specific use-case that I have is documenting locations for
  cartography.  I want to be able to see all of a location and currently
  I have to manually set the crop for each panorama.

To manage notifications about this bug go to:
https://bugs.launchpad.net/hugin/+bug/2016362/+subscriptions


___
Mailing list: https://launchpad.net/~hugin-devs
Post to : hugin-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~hugin-devs
More help   : https://help.launchpad.net/ListHelp


[Hugin-devs] [Bug 2016362] Re: Feature request: Add "Fit crop around images" button

2023-04-16 Thread Alex Kent Hajnal
*** This bug is a duplicate of bug 679939 ***
https://bugs.launchpad.net/bugs/679939

Attached is the patch to add this functionality.  It adds a new "Fit
Crop Around Images" button below the "Fit Crop to Images" button on the
"Stitcher" tab.  The code crops the panorama so that all source pixels
visible in the current field of view are present in the output panorama.

Code has been tested against ~50 panoramas with no issues.

Patch generated with: diff -Naur original_dir modified_dir

Apply patch by entering the source's root directory (the one containing
"authors.txt") and running: patch -p1 <
/PATH/TO/CalculateMaximalROI.patch

Patch works with the current Mercurial version (hugin-
hugin-b003111da6884594f315177298fbb10e2b5bc5af) and the hugin-2022.0.0
release (albeit with a couple of offset warnings).

** Patch added: "CalculateMaximalROI.patch"
   
https://bugs.launchpad.net/hugin/+bug/2016362/+attachment/5664358/+files/CalculateMaximalROI.patch

-- 
You received this bug notification because you are a member of Hugin
Developers, which is subscribed to Hugin.
https://bugs.launchpad.net/bugs/2016362

Title:
  Feature request: Add "Fit crop around images" button

Status in Hugin:
  New

Bug description:
  It would be useful to have a button that sets the crop so that all of
  the pixels in the source images are in the final image (i.e. set the
  bounding box to surround all of the source images).

  This is similar (kind of opposite) in behavior to the "Stitcher→Fit
  Crop to Images" button that sets the crop so that there are no non-
  image pixels in final image.

  This is useful for when you want to be able to see all of the source
  images in the final image and don't care if it looks pretty.  The
  specific use-case that I have is documenting locations for
  cartography.  I want to be able to see all of a location and currently
  I have to manually set the crop for each panorama.

To manage notifications about this bug go to:
https://bugs.launchpad.net/hugin/+bug/2016362/+subscriptions


___
Mailing list: https://launchpad.net/~hugin-devs
Post to : hugin-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~hugin-devs
More help   : https://help.launchpad.net/ListHelp


[Hugin-devs] [Bug 2016362] Re: Feature request: Add "Fit crop around images" button

2023-04-16 Thread Alex Kent Hajnal
*** This bug is a duplicate of bug 679939 ***
https://bugs.launchpad.net/bugs/679939

Thanks for the quick response.  Some questions for you:

> Testing only the first/last row/column of each image is not enough.

This was done for speed (see below).  As I understand it, for non-
masked/non-cropped images _some_ point on the source image's edge will
be at its largest/smallest projected X/Y position in the final panorama;
is this not the case?

> It will fail e.g. for fisheye images

Aren't their edges always outside their interiors once projected?

> and images with crop or masks.

Fair point.  I left this out since I was targeting the common case.  A
solution would be to fall back to a slower method for cropped/masked
images.  For example, for each pixel in such a source image (not just
edge pixels) check whether it's visible (i.e. with
SrcPanoImage::isInside(...)), if it is then project it and adjust the
bounds (x0, y0, x1, y1) as needed.  The downside is that things could
get very slow for large images; w*h checks per image plus the overhead
of isInside() for each point versus 2*(w+h) checks per image for my
existing code.

One other thing, am I correct that the crop that is set (from my code)
is automatically clipped to the field of view's bounding box?  From the
code's behavior it appears that it is but I'm not clear on whether
that's guaranteed.

> Also please use only whitespace for indentation. The patch contains
mixed tab and white space indentation.

My apologies.  Four spaces per tab stop is your convention, correct?

> It needs also more clean up from copying from existing code.

What else needs cleaning up?  (Apart from a couple of commented out bits
of code for the constructor initializers that I see I missed)

---

Hope that didn't come across as confrontational; I really want to make
sure I haven't missed or misunderstood anything.

-- 
You received this bug notification because you are a member of Hugin
Developers, which is subscribed to Hugin.
https://bugs.launchpad.net/bugs/2016362

Title:
  Feature request: Add "Fit crop around images" button

Status in Hugin:
  New

Bug description:
  It would be useful to have a button that sets the crop so that all of
  the pixels in the source images are in the final image (i.e. set the
  bounding box to surround all of the source images).

  This is similar (kind of opposite) in behavior to the "Stitcher→Fit
  Crop to Images" button that sets the crop so that there are no non-
  image pixels in final image.

  This is useful for when you want to be able to see all of the source
  images in the final image and don't care if it looks pretty.  The
  specific use-case that I have is documenting locations for
  cartography.  I want to be able to see all of a location and currently
  I have to manually set the crop for each panorama.

To manage notifications about this bug go to:
https://bugs.launchpad.net/hugin/+bug/2016362/+subscriptions


___
Mailing list: https://launchpad.net/~hugin-devs
Post to : hugin-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~hugin-devs
More help   : https://help.launchpad.net/ListHelp


[Hugin-devs] [Bug 2016362] Re: Feature request: Add "Fit crop around images" button

2023-04-16 Thread Alex Kent Hajnal
*** This bug is a duplicate of bug 679939 ***
https://bugs.launchpad.net/bugs/679939


** Patch added: "Fixed indents, removed stray comments from constructors"
   
https://bugs.launchpad.net/hugin/+bug/2016362/+attachment/5664416/+files/CalculateMaximalROI.1.patch

-- 
You received this bug notification because you are a member of Hugin
Developers, which is subscribed to Hugin.
https://bugs.launchpad.net/bugs/2016362

Title:
  Feature request: Add "Fit crop around images" button

Status in Hugin:
  New

Bug description:
  It would be useful to have a button that sets the crop so that all of
  the pixels in the source images are in the final image (i.e. set the
  bounding box to surround all of the source images).

  This is similar (kind of opposite) in behavior to the "Stitcher→Fit
  Crop to Images" button that sets the crop so that there are no non-
  image pixels in final image.

  This is useful for when you want to be able to see all of the source
  images in the final image and don't care if it looks pretty.  The
  specific use-case that I have is documenting locations for
  cartography.  I want to be able to see all of a location and currently
  I have to manually set the crop for each panorama.

To manage notifications about this bug go to:
https://bugs.launchpad.net/hugin/+bug/2016362/+subscriptions


___
Mailing list: https://launchpad.net/~hugin-devs
Post to : hugin-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~hugin-devs
More help   : https://help.launchpad.net/ListHelp