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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Image rotation
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

spetric

Croatia
308 Posts

Posted - Aug 30 2014 :  14:13:24  Show Profile  Reply
Hi,

Is it possible somehow to rotate image without changing original width and height (using ImageEnProc)?

Similar procedure exists in IPL (iplRotate) which does not alter image size.

I've tried ImageEnProc->Rotate, but it changes image size and when used in OnMouseMove event (angle is calculated while dragging the mouse around) rotation (without any filter applied) is quite slow.

Layers rotation works really fast. I assume that layer bitmap is resized once to accept maximum rotation size (max diag w/h) and image is not permanently resized while layer is rotated with mouse. Image is resized once again after rotation is fixed.

It would be nice to have similar method for TIEBitmap. Something like sourceBitmap->RotateTo(destBitmap, angle, etc...), or ImageEnProc->Rotate(double angle, bool fixedsize, etc..)




xequte

38615 Posts

Posted - Aug 31 2014 :  19:56:40  Show Profile  Reply
Hi

Sorry, to clarify, when the rotation occurs what would you want to happen to the image content, truncated or stretched?

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

spetric

Croatia
308 Posts

Posted - Sep 01 2014 :  00:26:39  Show Profile  Reply
Hi,

In this case, image content is truncated in order to preserve original image w/h
and content scaling.

Actually, a programmer is responsible to eventually "prepare" (resize) image, prior to rotation if complete content of image needs to be preserved.

Here is an example how I'm rotating a part of image under mask. I'm using IPL, so I'll describe steps without a code:

1. Prior to rotation, a masked part of background image (OrigImage) is copied into new bitmap (RotoImage). Mask (ROI) is copied as RotoImage->AlphaChannel.

2. RotoImage is resized (content is not stretched) so that it can accommodate rotation by any angle:
NewRotoWidth = NewRotoHeight = ceil(SQRT(RotoWidth^2 + RotoHeight^2)).

3. In OnMouseMove event RotoImage is rotated by some angle and blended with background image (OrigImage). Rotation is performed without filter.

4. In OnMouseUp event, RotoImage is rotated once more using user supplied filter (fast, bicubic, etc...) and blended with original image.

So, although the content of RotoImage is truncated, with image resizing in "pre-rotational phase", only inessential part of content is truncated and image re-creation (resizing) is performed only once.

Maybe I wrote down too much details (my answer could be simple: content is truncated), but I like to specify reasons why to have such option.

TIA,
Siniša

Go to Top of Page

xequte

38615 Posts

Posted - Sep 03 2014 :  19:09:23  Show Profile  Reply
Hi Siniša

Thanks for the explanation. Yes, I'm afraid at this time, rotations (excluding flips) in ImageEn will always cause the image dimensions to be affected.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: