This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy from https://github.com/bbonik/image_enhancement/blob/f0c286a166443202d592b920b63ee6901a0ee727/source/image_enhancement.py#L1388 | |
import numpy as np | |
from skimage import img_as_float | |
def change_color_saturation( | |
image_color, | |
image_ph_mask=None, | |
sat_degree=1.5,): | |
LOCAL_BOOST = 0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename Scalar, typename Container> | |
inline static Eigen::Matrix<Scalar,-1,-1> toEigenMatrix( const Container& vectors ){ | |
typedef typename Container::value_type VectorType; | |
typedef typename VectorType::value_type Scalar; | |
Eigen::Matrix<Scalar,-1,-1> M(vectors.size(), vectors.front().size()); | |
for(size_t i = 0; i < vectors.size(); i++) | |
for(size_t j = 0; j < vectors.front().size(); j++) | |
M(i,j) = vectors[i][j]; | |
return M; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: https://github.com/samkusin/gamelabs/tree/master/voronoi | |
// with a bug fix (ennetws) | |
/* Usage: | |
using namespace cinekine; | |
... | |
voronoi::Sites sites; | |
for(int i = 0; i < 5; i++) sites.push_back(voronoi::Vertex(rand()*xBound/RAND_MAX,rand()*yBound/RAND_MAX)); | |
... | |
voronoi::Graph graph = voronoi::build(std::move(sites), xBound, yBound); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline QVector<QColor> rndColors(int count){ | |
QVector<QColor> colors; | |
float currentHue = 0.0; | |
for (int i = 0; i < count; i++){ | |
colors.push_back( QColor::fromHslF(currentHue, 1.0, 0.5) ); | |
currentHue += 0.618033988749895f; | |
currentHue = std::fmod(currentHue, 1.0f); | |
} | |
return colors; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Step 3: In the file 'AgoraSdk.cpp' | |
// | |
void AgoraSdk::videoFrameReceivedImpl( | |
agora::linuxsdk::uid_t uid, | |
const agora::linuxsdk::VideoFrame *pframe) const { | |
char uidbuf[65]; | |
snprintf(uidbuf, sizeof(uidbuf), "%u", uid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
// Linear angle based parameterization SGP '07 - c++ code | |
// Based on code by Rhaleb Zayer | |
#include "SurfaceMeshModel.h" | |
#include "SurfaceMeshHelper.h" | |
using namespace SurfaceMesh; | |
#include <Eigen/Core> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import keras.backend as K | |
from keras.layers import Lambda | |
# | |
# Keras + TensorFlow | |
# Resize 'tensorA' to be of the same size as 'tensorB' using 'tf.image.resize_bilinear' | |
# Very useful for skip-connections and 'Concatenate' layers that might complain about being off by one column | |
# Only works when dimensions are provided since we use ' K.int_shape' that returns the static shape | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The most basic example to capture matching RGB and Depth images from an Azure Kinect DK device. | |
CImg is used to visualize the matching RGB and Depth. | |
*/ | |
#pragma comment(lib, "gdi32.lib") | |
#pragma comment(lib, "user32.lib") | |
#pragma comment(lib, "shell32.lib") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Color map based on work by Kenneth Moreland: http://www.sandia.gov/~kmorel/documents/ColorMaps/ | |
#pragma once | |
#include <QVector> // or use std::vector | |
inline std::vector< std::vector<double> > makeColorMap() | |
{ | |
QVector<int> colorArray; | |
colorArray <<59<<76<<192<<60<<78<<194<<61<<80<<195<<62<<81<<197<< | |
63<<83<<198<<64<<85<<200<<66<<87<<201<<67<<88<<203<<68<<90<<204<< | |
69<<92<<206<<70<<93<<207<<71<<95<<209<<73<<97<<210<<74<<99<<211<< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from joblib import Parallel, delayed | |
import numpy as np | |
from skimage.transform import resize | |
files = list(data.keys())[1:] | |
def coords(filename): | |
filename = filename.replace('11_1024/', '').replace('.jpg', '').replace('11_', '') | |
filename = filename.replace('[','').replace(']','').split('_') |