Help with Sift Flow Algorithm - debugging the demo
2 views (last 30 days)
Show older comments
Hello I'm trying to run the demo for this SIFT Flow code you can find here:
It takes two similar images, finds their similarities, and combines them into one essentially...
I'm getting this error when running demo.m:
Here's the full demo.m code:
im1=imread('Mars-1.jpg');
im2=imread('Mars-2.jpg');
im1=imresize(imfilter(im1,fspecial('gaussian',7,1.),'same','replicate'),0.5,'bicubic');
im2=imresize(imfilter(im2,fspecial('gaussian',7,1.),'same','replicate'),0.5,'bicubic');
im1=im2double(im1);
im2=im2double(im2);
%figure;imshow(im1);figure;imshow(im2);
cellsize=3;
gridspacing=1;
addpath(fullfile(pwd,'mexDenseSIFT'));
addpath(fullfile(pwd,'mexDiscreteFlow'));
sift1 = mexDenseSIFT(im1,cellsize,gridspacing);
sift2 = mexDenseSIFT(im2,cellsize,gridspacing);
SIFTflowpara.alpha=2*255;
SIFTflowpara.d=40*255;
SIFTflowpara.gamma=0.005*255;
SIFTflowpara.nlevels=4;
SIFTflowpara.wsize=2;
SIFTflowpara.topwsize=10;
SIFTflowpara.nTopIterations = 60;
SIFTflowpara.nIterations= 30;
tic;[vx,vy,energylist]=SIFTflowc2f(sift1,sift2,SIFTflowpara);toc
warpI2=warpImage(im2,vx,vy);
figure;imshow(im1);figure;imshow(warpI2);
% display flow
clear flow;
flow(:,:,1)=vx;
flow(:,:,2)=vy;
figure;imshow(flowToColor(flow));
return;
% this is the code doing the brute force matching
tic;[flow2,energylist2]=mexDiscreteFlow(Sift1,Sift2,[alpha,alpha*20,60,30]);toc
figure;imshow(flowToColor(flow2));
Anyway I'm assuming this is probably an easy fix, I just don't generally use MATLAB, any help or guidance much appreciated...
5 Comments
Walter Roberson
on 17 Jan 2022
I got a clean compile for both sides, except:
- one of the two has no mexFunction() routine and so cannot be called from MATLAB, which is a problem
- there are functions to save and load binary images that are coded in terms of using int to hold sizes, which is not compatible with MATLAB (only supports 31 bits, whereas MATLAB supports 48 bits). I changed everything else to be compatible with MATLAB sizes, but not those routines yet, as I do not know whether compatibility with external formats is needed.
Answers (2)
yanqi liu
on 17 Jan 2022
yes,sir,may be use vlfeat toolbox,and vl_sift to get sift points and discripters
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!