在影像處理時,常常會讀取影像資料(binary data)後轉成影像格式(cv::Mat),在進行影像操作。
那我們如何轉成可用的OpenCV影像格式呢?
首先讀取檔案後得到binary data,在進行解碼轉成cv::Mat。
當然如果單純讀檔後轉成OpenCV影像格式,OpenCV是有提供cv::imread這個API可以使用。
| #!/bin/bash | |
| set -o errexit | |
| pushd . | |
| ### Conda | |
| MINIFORGE_INSTALL_PREFIX=$PWD/miniforge3 |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| from argparse import ArgumentParser | |
| import torch | |
| import torch.distributed as dist | |
| from torch.nn.parallel import DistributedDataParallel as DDP | |
| from torch.utils.data import DataLoader, Dataset | |
| from torch.utils.data.distributed import DistributedSampler | |
| from transformers import BertForMaskedLM |
| #!/bin/bash | |
| # ssh-cipher-benchmark.sh - Assesses speed of SSH encryption between specific hosts. | |
| # Usage: | |
| # ssh-cipher-benchmark.sh <remotehost> [ciphers] | |
| # Default ciphers: all we can find... | |
| # | |
| # Note: In some cases, the first cipher tested runs faster than the others, regardless of order. | |
| # Cause of this is not known, but changing the order of testing shows it to be true. Run the | |
| # first one twice if you suspect this. Perhaps it is due to buffering? |
| #!/bin/sh | |
| # Install cuDNN V2 on NVIDIA Jetson TK1 | |
| # Register as a NVIDIA developer and download the cuDNN package | |
| # Package is named cudnn-6.5-linux-ARMv7-V2.tgz | |
| # This script and the cuDNN package should be in the same directory, usually ~/Downloads | |
| # This script places the library and include files for cudnn in the CUDA 6.5 directories | |
| # Make sure this is executing as root | |
| if [ $(id -u) != 0 ]; then | |
| echo "This script requires root permissions" | |
| echo "$ sudo "$0"" |
| #!/bin/sh | |
| # Fresh install for CUDA 6.5 on Jetson TK1 for Linux for Tegra (L4T) 21.1 | |
| # CUDA 6.5 REQUIRES L4T 21.1 !!! | |
| sudo apt-add-repository universe | |
| sudo apt-get update | |
| # This is for L4T r21.1 ; Update for your L4T i.e. r21.3 | |
| wget http://developer.download.nvidia.com/compute/cuda/6_5/rel/installers/cuda-repo-l4t-r21.1-6-5-prod_6.5-14_armhf.deb | |
| # Install the CUDA repo metadata that you downloaded | |
| # This is for L4T 21.1 ; Update for your L4T i.e. 21.3 |
rsync (Everyone seems to like -z, but it is much slower for me)