I'm trying to develop a NodeJS app, but it wont executing as desired. I want to first execute downloadIMG first and then execute featureMatching and continue this until the for loop terminates. Guide me to rewrite the code in proper manner.
for (var i=0; i<dbImgCount; i++) {
(function(i) {
async.waterfall([
async function downloadIMG(done) {
try {
var options = {
url: FolderPath[i].FolderPath,
dest: '/home/ubuntu/imgCompare/'
}
const { filename, image } = await download.image(options);
image2 = 'image.jpg';
done(null, 'hi');
} catch (e) {
console.error(e)
}
},
async function featureMatching(a, done){
const img1 = cv.imread(image1);
const img = 'image.jpg';
const img2 = cv.imread(img);
const orbMatchesImg = matchFeatures({
img1,
img2,
detector: new cv.ORBDetector(),
matchFunc: cv.matchBruteForceHamming
},
(console.log(image1+','+img))
);
done(null);
}
],
function (err) {});
})(i);
}