Skip to content

Instantly share code, notes, and snippets.

@shaobin0604
shaobin0604 / smooth_pose_data.py
Created December 16, 2024 08:18 — forked from smeschke/smooth_pose_data.py
Smooth Pose Estimation Data
import pandas as pd
import numpy as np
import cv2, os
import scipy
from scipy import signal
import csv
circle_color, line_color = (255,255,0), (0,0,255)
window_length, polyorder = 13, 2
sd = "workout"
@shaobin0604
shaobin0604 / CalculateCenterCropPercent.java
Created December 6, 2024 10:03
ImageView ScaleType.CENTER_CROP 实现逻辑
class Scratch {
private static int[] calculateCropPercent(int srcWidth, int srcHeight, int dstWidth, int dstHeight) {
float targetAspect = (float) dstHeight / (float) dstWidth;
int outWidth, outHeight;
if (srcHeight > srcWidth * targetAspect) {
// limited by narrow width; reduce height
outWidth = srcWidth;
outHeight = (int) (srcWidth * targetAspect);
@shaobin0604
shaobin0604 / test_jpeg_decode.py
Created November 12, 2024 01:54
jpeg decode speed test
import os
import timeit
import unittest
import cv2
import torch
import torchvision.io as io
from turbojpeg import TurboJPEG
from nvjpeg import NvJpeg
import numpy as np
@shaobin0604
shaobin0604 / Polynomial.java
Created December 5, 2022 03:18 — forked from derlin/Polynomial.java
a polynomial class for java implementing the basic operations +, -, /, *, compose and integrate.
// see http://introcs.cs.princeton.edu/java/92symbolic/Polynomial.java.html
public class Polynomial{
private int[] coef; // coefficients
private int deg; // degree of polynomial (0 for the zero polynomial)
// a * x^b
public Polynomial( int a, int b ){
coef = new int[ b + 1 ];
@shaobin0604
shaobin0604 / SlimScreenRecordTabFragment.java
Last active November 9, 2022 07:01
Mix Video with vocal audio and music audio using ffmpeg
package com.arthenica.ffmpegkit.test;
import static com.arthenica.ffmpegkit.test.MainActivity.TAG;
import static com.arthenica.ffmpegkit.test.MainActivity.notNull;
import android.os.Bundle;
import android.os.Environment;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.View;
@shaobin0604
shaobin0604 / iframe-probe.py
Created July 7, 2022 09:39 — forked from ragnraok/iframe-probe.py
Shows GOP structure for video file using ffmpeg --show-frames output
#!/usr/bin/env python
#
# Shows GOP structure of video file. Useful for checking suitability for HLS and DASH packaging.
# Example:
#
# $ iframe-probe.py myvideo.mp4
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
/*
* Copyright (C) 2014 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
#Sun May 12 15:08:17 ICT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-5.1.1-all.zip
@shaobin0604
shaobin0604 / TextDelegateHack.java
Created May 9, 2020 05:03
lottie text delegate
import com.airbnb.lottie.TextDelegate;
import org.joor.Reflect;
import java.util.Map;
public class TextDelegateHack {
private Reflect mTextDelegateRef;
@shaobin0604
shaobin0604 / AnimateCounter.java
Created April 29, 2020 09:21 — forked from bmarrdev/AnimateCounter.java
AnimateCounter provides ability to animate the counting of numbers using the builtin Android Interpolator animation functionality.
/*
* Copyright (C) 2015 Hooked On Play
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software