当前位置:网站首页>Image feature computation and representation -- content based image retrieval
Image feature computation and representation -- content based image retrieval
2022-06-29 17:57:00 【Hua Weiyun】
| 1️⃣ Job requirements |
|---|
| 2️⃣ Core code |
|---|
# coding:utf-8def extract_features(image_path, vector_size=32): image = imageio.imread(image_path) try: # Using KAZE, cause SIFT, ORB and other was moved to additional module alg = cv2.KAZE_create() # Finding image keypoints # Find image keys kps = alg.detect(image) # Getting first 32 of them. # Before calculation 32 individual # Number of keypoints is varies depend on image size and color pallet # The number of keys depends on the image size and the color palette # Sorting them based on keypoint response value(bigger is better) # Sort according to the return value of the key ( The bigger the better ) kps = sorted(kps, key=lambda x: -x.response)[:vector_size] # computing descriptors vector # Compute descriptor vector kps, dsc = alg.compute(image, kps) # Flatten all of them in one big vector - our feature vector # Put it in a large vector , As our eigenvector dsc = dsc.flatten() # Making descriptor of same size # Make descriptors the same size # Descriptor vector size is 64 # The size of the descriptor vector is 64 needed_size = (vector_size * 64) if dsc.size < needed_size: # if we have less the 32 descriptors then just adding zeros # at the end of our feature vector # If less than 32 A descriptor , Then zero is added after the eigenvector dsc = np.concatenate([dsc, np.zeros(needed_size - dsc.size)]) except cv2.error as e: print('Error: ', e) return None return dsc| 3️⃣ experimental result |
|---|
We randomly select a picture from the dataset :
Frame an area in the image with the mouse :
Then press enter to obtain the five pictures in the data set that are closest to the characteristics of the framed target area :
The matching value of each picture will also be output , The matching value here is the cosine distance between the feature of the target area and the image in the database , If you want to be more similar , Data sets can be expanded , Make the features more suitable :
| Experiment source code + The report |
|---|
边栏推荐
- 上班可以做副业
- What is the SRM system? How do I apply the SRM system?
- 一次采集JSON解析错误的修复
- 牛客小Bai月赛52 D 环上食虫(尺取+st表)
- 基于STM32F103ZET6库函数串口实验
- Two controller layer interface authentication methods
- Graduation season | Huawei experts teach interview tips: how to get a high salary offer from a large factory?
- 2022 spring summer collection koreano essential reshapes the vitality of fashion
- 填充每个节点的下一个右侧节点指针[利用好每个点->尽可能降低时空复杂度]
- VB.Net读写NFC Ntag标签源码
猜你喜欢

第42期:MySQL 是否有必要多列分区

ISO 32000-2 国际标准7.7

Niuke Xiaobai monthly race 52 E group logarithmic sum (inclusion exclusion theorem + dichotomy)

Top 30 open source software

SRM supplier collaborative management system function introduction

让 Google 搜索到自己的博客

基于注解和拦截器防止表单重复提交

与爱同行,育润走进贫困家庭,助推公益事业

Premature end of script headers 或 End of script output before headers

2022 spring summer collection koreano essential reshapes the vitality of fashion
随机推荐
Have you grasped the most frequently asked question in the interview about massive data processing?
SRM系统是什么系统?如何应用SRM系统?
图像特征计算与表示——基于内容的图像检索
Openfeign use step polling strategy and weight log4j configuration of openfeign interceptor
Can MySQL views create indexes
Issue 42: is it necessary for MySQL to have multiple column partitions
Force deduction daily question 06.29 add two numbers
ISO 32000-2 国际标准7.7
lodash深拷贝使用
Function independent watchdog (iwdg) experiment based on stm32f103zet6 Library
Face recognition 4- research on Baidu commercial solutions
使用autoIt 上传文件
You can do sideline work
selenium 组合键操作
/usr/bin/ld: warning: **libmysqlclient.so.20**, needed by //usr/
如何使用B/S开发工具DevExtreme的图表控件 - 自定义轴位置?
On adding and subtracting dates
2022春夏系列 KOREANO ESSENTIAL重塑时装生命力
基于STM32F103ZET6库函数PWM输出实验
小程序容器是什么技术?能助力物联网企业红海突围?