Skip to content

Instantly share code, notes, and snippets.

View zabir-nabil's full-sized avatar
🎮
Focusing

Zabir Al Nazi Nabil zabir-nabil

🎮
Focusing
View GitHub Profile
import grpc
# import the generated classes
import image_procedure_pb2
import image_procedure_pb2_grpc
# data encoding
import numpy as np
import base64
import grpc
from concurrent import futures
import time
import image_procedure
# import the generated classes
import image_procedure_pb2
import image_procedure_pb2_grpc
syntax = "proto3";
// input image, width, height
message B64Image {
string b64image = 1;
int32 width = 2;
int32 height = 3;
}
// output prediction
import numpy as np
import base64
import zlib
import requests
import time
t1 = time.time()
for _ in range(1000):
frame = np.random.randint(0,256, (416,416,3), dtype=np.uint8) # dummy rgb image
from flask import Flask, request
from flask_restful import Resource, Api, reqparse
import json
import numpy as np
import base64
# compression
import zlib
@zabir-nabil
zabir-nabil / bibtex2bibitem.py
Created May 5, 2020 20:39
Bibtex 2 bibitem converter python 3
# filename: bibtex2item.py
# python bibtex2item.py
# keep the bibtex in refs.bib file
def convert(bibtex):
bibitem = ''
r = bibtex.split('\n')
i = 0
while i < len(r):
line = r[i].strip()
@zabir-nabil
zabir-nabil / colab_video.ipynb
Created May 3, 2020 04:52
Watching local videos on google colab
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zabir-nabil
zabir-nabil / deskew.py
Created March 1, 2020 06:40
compute skew angle and deskew in python (opencv)
import numpy as np
import math
import cv2
def rotate_image(image, angle):
image_center = tuple(np.array(image.shape[1::-1]) / 2)
rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1.0)
result = cv2.warpAffine(image, rot_mat, image.shape[1::-1], flags=cv2.INTER_LINEAR)
return result
@zabir-nabil
zabir-nabil / deque.cpp
Created September 26, 2015 09:22
BitInhaler
//STL CONTAINER Deque
#include <bits/stdc++.h>
#define p_d_i(d) for(deque<int>::iterator it= d.begin();it!=d.end();it++)cout<<*it<<" ";cout<<endl;
using namespace std;
int main()
{
//same as vector
deque<int>d1;