Go Resizing Images

Read http://golang.org/pkg/image // you need the image package, and a format package for encoding/decoding import ( “bytes” “image” “image/jpeg” // if you don’t need to use jpeg.Encode, use this line instead // _ “image/jpeg” “github.com/nfnt/resize” ) // Decoding gives you an Image. // If you have an io.Reader already, you can give that to Decode … Read more

OpenCV / SURF How to generate a image hash / fingerprint / signature out of the descriptors?

The feature data you mention (position, laplacian, size, orientation, hessian) is insufficient for your purpose (these are actually the less relevant parts of the descriptor if you want to do matching). The data you want to look at are the “descriptors” (the 4th argument): void cvExtractSURF(const CvArr* image, const CvArr* mask, CvSeq** keypoints, CvSeq** descriptors, … Read more

Detecting multiple images in a single image

The “multiple image” you showed is easy enough to handle using just simple image processing, no need for template matching 🙂 % read the second image img2 = imread(‘https://i.stack.imgur.com/zyHuj.jpg’); img2 = im2double(rgb2gray(img2)); % detect coca-cola logos bw = im2bw(img2); % Otsu’s thresholding bw = imfill(~bw, ‘holes’); % fill holes stats = regionprops(bw, {‘Centroid’, ‘BoundingBox’}); % … Read more

OpenCV template matching and transparency

It doesn’t seem like OpenCV handles alpha the way you want it to. You have two options: Write your own cross-correlation method that will use the alpha channel Transform your images so your alpha channel becomes irrelevant Since the first option is straightforward, I will explore the second option here. I’m going to re-use the … Read more

Merge Image using Javascript

You can use JavaScript to ‘merge’ them into one canvas, and convert that canvas to image. var c=document.getElementById(“myCanvas”); var ctx=c.getContext(“2d”); var imageObj1 = new Image(); var imageObj2 = new Image(); imageObj1.src = “1.png” imageObj1.onload = function() { ctx.drawImage(imageObj1, 0, 0, 328, 526); imageObj2.src = “2.png”; imageObj2.onload = function() { ctx.drawImage(imageObj2, 15, 85, 300, 300); var … Read more