Skip to content

Instantly share code, notes, and snippets.


Tosin Amuda tosinamuda

View GitHub Profile
tosinamuda / EmguImageConversionUtilities.cs
Created Mar 27, 2019
Convert Image File to Matrix with EmguCV C# and Save Matrix as ImageFile
View EmguImageConversionUtilities.cs
using OpenCV = Emgu.CV;
public class Utilities{
public static MathNet.Numerics.LinearAlgebra.Matrix<double>[] LoadImageMatrix(string path)
OpenCV.Mat mat = OpenCV.CvInvoke.Imread(path, OpenCV.CvEnum.ImreadModes.AnyColor);
OpenCV.Image<OpenCV.Structure.Bgr, double> image = mat.ToImage<OpenCV.Structure.Bgr, double>();
OpenCV.Image<OpenCV.Structure.Gray, double> blue = image[0];
OpenCV.Image<OpenCV.Structure.Gray, double> green = image[1];
tosinamuda / image_center.php
Created Dec 14, 2017
How to center a text on an image using php gd
View image_center.php
// Get image dimensions
$image_width = imagesx($image);
$image_height = imagesy($image);
$text_bound = imageftbbox($font_size, $angle, $font, $text);
//Get the text upper, lower, left and right corner bounds
$lower_left_x = $text_bound[0];
$lower_left_y = $text_bound[1];
$lower_right_x = $text_bound[2];