Skip to content

Instantly share code, notes, and snippets.

View EteimZ's full-sized avatar

Youdiowei Eteimorde EteimZ

View GitHub Profile
@EteimZ
EteimZ / abstract_summary.ts
Last active April 3, 2023 12:10
A simple example demonstrating shared behaivor using abstract base class and interface in Typescript
abstract class Summarize {
abstract summarize(): string;
}
class NewsArticle extends Summarize {
headline: string;
place: string;
author: string;
content: string;
@EteimZ
EteimZ / struct_intro.rs
Created April 1, 2023 19:44
Introduction to structs in rust
struct Person{
name: String,
age: u32,
}
impl Person{
fn intro(&self){
println!("My name is {0} and I am {1} years old", self.name, self.age );
}
@EteimZ
EteimZ / trackback_opencv.py
Created March 22, 2023 18:51
Creating trackbar with opencv
import numpy as np
import cv2 as cv
def nothing(x):
pass
# Create a black image, a window
img = np.zeros((300, 512, 3), np.uint8)
cv.namedWindow('image')
@EteimZ
EteimZ / drawing_app_with_mouse.py
Created March 22, 2023 16:35
Introduction to mouse events in opencv
import numpy as np
import cv2 as cv
drawing = False # true if mouse is pressed
mode = True # if True, draw rectangle. Press 'm' to toggle to circle
ix,iy = -1,-1
# mouse callback function
def draw_circle(event,x,y,flags,param):
global ix,iy,drawing,mode
@EteimZ
EteimZ / draw_opencv.py
Created March 22, 2023 13:19
Drawing in opencv
import numpy as np
import cv2 as cv
# create a black image
img = np.zeros((512, 512, 3), np.uint8)
# Draw a diagonal blue line with thickness of 5 px
cv.line(img,(0,0),(512,512),(255,0,0),5)
# Draw a green rectangle with thickness of 3 px without fill
@EteimZ
EteimZ / read_video_from_file.py
Last active March 22, 2023 10:54
Working with Video in opencv
import numpy as np
import cv2 as cv
cap = cv.VideoCapture('vid.mp4')
while cap.isOpened():
ret, frame = cap.read()
# if frame is read correctly ret is True
if not ret:
@EteimZ
EteimZ / load_gray_img.py
Last active March 22, 2023 09:40
Opencv example to load image
import cv2 as cv
import sys
# load gray scale image by setting the flag argument to cv.IMREAD_GRAYSCALE
img = cv.imread("img.jpg", cv.IMREAD_GRAYSCALE)
if img is None:
sys.exit("Could not read the image")
cv.imshow("Display window", img)
@EteimZ
EteimZ / awesome-web-tools.md
Created March 7, 2023 21:05
A list of awesome tools I have come across on the internet.

Awesome tools

This list contains web apps that are useful for performing a particular task.

@EteimZ
EteimZ / Object-maps.html
Created February 25, 2023 00:48
This code combines html image maps with the coco object detection model to enable automatic image detection and linking.
<!-- Load TensorFlow.js. This is required to use coco-ssd model. -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"> </script>
<!-- Load the coco-ssd model. -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/coco-ssd"> </script>
<!-- Replace this with your image. Make sure CORS settings allow reading the image! -->
<img id="img" width=400 height=400 usemap="#workmap" src="./YOUR_NAME.png"/>
@EteimZ
EteimZ / streamlit-hello.py
Last active February 19, 2023 20:07
Testing streamlit out
import streamlit as st
st.write("""
# Streamlit Hello
Hello streamlit
""")