• Matlab实现将一副彩色扩展黑边


     1 clear;
     2 filenames = dir('E:\file');
     3 N = length(filenames);
     4 j=0;
     5 for i=1:N
     6     [path,name,ext] = fileparts(filenames(i).name);
     7     if strcmp(ext,'.jpg') == 1
     8        
     9         imagedir = strcat('E:\王琳-04-25(new)\MindFind\MindFind\frame\',filenames(i).name);
    10         name = filenames(i).name;
    11         I = imread(imagedir);
    12         [m,n] = size(I);
    13        if m==256 && n== 384*3
    14            i
    15           I = imresize(I,[NaN 300]);
    16           R = I(:,:,1);
    17           G = I(:,:,2);
    18           B = I(:,:,3);
    19           [M,N] = size(R);
    20           K=double(R);
    21           for i=1:300
    22               for j=1:300
    23                   if (i>50)&&(i<=50+M)
    24                       C(i,j) = K(i-50,j);
    25                   else
    26                       C(i,j) = 0;
    27                   end
    28               end
    29           end
    30          C = uint8(C);
    31           
    32           L=double(G);
    33           for i=1:300
    34               for j=1:300
    35                   if (i>50)&&(i<=50+M)
    36                       D(i,j) = L(i-50,j);
    37                   else
    38                       D(i,j) = 0;
    39                   end
    40               end
    41           end
    42             D = uint8(D);
    43             
    44           T=double(B);
    45           for i=1:300
    46               for j=1:300
    47                   if (i>50)&&(i<=50+M)
    48                       E(i,j) = T(i-50,j);
    49                   else
    50                       E(i,j) = 0;
    51                   end
    52               end
    53           end
    54             E = uint8(E);
    55             
    56           Inew(:,:,1) = C;
    57           Inew(:,:,2) = D;
    58           Inew(:,:,3) = E;
    59           savename = strcat('E:\file',name);
    60           imwrite(Inew,savename);
    61           
    62       end
    63     end
    64     
    65 end
  • 相关阅读:
    CS224N Assignment 1扩展阅读——词嵌入
    算法面经总结
    Leetcode刷题笔记(一)
    使用python-Statsmodels进行基于统计学的时间序列分析
    chinaunix book
    行政区划分
    视频网站
    sqlserver还原bak备份文件
    linux给终端设置代理
    ruby中exec,system,%x的区别
  • 原文地址:https://www.cnblogs.com/mlv5/p/2530756.html
Copyright © 2020-2023  润新知