Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Database 阿尔海斯图对两幅图像的比较_Database_Matlab_Image Processing_Histogram - Fatal编程技术网

Database 阿尔海斯图对两幅图像的比较

Database 阿尔海斯图对两幅图像的比较,database,matlab,image-processing,histogram,Database,Matlab,Image Processing,Histogram,我的项目是一个关于图像的查询,我是你第一次通过每个图像直方图比较这两个图像,如果相似的话,给我的图片是相似的,但问题是,每当他告诉我输入这两个图像时,这两个图像是不一样的 A=imread('C:\Users\saba\Desktop\images\q4.jpg');%reading images as array to variable 'a'&'b' B = imread('C:\Users\saba\Desktop\images\q1.jpg'); j=rgb2gray(A);

我的项目是一个关于图像的查询,我是你第一次通过每个图像直方图比较这两个图像,如果相似的话,给我的图片是相似的,但问题是,每当他告诉我输入这两个图像时,这两个图像是不一样的

A=imread('C:\Users\saba\Desktop\images\q4.jpg');%reading images as array to variable 'a'&'b' 
B = imread('C:\Users\saba\Desktop\images\q1.jpg');
j=rgb2gray(A);
i=rgb2gray(B);
subplot(2,2,1);imshow(A);
subplot(2,2,2);imshow(B);
subplot(2,2,3);imshow(j);
subplot(2,2,4);imshow(i);

if  histeq(j)==histeq(i)
   disp('The images are same')%output display 
else 
   disp('the images are not same') 
end 

为了直接与
=
操作符进行比较,图像必须是相同的图像。如果您想这样做,只要检查它们的大小是否相同,就可以了

据我所知,没有内置函数或工具箱来检查两个图像是否相似。您可以使用的一种粗略方法是查看每行和每列的像素值之和有多不同:

maxColumnDifference = max(abs(sum(j, 1) - sum(i, 1)));
maxRowDifference = max(abs(sum(j, 2) - sum(i, 2)));
然后,你可以有一些公差,其总和必须在,应该是图像大小的函数。要给出行或列的不同程度的标准答案(0-255),只需将每个总和除以像素数即可

maxColumnDifference = max(abs(sum(j, 1)/size(j,1) - sum(i, 1)/size(i,1)));
maxRowDifference = max(abs(sum(j, 2)/size(j,2) - sum(i, 2)/size(i,2)));
然后,您可以确定它们是否与以下内容相似:

tolerance = 50;
if (maxRowDifference < tolerance) && (maxColumnDifference < tolerance)
    disp('Images are similarish');
else
    disp('Images are not similar enough for this poor tool to recognise');
end
公差=50;
if(maxRowDifference<公差)和&(maxColumnDifference<公差)
disp(“图像相似”);
其他的
disp(“图像不太相似,这个糟糕的工具无法识别”);
结束

请注意,这都是推测,根本没有经过测试,可能有更好的方法。为了直接与
=
操作符进行比较,图像必须是相同的图像。如果您想这样做,只要检查它们的大小是否相同,就可以了

据我所知,没有内置函数或工具箱来检查两个图像是否相似。您可以使用的一种粗略方法是查看每行和每列的像素值之和有多不同:

maxColumnDifference = max(abs(sum(j, 1) - sum(i, 1)));
maxRowDifference = max(abs(sum(j, 2) - sum(i, 2)));
然后,你可以有一些公差,其总和必须在,应该是图像大小的函数。要给出行或列的不同程度的标准答案(0-255),只需将每个总和除以像素数即可

maxColumnDifference = max(abs(sum(j, 1)/size(j,1) - sum(i, 1)/size(i,1)));
maxRowDifference = max(abs(sum(j, 2)/size(j,2) - sum(i, 2)/size(i,2)));
然后,您可以确定它们是否与以下内容相似:

tolerance = 50;
if (maxRowDifference < tolerance) && (maxColumnDifference < tolerance)
    disp('Images are similarish');
else
    disp('Images are not similar enough for this poor tool to recognise');
end
公差=50;
if(maxRowDifference<公差)和&(maxColumnDifference<公差)
disp(“图像相似”);
其他的
disp(“图像不太相似,这个糟糕的工具无法识别”);
结束

请注意,这都是猜测,根本没有经过测试,可能有更好的方法来实现这一点。

第四季度和第一季度的图像是否相同?也许你需要找到相似性的度量,而不是直方图的精确匹配?q4和q1是同一幅图像吗?也许你需要找到相似性的度量,而不是直方图的精确匹配?