反向图像搜索实现 [英] Reverse image search implementation

查看:151
本文介绍了反向图像搜索实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试制作一个包含多个具有图案和形状的图像的站点(假设每个图片中的正方形和圆形的颜色和形状各不相同).我的目标是为用户提供一种上传他们的图案图像并进行反向图像搜索的方法,以检查我的网站中是否已经存在相似的图案图像.那么,有没有办法通过自定义代码或使用任何第三方api/widgets等来实现相同的目标?

I am currently trying to make a site which will contain several images with patterns and shapes (Lets say few squares and circles of various colors and shape in each picture). And I am aiming to provide the user a way to upload their images of the pattern and do a reverse image search to check whether similar pattern image already exists in my site or not. So is there any way to implement the same, either by custom code or by using any third party api/widgets etc?

推荐答案

下面的Ashish是一个函数的matlab代码,该函数生成特定二进制对象表面的签名,该签名几乎与大小有关,您可以使用此概念进行匹配不同比例的形状.

Hi Ashish below is a matlab code for a function which generates signature of a particular binary object's surface, which is nearly size dependent, you can use this concept for matching a shape on different scale.

function sig = signature(bw,prec)
        boundry = bwboundaries(bw);

        xy = boundry{1};

        x = xy(:,1);
        y = xy(:,2);

        len = length(x);
        res = (len/prec);

        re = rem(res,2);

        if re
            res = ceil(res);
        end

        indexes = 1:res:len;

        xnew = x(indexes);
        ynew = y(indexes);

        cx = round(mean(xnew));
        cy = round(mean(ynew));

        xn = abs(xnew-cx);
        yn = abs(ynew-cy);

        sig = (xn.^2+yn.^2);
        sig = sig/max(sig);

以下是如何使用签名功能的示例:

Following is the example of how to use signature function:

        clc
        clear all
        close all

        path = 'E:\GoogleDrive\Mathworks\irisDEt\shapes';
        im1 = imread([path,'\3.png']);
        gray1 = ((im1));

        scales = [1,2,3,4];
        gray1 = im2bw(gray1);

        for i = 1:length(scales)
            im = imresize(gray1,scales(i));
            sig = signature(im,25);

            figure,plot(sig)
            fra = getframe();
            image = frame2im(fra);
            imwrite(image,['E:\GoogleDrive\Mathworks\irisDEt\shapes\',num2str(i),'.png'])
        end

下面是测试图像及其签名,用于更改形状相似的od图像.

following is the test image and its signature for changing in size od images which looks similar in shape.

以上所有签名都是由上面给出的代码生成的.

All above signatures are generated by the code given above.

这篇关于反向图像搜索实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆