
Two images can be stitched horizontally to create a bigger image.
The image processing is done at byte level, and utilizes Thomas Jung's ZCL_ABAP_BITMAP class.
Below image summarizes what is being done.
SAPlink to install nuggets.
Thomas Jung's ABAP Bitmap Image Processing Class (ZCL_ABAP_BITMAP) , available as SAPLink nugget.
Any Hex Editor to view image files, because the processing is done on hex string at byte level.
Code snippet can be written in Thomas Jung's test program ZABAP_BITMAP_TEST, or a new method can be created in ZCL_ABAP_BITMAP
Class ZCL_ABAP_BITMAP already has several single image processing options such as rotation, flipping, inversion etc.
For 2 input images, 2 instances are creating using method CREATE_FROM_EXT_FORMAT.
The bitmap headers are retrieved using method GET_HEADER_INFORMATION.
Individual image pixels are read using method GET_PIXEL_VALUE.
After creating hex stream that contains stitched image, method CREATE_FROM_BYTESTREAM is used to create image object.
Method DISPLAY_IN_SAPGUI is used to display final image.
Although everything is well explained in ABAP Bitmap Image Processing Class and BMP file format - Wikipedia , it took some effort to understand how bitmap image is structured.
So I created a very small image of resolution 3x4 using Microsoft Paint. (24-bit uncompressed bitmap format).
This is how the 3x4 image looks at 32x zoom.
After debugging the constructor and rotate methods on this image, I came to know that:
I created two 3x4 input images, and stitched them manually to create 6x4 output image.
All 3 images were seen in hex mode to figure out the logic.
Below are the images at 32x zoom, and their hex mode view.
This is the pseudo code for stitching images horizontally, deduced by comparing hex modes.
For stitching images vertically, similar logic is required.
It should be relatively simpler because in this case the width (padding too by extension) does not change.
So we can directly concatenate pixel arrays in input images to get output pixel array.
Size can be direct sum of header, pixelarray1 and pixelarray2.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
10 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 | |
2 |