Skip to content

Instantly share code, notes, and snippets.

View simogasp's full-sized avatar

Simone Gasparini simogasp

View GitHub Profile
// these contains the descriptors from the two images
// so you need to convert the AliceVision data structure for descriptors into GpuMat
cv::cuda::GpuMat inputGPUDescriptors1;
cv::cuda::GpuMat inputGPUDescriptors2;
// match the features
// this creates a brute force matcher (it matches each feature against all the others in the other image (more efficient in GPU)
cv::Ptr<cv::cuda::DescriptorMatcher> matcher= cv::cuda::DescriptorMatcher::createBFMatcher();
// this contains for each descriptor a vector of size knn (in this case 2) with the best and second best match for the descriptor
@simogasp
simogasp / playbackAndSaveData.cpp
Last active November 2, 2019 21:30
to playback the tracker and save the data for each frame
#include <Eigen/Eigen>
#include <opencv2/core.hpp>
#include <opencv2/core/eigen.hpp>
#include <opencv2/imgcodecs.hpp>
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
@simogasp
simogasp / pureRotation.cpp
Last active August 14, 2019 10:18
How to estimate a rotation from pure rotations
// This file is part of the AliceVision project.
// Copyright (c) 2019 AliceVision contributors.
// This Source Code Form is subject to the terms of the Mozilla Public License,
// v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.
#include <aliceVision/numeric/numeric.hpp>
#include <aliceVision/robustEstimation/ACRansacKernelAdaptator.hpp>
#include <aliceVision/robustEstimation/ACRansac.hpp>
#include <aliceVision/multiview/homographyKernelSolver.hpp>

Keybase proof

I hereby claim:

  • I am simogasp on github.
  • I am simogasp (https://keybase.io/simogasp) on keybase.
  • I have a public key ASDhSE8IdN6gabI1p0R7KmQrLqW0dg2CV0ngh4iqDora7wo

To claim this, I am signing this object:

@simogasp
simogasp / meshroom.sh
Last active June 20, 2019 12:00
example of bash for calling a generic meshroom script (ui or batch CLI)
#!/usr/bin/env bash
export QML2_IMPORT_PATH=/home/alcov/dev/alicevision/qmlAlembic/build/install/qml:$QML2_IMPORT_PATH
export ALICEVISION_INSTALL=/home/alcov/dev/alicevision/AliceVision/build/install
export ALICEVISION_SENSOR_DB=${ALICEVISION_INSTALL}/share/aliceVision/cameraSensors.db
export LD_LIBRARY_PATH=/home/alcov/dev/common/lib:/usr/lib/nvidia-384:/usr/local/cuda-8.0/lib64/:$LD_LIBRARY_PATH
export MESHROOMPATH=/home/alcov/dev/alicevision/meshroom
PYTHONPATH=${MESHROOMPATH} PATH=$PATH:${ALICEVISION_INSTALL}/bin python ${MESHROOMPATH}/$@
# PYTHONPATH=${MESHROOMPATH} PATH=$PATH:/home/alcov/dev/alicevision/AliceVision/cmake-build-release/Linux-x86_64/ python ${MESHROOMPATH}/$@
------------------------------------------------
@simogasp
simogasp / .clang-format
Created March 31, 2019 21:20
clang format
---
BasedOnStyle: Mozilla
AlignTrailingComments: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'true'
AllowShortCaseLabelsOnASingleLine: 'true'
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: 'false'
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakAfterReturnType: None
@simogasp
simogasp / container.cpp
Created February 13, 2018 19:17
template code to extend/create a STL container from https://stackoverflow.com/a/7759622
template <class T, class A = std::allocator<T> >
class X {
public:
typedef A allocator_type;
typedef typename A::value_type value_type;
typedef typename A::reference reference;
typedef typename A::const_reference const_reference;
typedef typename A::difference_type difference_type;
typedef typename A::size_type size_type;
@simogasp
simogasp / travisDeploy.md
Created January 15, 2018 17:16
Setting up Travis deploy

Setting up Travis deploy

  1. Create an OAuth token from your profile settings
  • under Developer select Personal access token
  • generate a new one and copy it to the clipboard
  1. On the travis page of the repository, go to settings --> More Options->Settings
  2. Set a new Environment Variable called eg GITHUB_RELEASE_API_KEY or whatever u like, and copy the key
  3. In the .travis.yaml file, under add something like that
before_deploy:
 - ARCHIVE_BASE_PATH=${INSTALL_DIR}
@simogasp
simogasp / animateCamera.py
Created December 18, 2017 12:49
[MAYA] from a set of cameras generate an animated camera
import maya.cmds as cmds
# Retrieve selected cameras
selectedCameras = cmds.ls(sl=True, dagObjects=True, cameras=True)
# Set key frames on selection
cmds.setKeyframe()
# Create render camera
cameraName = cmds.camera()
cameraName = cmds.rename(cameraName[0], "render")
@simogasp
simogasp / visibility.py
Created December 14, 2017 17:42
[Maya script] Color points according to their visibility in Maya
# color points and their size (if spehere) according to their visibility
# create color attribute per particle
# create general attribute radiusPP
import maya.cmds as mc
import colorsys
name = 'mvgPointCloud'
radiusBase = 0.005
## Count the number of particules
totalParticle = mc.particle(name, query=True, count=True)
print(totalParticle)