ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Rotate + Crop versus Crop with angle

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
LikeMike Posted - Apr 24 2022 : 11:56:03
Hello!

There is something wrong with the Crop-function.
If I use:

Img.Proc.Rotate(45);
Img.Proc.Crop(Rect.Left, Rect.Top,Rect.Right, Rect.Bottom );

I get the expected result.

If I use:
Img.Proc.Crop(Rect, 45, ierFast);

The result is not what I expected.
1. the orientation of the rotation is different (Rotate : counterclockwise, Crop : clockwise)
2. even if I set the second code to 315° the cutout is not the same!

The problem is: the first code is much slower than the second one, so it would be nice, if Crop(rect, angle, ..) gives the same result.

Regards
Mike
5   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - May 03 2022 : 23:21:04
I have improved the help documentation with a better explanation...

The Rotate and Crop overload rotates the whole image and the crops to a region of interest by adjusting the crop region to account for the rotation.

Consider this image:



And these parameters:

const
  Rotation_Angle = 10;
  Crop_Left      = 220;
  Crop_Top       = 70;
  Crop_Right     = 220 + 170;
  Crop_Bottom    = 70 + 160;

Cropping then rotating:

ImageEnView1.IO.LoadFromFile( 'D:\Tiger.jpg' );
ImageEnView1.Proc.Crop( Crop_Left, Crop_Top, Crop_Right, Crop_Bottom );
ImageEnView1.Proc.Rotate( Rotation_Angle, ierBicubic, clBlack );



Rotating then cropping:

ImageEnView1.IO.LoadFromFile( 'D:\Tiger.jpg' );
// Note the negative rotation value
ImageEnView1.Proc.Crop( Rect( Crop_Left, Crop_Top, Crop_Right, Crop_Bottom ), -Rotation_Angle, ierBicubic );



Nigel
Xequte Software
www.imageen.com
LikeMike Posted - Apr 28 2022 : 01:11:43
Yes - that's exactly my problem...
xequte Posted - Apr 27 2022 : 21:53:26
Hi

It would be difficult to get the same code using the rotate overload, because you won't know the size of the image until after it has been rotated (i.e. left and top of the crop rect would have to be shifted by an [as yet] unknown amount).

Nigel
Xequte Software
www.imageen.com
LikeMike Posted - Apr 26 2022 : 03:50:46
 
2. That's correct. They use a different method of cropping


OK - and what do I have to change here "Img.Proc.Crop(Rect, 45, ierFast);" to get the same result?
xequte Posted - Apr 25 2022 : 22:00:48
Hi Mike

1. Unfortunately for historical reasons there is some inconsistency with the directions of rotation values in ImageEn. For crop, the rotation direction is clockwise.

2. That's correct. They use a different method of cropping

Nigel
Xequte Software
www.imageen.com