- [Matlab]删除XLS文件特定Sheet或空白Sheet(默认Sheet);
- [SPEI_SPI]计算栅格、站点;
- [Matlab]统计知网关键词词频;
- [Matlab]
- [Matlab] A powerful toolbox for exporting images, refer to the online documentation for usage instructions; to save images and prevent accidents, use export_fig('exportfig_painters.png', '-png', '-painters', '-r300');. When the image contains Chinese characters, refer to this code snippet: export_fig([name,'.png'], '-png', '-r400','-q300');.
- [Matlab] Get the parent folder path
- [Matlab]Export text on a text file.
- [Matlab]Enhance RGB Image Code.
- [Matlab]To decrease computation time, use GPU processing, if it is available.
- [Matlab]输出图片的强大Toolbox,用法说明参考在线文档(可能需要翻墙)以export_fig('exportfig_painters.png', '-png', '-painters', '-r300');保存图片,避免意外情况;当图片包含中文字符时参考此段代码export_fig([name,'.png'], '-png', '-r400','-q300');;
- [Matlab]Figure全屏命令:set(gcf,'outerposition',get(0,'screensize'));;
1 2 3 4 5 | % Read Image [image, geo]=readgeoraster(imgpath); info=georasterinfo(imgpath); % Save Image geotiffwrite('newimg.tif', image, geo); |
% read a geo-referenced image [image, geo]=readgeoraster(filepath); try info=geotiffinfo(filepath); catch info=georasterinfo(filepath); end % write a geo-referenced image try geotiffwrite(otpath, uint8(class_imag), geo); catch strcmd=['gdalinfo ', filepath]; [~, cmdout]=system(strcmd); epsg=extractBetween(cmdout, "EPSG:"," got from GeoTIFF keys"); epsg=epsg{1}; % geotiffwrite(otpath, uint8(class_imag), geo, 'GeoKeyDirectoryTag', info.GeoTIFFTags.GeoKeyDirectoryTag); geotiffwrite(otpath, uint8(class_imag), geo, 'CoordRefSysCode', ['EPSG:', epsg]); end
1 | geotiffwrite(otpath, uint8(class_imag), geo, 'CoordRefSysCode', ['EPSG:', epsg], 'TiffType', 'bigtiff'); |
1 | geotiffwrite('m2.tif', image, geo, 'GeoKeyDirectoryTag', info.GeoTIFFTags.GeoKeyDirectoryTag); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | %========================================================================================================================== % Gets the folder one level up. If startingFolder is a filename with an extension it gets the containing folder and the child folder is null. % Returns null for both if the folder does not exist, and it's not a filename either. function [parentFolder, childFolder] = GetParentFolder(startingFolder) parentFolder = []; % Initialize childFolder = []; try if isfolder(startingFolder) [parentFolder, childFolder, ext] = fileparts(startingFolder); % Need to append extension for rare cases where deepest folder has a dot in the name. childFolder = [childFolder, ext]; elseif isfile(startingFolder) % It's a filename, not a folder. Need to change otherwise childFolder will be returned as the base file name. [parentFolder, childFolder, ext] = fileparts(startingFolder); childFolder = []; % No child folder since it's a filename, not a folder name. end catch ME message = sprintf('Error in GetParentFolder():\n%s', ME.message); uiwait(msgbox(message)); end return; % from GetParentFolder end |
1 2 3 4 | fid=fopen(txtpath, 'w', 'n', 'US-ASCII'); fprintf(fid, '%s\r\n', num2str(value)); fclose(fid); fclose('all'); |
1 2 3 4 5 6 7 8 9 10 | function enhan_image=GenenhanImage(filepath) % https://www.mathworks.com/matlabcentral/fileexchange/64932-files-for-demystifying-deep-learning-semantic-segmentation-and-deployment?s_tid=srchtitle % Load the images located in the above path using imageDatstore - ML Function imds = imageDatastore(filepath); pic_num = 1; I_raw = readimage(imds, pic_num); enhan_image= histeq(uint8(I_raw)); end |
1 | image=imadjust(image, stretchlim(image), []); |
1 2 3 4 | I = imread("peppers.png"); if(canUseGPU) I = gpuArray(I); end |