Skip to content

Instantly share code, notes, and snippets.

View IngIeoAndSpare's full-sized avatar
✈️
여행가고싶다

WI-Hyun-joong IngIeoAndSpare

✈️
여행가고싶다
  • korea
View GitHub Profile
@IngIeoAndSpare
IngIeoAndSpare / ObjFileReader.py
Last active March 28, 2023 00:15
Code snippet to determine whether tiles are included, not included, or across a boundary in a specific polygon area
## This reader is code written for the personal use of @IngIeoAnd0Spare.
## Unauthorized modification and use without permission is prohibited.
@IngIeoAndSpare
IngIeoAndSpare / SegmentationImage2CocoJson.py
Created April 19, 2022 02:04
create coco json from segmentation image
import json
import os
import numpy as np
from skimage import measure
from shapely.geometry import Polygon, MultiPolygon
from PIL import Image
from tqdm import tqdm
# input your segmentation image dir
context_path = ""
@IngIeoAndSpare
IngIeoAndSpare / koreanDisplay.py
Created April 15, 2021 05:06
colab 한글깨짐 방지
import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.font_manager as fm
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
!apt -qq -y install fonts-nanum
fontpath = '/usr/share/fonts/truetype/nanum/NanumBarunGothic.ttf'
@IngIeoAndSpare
IngIeoAndSpare / drawLine.cs
Created March 30, 2021 08:14
DrawLineInUnity
public void drawTestLine(XDOInfo xdoInfo){
float radiusRatio = 10000 / (float)6378137;
// convert : -y , z, -x
double min_x = (double)xdoInfo.boundMinY * -1 * radiusRatio;
double min_y = (double)xdoInfo.boundMinZ * radiusRatio;
double min_z = (double)xdoInfo.boundMinX * -1 * radiusRatio;
double max_x = (double)xdoInfo.boundMaxY * -1 * radiusRatio;
double max_y = (double)xdoInfo.boundMaxZ * radiusRatio;
@IngIeoAndSpare
IngIeoAndSpare / reversGeoCoding.py
Created March 11, 2021 05:00
geocoding using VWorld
## url 접속을 위한 실습
import urllib
import json
import folium
geo_url_context = "http://api.vworld.kr/req/address?service=address&request=getcoord&version=2.0"
## url 주기
@IngIeoAndSpare
IngIeoAndSpare / fileListGetter.cs
Last active August 3, 2020 10:20
example file list
using System.IO;
// list init for file info dto
List<TargetFileInfoDTO> fileInfoList = new List<TargetFileInfoDTO>();
// root file path (dds, jpg file root path)
string ROOT_FILE_PATH = @"FILE_PATH";
// search option dict
@IngIeoAndSpare
IngIeoAndSpare / coordinateUtil.cs
Created June 18, 2020 00:59
Tile coordinate convert code
private (double, double) convertWsg84Coordinate(double x, double y, double z)
{
double lat = Math.Asin(z / Math.Sqrt(x * x + y * y + z * z)) * (180 / Math.PI);
double lot = -Math.Atan2(y, x) * (180 / Math.PI);
return (lat, lot);
}
//wsg84 coordinate
public (string, string) calculateTileIdLatLot(double lat, double lot, int level)
{
@IngIeoAndSpare
IngIeoAndSpare / convertPng.py
Created April 2, 2020 07:08
background add alpha layer and convert png image
import cv2
def transBg(self, img):
tmp = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
_,alpha = cv2.threshold(tmp,0,255,cv2.THRESH_BINARY)
b, g, r = cv2.split(img)
rgba = [b,g,r, alpha]
dst = cv2.merge(rgba,4)
return dst
@IngIeoAndSpare
IngIeoAndSpare / pngtosvg.py
Last active March 5, 2020 07:23
Batch Convert PNG to SVG (python 3.x)
import os
import base64
def main():
startSvgTag = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
@IngIeoAndSpare
IngIeoAndSpare / GetTestFile.py
Created December 5, 2019 08:36
file copyer
## file metadata module
import os.path
import shutil
from os import listdir
from os.path import isfile, join
BYNARY_FILE_PATH = 'E:\\map_tile_checker\\train_data'
TEST_FILE_PATH = 'E:\\map_tile_checker\\test_data'
LABEL_ARRAY = ['dispersion', 'line', 'square', 'unspecified_shapes']