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
def dep_2_cld(dpt, K, scale=1000): | |
""" | |
Converts a depth image into a pointcloud, using the camera intrinsics. | |
Arguments | |
--------- | |
dpt : single-channel image | |
depth image | |
K : array (3x3) | |
intrinsics matrix |
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
NUMBER_TO_SUBTRACT=217 | |
for file in `ls -1v out*`; do | |
echo $file | |
NUMBER=${file:3:-4} | |
NEW_NUMBER=$[NUMBER-NUMBER_TO_SUBTRACT] | |
NEW_FILE_NAME="out${NEW_NUMBER}.png" | |
echo $NEW_FILE_NAME |
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
//Read the desired model | |
string path = "FSRCNN_x2.pb"; | |
sr.readModel(path); | |
//Set CUDA backend and target to enable GPU inference | |
sr.setPreferableBackend(cv::dnn::DNN_BACKEND_CUDA) | |
sr.setPreferableTarget(cv::dnn::DNN_BACKEND_CUDA) | |
//etcetera.. |
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
# Read the desired model | |
path = "EDSR_x3.pb" | |
sr.readModel(path) | |
# Set CUDA backend and target to enable GPU inference | |
sr.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA) | |
sr.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA) | |
#etcetera.. |
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
cmake \ | |
-D CMAKE_BUILD_TYPE=RELEASE \ | |
-D CMAKE_INSTALL_PREFIX=/usr/local \ | |
-D INSTALL_PYTHON_EXAMPLES=ON \ | |
-D INSTALL_C_EXAMPLES=OFF \ | |
-D OPENCV_ENABLE_NONFREE=ON \ | |
-D WITH_CUDA=ON \ | |
-D WITH_CUDNN=ON \ | |
-D OPENCV_DNN_CUDA=ON \ | |
-D ENABLE_FAST_MATH=1 \ |
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 cv2 | |
from cv2 import dnn_superres | |
# Create an SR object | |
sr = dnn_superres.DnnSuperResImpl_create() | |
# Read image | |
image = cv2.imread('./input.png') | |
# Read the desired model |
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
% Code created by Xavier Weber | |
% Create an image -- like the one in the GIF. | |
im = zeros(5,5); | |
im(1:1,5:5) = 255; | |
im(2:2,2:2) = 255; | |
im(3:3,1:1) = 255; |
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
% Code created by Xavier Weber | |
function outimg = padImage(I, pad) | |
%padImage Pads an image with black pixels (zero-values) | |
% Works with single or multi-channels | |
% Get input dimensions | |
img_size = size(I); | |
src_height = img_size(1); | |
src_width = img_size(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
% Code created by Xavier Weber | |
% ============= PART 1: READING AND PADDING THE IMAGE ===================== | |
function [count,im] = countBlobs(img) | |
%countBlobs Counts the number of blobs: connected regions of positive | |
% values - and labels them. | |
% returns: number of blobs | |
% Get dimensions |
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
#include <opencv2/dnn_superres.hpp> | |
#include <opencv2/imgproc.hpp> | |
#include <opencv2/highgui.hpp> | |
using namespace std; | |
using namespace cv; | |
using namespace dnn; | |
using namespace dnn_superres; | |
int main(int argc, char *argv[]) |
NewerOlder