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
 TIEBitmap.Resample image shift with TResampleFilter.rfFastLinear

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
Nick Brett Posted - Feb 05 2025 : 05:25:08
I have a TIEBitmap image with ie24RGB PixelFormat, pixel dimensions 152 width x 666 height. I want to resample the image to 152 width x 1998 height (stretch in the Y direction). I've checked and can see that the rfNearest and rfLanczos3 sample filters work exactly as I'd expect with no apparent errors, but the rfFastLinear sample filter shifts the image slightly. For instance the pixel (130, 642) in the original image should move to (130, 1928) in the stretched image, but the rfFastLinear sample filter instead moves the pixel to (130, 1926). These are real-world pictures being used for curation of objects, so it does matter. I haven't checked to see if a similar error occurs in the X direction, or to see if the other filters have similar errors.

I've attached a zip file with images that make the difference between the rfNearest and rfFastLinear sample filters obvious, with a black cross at the above pixel coordinates.

attach/Nick Brett/20252552219_TIEBitmap rfFastLinear Resample Error.zip
3.2 KB
2   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Feb 06 2025 : 17:01:17
The fast linear resampling algorithm creates a new pixels from a linear interpolation of pixel x+0 and pixel x+1 (or y+0 and y+1), so the right border or bottom borders have to interpolate with themselves when enlarging (as there are no further pixels). This results in simple duplication and causes the image content to be offset. For this reason, rfFastLinear should not be used when accurate measurement/positioning is required.

We will add a warning to the documentation.

Nigel
Xequte Software
www.imageen.com
foxdingding Posted - Feb 05 2025 : 19:42:45
I also noticed this issue, there are similar errors in the X direction. I am not using rfFastLinear now.