新建全色或者resize(毫无价值,只是做记录)

Posted ziytong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了新建全色或者resize(毫无价值,只是做记录)相关的知识,希望对你有一定的参考价值。

import glob
import os,sys
import shutil
import numpy as np
import cv2
import matplotlib.pyplot as plt
# fileDir = ‘F:/project/Breast/InBreast/INBreast/outimgpatch/allnocalcification/‘
fileDir = F:/project/Breast/InBreast/INBreast/removeother/
source = F:/project/Breast/InBreast/INBreast/imgtest/20586960.png
tarDir = F:/project/Breast/InBreast/INBreast/labelblack/    #源图片文件夹路径



if __name__ == __main__:
    txtLists = os.listdir(fileDir)  # 列出文件夹下所有的目录与文件
    img1 = cv2.imread(source)
    for filename in txtLists:
        print(filename)
        img = cv2.imread(fileDir + filename)
        print(type(img))
    #img = np.zeros((112, 112,3))  # cv2.imread(‘F:/project/Breast/InBreast/INBreast/outimgpatch/allnocalcification/20586908_1.png‘)
        img2 = cv2.resize(img1,(img.shape[1],img.shape[0]))
        # for i in range(img.shape[0]):
        #     for j in range(img.shape[1]):
        #         for k in range(3):
        #             img[i, j, k] = 0
        cv2.imwrite(tarDir+filename,img2)


    # plt.imshow(img)
    # plt.show()

    cv2.imwrite(tarDir + 1.png, img)

 

以上是关于新建全色或者resize(毫无价值,只是做记录)的主要内容,如果未能解决你的问题,请参考以下文章

图像融合基于matlab高分辨率全色图IHS图像融合(含评价指标)含Matlab源码 2406期

遥感影像的全色多光谱高光谱图像

如何通过 rpc 查询获取价值?

Web安全色的意义

新的试飞对于临时分发毫无价值。有啥解决办法吗?

SSconv:全色锐化:显式频谱-空间卷积