使用欧几里德距离显示图像 - opencv python [英] displaying the images using euclidean distance - opencv python
问题描述
i已经部分完成了代码,它就像:
import cv2
来自 collections import *
import CBIR as cb
import 实验 as ex
来自 scipy.spatial import 距离
来自 matplotlib import pyplot as plt
result_list = list()
i = 0
a_list = list()
b_list = list()
a_list.append(ex.feature_matrix_ip)
而 i< 50 :
b_list.append(cb.feature_matrix_db [i])
dist = distance.euclidean(a_list,b_list [i])
result_list.append(dist)
result_list_sort = OrderedDict(sorted(enumerate(result_list),key = lambda x:x [ 0 ]))。键()
i = i + 1
result_list.sort()
res_list_sort = zip(result_list,result_list_sort)
CBIR给出红色,绿色和蓝色均值与GLCM(对比度,能量,同质性和相关性)的数据库图像和实验将给出查询图像的值。
如何显示图像。欢迎任何建议
谢谢!
hey, I am doing a project using python and opencv(cv2). here i am calculating the dataset's image's red,green and blue mean separately and also calculating the GLCM( contrast, energy,homogeneity, and correlation) and saving it in different list's. Now i have calculated the euclidean distance between query image with DB images, but i am unable to display the images with least distance.
i have done the code partially, and it is like:
import cv2
from collections import *
import CBIR as cb
import experiment as ex
from scipy.spatial import distance
from matplotlib import pyplot as plt
result_list = list()
i = 0
a_list = list()
b_list = list()
a_list.append(ex.feature_matrix_ip)
while i < 50:
b_list.append(cb.feature_matrix_db[i])
dist = distance.euclidean(a_list,b_list[i])
result_list.append(dist)
result_list_sort = OrderedDict(sorted(enumerate(result_list),key=lambda x: x[0])).keys()
i = i + 1
result_list.sort()
res_list_sort = zip(result_list,result_list_sort)
CBIR gives red,green and blue mean with GLCM( contrast, energy,homogeneity, and correlation) of DB images and experiment will give the values of the query image.
how to display the images. Any suggestions are welcome
Thanks!
这篇关于使用欧几里德距离显示图像 - opencv python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!