Skip to content

Instantly share code, notes, and snippets.

View doleron's full-sized avatar
💭
I may be slow to respond.

Luiz doleron doleron

💭
I may be slow to respond.
View GitHub Profile
@doleron
doleron / config_cmake_eclipse_git_project.sh
Last active December 25, 2017 15:45
Bash script to import CMake project from Github and create local Eclipse CDT compatible project
#!/bin/bash
###################################################################################################
# Bash script to import CMake project from Github and create local Eclipse CDT compatible project #
# #
# The CMake Eclipse CDT strategy was taken from here: https://stackoverflow.com/a/9663686/3055724 #
# After run this script you need to import the project in eclipse: #
# File->Import->C/C++->Existing code as Makefile Project->Next #
# Tested in Eclise Oxygen and Luna #
###################################################################################################
@doleron
doleron / wifi_relay_module.ino
Last active May 5, 2019 13:02
Esp8266 01 cheap WIFI Relay Module from Shenzhen LC Technology Co or just lctech-inc.com. Just a example how to control the relay by sending serial hex codes
void setup() {
Serial.begin(9600);
}
void loop() {
byte close[] = {0xA0, 0x01, 0x01, 0xA2};
Serial.write(close, sizeof(close));
delay(2000);
byte open[] = {0xA0, 0x01, 0x00, 0xA1};
@doleron
doleron / forward.txt
Last active September 25, 2018 13:22
// inverse kinematics
// helper functions, calculates angle theta1 (for YZ-pane)
int delta_calcAngleYZ(float x0, float y0, float z0, float &theta) {
float y1 = -0.5 * 0.57735 * f; // f/2 * tg 30
y0 -= 0.5 * 0.57735 * e; // shift center to edge
// z = a + b*y
float a = (x0*x0 + y0*y0 + z0*z0 +rf*rf - re*re - y1*y1)/(2*z0);
float b = (y1-y0)/z0;
// discriminant
float d = -(a+b*y1)*(a+b*y1)+rf*(b*b*rf+rf);
@doleron
doleron / sync your fork with original repo.md
Last active June 18, 2020 03:01
commands to synchronize your fork with original repo
@doleron
doleron / ECLiPSe_prolog_install.md
Last active May 8, 2024 16:46
Installation of ECLiPSe prolog interpreter

This instructions are intended to run on any linux debian, using Ubuntu 20.04 here.

The ECLiPSe prolog website is https://eclipseclp.org/index.html

Disclaimer: ECLiPSe prolog is not Eclipse IDE !

pre flight

as usual, update the machine

@doleron
doleron / medium_yolov5_importing_model.py
Last active January 23, 2022 11:37
Python loading model
import cv2
net = cv2.dnn.readNet('yolov5s.onnx')
#include <opencv2/opencv.hpp>
int main(int, char **)
{
auto net = cv::dnn::readNet("yolov5s.onnx");
return 0;
}
@doleron
doleron / medium_yolov5_frame_input.py
Last active January 23, 2022 11:36
python format input
def format_yolov5(source):
# put the image in square big enough
col, row, _ = source.shape
_max = max(col, row)
resized = np.zeros((_max, _max, 3), np.uint8)
resized[0:col, 0:row] = source
# resize to 640x640, normalize to [0,1[ and swap Red and Blue channels
result = cv2.dnn.blobFromImage(resized, 1/255.0, (640, 640), swapRB=True)
@doleron
doleron / medium_yolov5_frame_input.cpp
Last active January 24, 2022 12:20
C++ format input
cv::Mat format_yolov5(const cv::Mat &source) {
// put the image in a square big enough
int col = source.cols;
int row = source.rows;
int _max = MAX(col, row);
cv::Mat resized = cv::Mat::zeros(_max, _max, CV_8UC3);
source.copyTo(resized(cv::Rect(0, 0, col, row)));
// resize to 640x640, normalize to [0,1[ and swap Red and Blue channels
@doleron
doleron / medium_yolov5_calling_model.py
Last active January 23, 2022 11:47
Python calling model
predictions = net.forward()
output = predictions[0]