第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

百度點(diǎn)石:農(nóng)作物識(shí)別的 Tiff 數(shù)據(jù)可視化

標(biāo)簽:
人工智能

载入一些必备包:

%matplotlib inline
plt.rcParams['font.sans-serif'] = ['SimHei']  # 指定默认字体, 为在 Matplotlib 中显示中文,设置特殊字体
plt.rcParams['axes.unicode_minus'] = False  # 解决保存图像是负号 '-' 显示为方块的问题
import os
from matplotlib import pyplot as plt
import pandas as pd
import numpy as np
import tifffile #  pip install tifffile

root = r'E:\Data\Zip\GF6_WFV'
val_path = os.path.join(root, '验证集原始图像_8波段.tif')
train_ann_path = os.path.join(root, 'train_sha.txt')  # 训练的标注信息需要将中文文件名改为英文
train_path = os.path.join(root, 'GF6_WFV_E127.9_N46.8_20180823_L1A1119838015.tif')

train_anns = pd.read_csv(train_ann_path, encoding='utf-16')
train_anns.index = train_anns.pop('FID')
imgs = tifffile.imread(train_path).transpose((1, 2, 0))
imgs.shape
(17810, 50362, 8)
plt.imsave(os.path.join(root, '2.jpg'), imgs[:1000,:1500,1])
x0, y0 = .0, 1e-07
raster = []
for fid in range(len(train_anns)):
    a = train_anns.iloc[fid]
    x_l = int(round(a.x))
    y_l = -int(round(a.y))
    r = a['半径']
    raster.append([a['作物'], x_l, y_l, x_l + r, y_l + r])
def scale_percentile(matrix):
    w, h, d = matrix.shape
    matrix = np.reshape(matrix, [w * h, d]).astype(np.float64)
    # Get 2nd and 98th percentile
    mins = np.percentile(matrix, 1, axis=0) # 1% 分位数
    maxs = np.percentile(matrix, 99, axis=0) - mins
    matrix = (matrix - mins[None, :]) / maxs[None, :]
    matrix = np.reshape(matrix, [w, h, d])
    matrix = matrix.clip(0, 1)
    return matrix
fig, axes = plt.subplots(ncols=2, nrows=1, figsize=(16, 6))

p1 = plt.subplot(121)
i1 = p1.imshow(scale_percentile(imgs[:1000, :1000,4:7]))
plt.colorbar(i1)

p2 = plt.subplot(122)
i2 = p2.imshow(imgs[:1000, :1000, 3])
plt.colorbar(i2)

plt.show()

图片描述

ob = raster[0]
ob, imgs.dtype
(['玉米', 12501, 3287, 12504, 3290], dtype('uint16'))
fig, axes = plt.subplots(ncols=2, nrows=1, figsize=(16, 6))
p1 = plt.subplot(121)
i1 = p1.imshow(scale_percentile(imgs[ob[1]:ob[3], ob[2]:ob[4],:3]))
plt.colorbar(i1)
plt.title(ob[0])

p2 = plt.subplot(122)
i2 = p2.imshow(imgs[ob[1]:ob[3], ob[2]:ob[4], 0])
plt.colorbar(i2)
plt.title(ob[0])

plt.show()

图片描述

各个通道的图像:

fig, axes = plt.subplots(ncols=4, nrows=2, figsize=(14, 10))

for i in range(8):
    p = plt.subplot(241+i)
    p.imshow(imgs[100:1000, 100:1000, i])
plt.show()

图片描述

點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消