Skip to content

Instantly share code, notes, and snippets.

View chunibyo-wly's full-sized avatar
🏠
Working from home

Longyong Wu chunibyo-wly

🏠
Working from home
View GitHub Profile
@chunibyo-wly
chunibyo-wly / image_patch_split.py
Last active January 13, 2024 15:03
手动切分图片和标注以及转换 COCO 格式到 DOTA 格式
import cv2
from pycocotools.coco import COCO
from tqdm import tqdm
import numpy as np
import os
import os.path as osp
import shapely
from copy import deepcopy
import json
import shutil
import numpy as np
import cv2
import random
import math
from shapely import LineString
width, height = None, None
def line_segments_intersection(l1, l2):
import cairo
import numpy as np
import math
def cb(x1, y1, x4, y4, xc, yc):
ax = x1 - xc
ay = y1 - yc
bx = x4 - xc
by = y4 - yc
import bpy
from os.path import join
from bpy import context
import mathutils
import math
import builtins as __builtin__
import copy
def console_print(*args, **kwargs):
@chunibyo-wly
chunibyo-wly / Merge7Scenes.py
Created February 16, 2023 03:31
merge 7 scene dataset to point cloud
import open3d as o3d
import numpy as np
from tqdm import trange
from os.path import join
FOLDER = r"E:\workspace\dataset\24_7scene\chess"
def main():
volume = o3d.pipelines.integration.ScalableTSDFVolume(
@chunibyo-wly
chunibyo-wly / Meshroom2Colmap.py
Last active April 11, 2024 13:45
convert meshroom structure from motion results to colmap format
import json, os, shutil
from os.path import join, basename
from tqdm import tqdm
import numpy as np
MESHROOM = r"E:\workspace\dataset\01_DTU\cache\20\meshroom\MeshroomCache\ConvertSfMFormat\4b9ced4a64f3f996f7650f3d5ed9e27c4774a7c9\sfm.json"
COLMAP = r"E:\workspace\dataset\01_DTU\cache\20\colmap"
def make_dir(folder):
@chunibyo-wly
chunibyo-wly / c_cpp_properties.json
Last active January 30, 2023 13:51
vscode qt settings
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
@chunibyo-wly
chunibyo-wly / pegjs
Last active May 28, 2022 12:44
peggy
start
= operation
operation
= WSS a:entity WSS b:operator WSS c:operation WSS { return `${a} ${b} ${c}`; }
/ WSS a:entity WSS b:operator2 WSS c:operation WSS { return `${a}${b}${c}`; }
/ WSS a:entity WSS c:operation WSS { return `${a}${c}`; }
/ WSS a:entity WSS { return a; }
entity "entity"
CVPixelBufferLockBaseAddress(depthFrame, .readOnly)
let rowData = CVPixelBufferGetBaseAddress(depthFrame)! + Int(depthPoint.y) * CVPixelBufferGetBytesPerRow(depthFrame)
// swift does not have an Float16 data type. Use UInt16 instead, and then translate
var f16Pixel = rowData.assumingMemoryBound(to: UInt16.self)[Int(depthPoint.x)]
CVPixelBufferUnlockBaseAddress(depthFrame, .readOnly)
var f32Pixel = Float(0.0)
var src = vImage_Buffer(data: &f16Pixel, height: 1, width: 1, rowBytes: 2)
var dst = vImage_Buffer(data: &f32Pixel, height: 1, width: 1, rowBytes: 4)
vImageConvert_Planar16FtoPlanarF(&src, &dst, 0)
@chunibyo-wly
chunibyo-wly / getDepthData.m
Created March 2, 2021 07:46
get depth data
CVPixelBufferLockBaseAddress(pixelBuffer, kCVPixelBufferLock_ReadOnly);
const uint8_t* baseAddress = (const uint8_t*)CVPixelBufferGetBaseAddress(pixelBuffer);
for (size_t y = 0; y < height; ++y) {
const __fp16* data = (const __fp16*)(baseAddress + y * stride);
for (size_t x = 0; x < width; ++x, ++data) {
__fp16 depth = *data;
if (!isnan(depth) && depth > minDepth) {