Stitch Images: SIFT

Share your advanced PureBasic knowledge/code with the community.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Stitch Images: SIFT

Post by JHPJHP »

Updated:
- improved parts of the code
- squashed a couple bugs
Last edited by JHPJHP on Wed Oct 16, 2019 3:38 pm, edited 3 times in total.
BarryG
Addict
Addict
Posts: 3268
Joined: Thu Apr 18, 2019 8:17 am

Re: Stitch Images: SIFT

Post by BarryG »

Looks fantastic! Thanks for this. Amazing what you can do with PureBasic.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Stitch Images: SIFT

Post by JHPJHP »

Hi BarryG,

You are most welcome, thank you for commenting.

---------------------------------

Updated:
- switched from IplImage to CvMat
- improved various parts of the code
- squashed a couple bugs

NB*: The IplImage version of the code can be found in the [ scripts ] folder.
Last edited by JHPJHP on Sun Oct 13, 2019 5:39 am, edited 1 time in total.
BarryG
Addict
Addict
Posts: 3268
Joined: Thu Apr 18, 2019 8:17 am

Re: Stitch Images: SIFT

Post by BarryG »

I used to use a commercial product many years ago to do it, so it's impressive what you've done.
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: Stitch Images: SIFT

Post by djes »

So cool ! :D
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Stitch Images: SIFT

Post by davido »

@JHPJHP,
Nice work.
Thank you, very much. :D
DE AA EB
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Stitch Images: SIFT

Post by JHPJHP »

Hi BarryG,
BarryG wrote:I used to use a commercial product many years ago to do it, so it's impressive what you've done.
The OpenCV framework and its contributors have done most of the heavy lifting, but thank you for your kind words.

---------------------------------

Hi djes, davido,

As always, I appreciate you taking the time to comment on the work I have done.

---------------------------------

Updated:
- fixed a memory issue

Memory Issue
I originally thought the problem was fixed using the Function FreeLibraryAndExitThread; taken from this post by Inf0Byt3.
I later realized that the size set for the image matrix was causing the memory issue.
Last edited by JHPJHP on Wed Oct 16, 2019 3:45 pm, edited 1 time in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Stitch Images: SIFT

Post by JHPJHP »

Re-Updated:
- added a sizing algorithm
- added cropping
- speed improvements
- added minimal error checking
- squashed a couple bugs

Sizing Algorithm
Large images have the potential to crash the program; images are resized if the total width / height exceeds a set limit.

NB*: The EXE and DLL can now be recompiled directly from the [ scripts ] folder.
- \scripts\CvMat\StitchImages_CvMat_DLL.pb
- \scripts\CvMat\StitchImages_CvMat_EXE.pb
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Stitch Images: SIFT

Post by JHPJHP »

Updated:
- bug fixes & minor code improvements
Last edited by JHPJHP on Tue Mar 22, 2022 4:56 am, edited 1 time in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Stitch Images: SIFT

Post by JHPJHP »

Updated:
- added StitchImagesMem_1_DLL.pb, StitchImagesMem_2_DLL.pb
-- includes Capture Screen and Rotate Image algorithms (StitchImagesMem_1_DLL.pb only)
- improved StitchImages_DLL.pb, StitchImages_EXE.pb
-- added option to return stitched image to memory (StitchImages_DLL.pb only)

StitchImagesMem_1_DLL.pb and StitchImagesMem_2_DLL.pb
Stitch two images together from/to memory; based on a question asked here.
The first example stitches a screen capture split vertically into two images then rotated.
The second example stitches two images loaded using CatchImage.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Stitch Images: SIFT

Post by JHPJHP »

Updated:
- improved all examples; more user friendly
- added the following configurable parameters
-- SaveImage: save the stitched image to a user-defined PNG; alternatively return the image as a memory pointer
-- MaxSize: set the max width/height (whichever is larger); anything less than 10 will skip Procedure
-- BlendSize: set the overlap size for the Laplacian blending algorithm; anything less than 1 will skip Procedure
-- CropImage: crop the image removing black borders; more relevant for images greatly utilizing warp perspective
- removed IplImage versions
- squashed a couple bugs

NB*: Stitch Images: SIFT free executables were also updated.

Stitched together 4 images...

Without Laplacian Blending and Cropping:
Image

With Laplacian Blending and Cropping:
Image
Locked