# Help with Sift Flow Algorithm - debugging the demo

6 ビュー (過去 30 日間)
Steven Rudolph 2022 年 1 月 15 日
コメント済み: Walter Roberson 2022 年 1 月 17 日
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=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;
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 件のコメント表示非表示 4 件の古いコメント
Walter Roberson 2022 年 1 月 17 日
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.

サインインしてコメントする。

### 回答 (2 件)

Steven Rudolph 2022 年 1 月 16 日
Just to update:
I was able to run the code in an older 2016 version of MATLAB without issue compiling the mex file... for some reason my 2021 MATLAB version wouldn't allow me to compile the C++ code leading to an error...
I suspect that my Xcode compiler isn't up to date which is causing the error in the newer version... but I'm happy with using an older version of MATLAB to get this done for now.
##### 0 件のコメント表示非表示 -1 件の古いコメント

サインインしてコメントする。

yanqi liu 2022 年 1 月 17 日
yes，sir，may be use vlfeat toolbox，and vl_sift to get sift points and discripters

サインインしてコメントする。

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by