图像特征提取实验作业

# 在绘图中显示中文字体,而非乱码
from pylab import mpl
mpl.rcParams["font.sans-serif"] = ["SimHei"]
import cv2
import matplotlib.pyplot as plt
import numpy as np
import skimage.feature
import skimage.segmentation
import skimage.data
from pylab import mpl
mpl.rcParams['axes.unicode_minus'] = False

根据本章所学内容,选取两类若干张图片(例如5张猫和5张狗的图片),对其抽取一些特征,并简要分析两类图像之间差异较大的特征,例如猫和狗之间差异较大的特征。根据本章所学内容,选取两类若干张图片(例如5张猫和5张狗的图片),对其抽取一些特征,并简要分析两类图像之间差异较大的特征,例如猫和狗之间差异较大的特征。

#SIFT尺度不变特征变换方法
def detect_sift_features(image_path):
    sift = cv2.SIFT_create()
    img = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)
    keypoints, descriptors = sift.detectAndCompute(img, None)
    img_with_keypoints = cv2.drawKeypoints(img, keypoints, None)
    return img_with_keypoints
a=[你的图片,你的图片,你的图片,你的图片]
b=0
fig, axs = plt.subplots(len(a),1 , figsize=(60, 40))
for i in a:
    img_with_keypoints = detect_sift_features(i)
    img_with_keypoints = cv2.cvtColor(img_with_keypoints, cv2.COLOR_BGR2RGB)
    axs[b].imshow(img_with_keypoints)
    axs[b].set_title('SIFT Features Image {}'.format(b+1))
    axs[b].axis('off')
    b+=1
plt.show()

差异较大的特征请根据你所使用的图片而特异性描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值