take srcimg Under the document bmp The file to jpg Images , Store in dstimg Under the folder
str = 'srcimg';
dst = 'dstimg';
file=dir([str,'\*.bmp']);
for i=:length(file)
img = imread( [str,'\',file(i).name]);
imwrite(img, [dst,'\',file(i).name(1:end-4),'.jpg']);
end Add read all image files
  1. ext = {'*.jpeg','*.jpg','*.png','*.pgm'};
  2. images = [];
  3. for i = 1:length(ext)
  4. images = [images dir([path ext{i}])];
  5. end
  6. % images are returned with absolute path
  7. for i = 1:length(images)
  8. images(i).name = [path images(i).name];
  9. end

matlab Read the file names of all the files in the folder

imgpath = './test';
fileFolder=fullfile(imgpath);% Folder name plane
dirOutput=dir(fullfile(fileFolder,'*'));% If there are different types of files , use ‘*’ Read all , If you read a specific type of file ,'.' Plus the file type , For example ‘.jpg’
fileNames={dirOutput.name}';
images = cell(length(fileNames) - 2,1);
for i = 3:length(fileNames)
imgname = fileNames(i);
imgname = imgname{1};
images{i-2}= [imgpath imgname];
end
images

 

Matlab Read all the... In the folder bmp More articles about the document

  1. Use ftp Read multiple files in a folder , And delete

    public class FTPUtils { private static final Logger LOG = LoggerFactory.getLogger(FTPUtils.class); / ...

  2. java Basics File Recursively delete all file folders in the folder Catalog ( Include subdirectories ) Under the .java File copy to e:/abc In the folder , And statistics java Number of files

    File Recursively delete all file folders in the folder package com.swift.kuozhan; import java.io.File; import java.util.Scanner; /* Keyboard record ...

  3. Use character stream to create a file containing all the file information in each folder readme.txt

    package com.readme; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; i ...

  4. In the folder In the specified type file Find string (CodeBlocks+GCC compile , Console program , Only in Windows Up operation )

    explain : Program usage  io.h  Medium  _findfirst  and  _findnext  Function to traverse the folder , So the program can only be in  Windows  Next use . Program traverses the current folder , Recursive traversal of the folder . At the same time check traversal to ...

  5. 【 Source code 】rm zip Delete a large number of small files in the folder One million Scan file time

    rm   Delete a large number of small files in the folder One million Not deleted yet Scanning files ? rm Delete command source code analysis - ty_laurel The blog of - CSDN Blog https://blog.csdn.net/ty_laurel/ ...

  6. Create a subfolder in the folder where the source program is stored myPackage. for example , stay “D:\java” Create a subfolder with the same name as the package in the folder myPackage(D:\java\myPackage). stay myPackage Create a... In the package YMD class , This class has the ability to calculate the year of this year 、 Can output a string with the date of the function . Design procedure SY31.java, Give someone a name and date of birth , Calculate the person's age , And output the name of the person 、 Age 、 Date of birth . Program usage YM

    Topic supplement : Create a subfolder in the folder where the source program is stored myPackage. for example , stay “D:\java” Create a subfolder with the same name as the package in the folder myPackage(D:\java\myPackage). stay m ...

  7. C++ Read all... From one folder txt file

    Some time ago, to do a project, you need to read all the files in a folder txt file , After querying the data, we get the following implementation method : First, let's look at this structure struct _finddata_t {    unsigned    attrib;    t ...

  8. shell Script example 1 , Move a folder larger than 2000B To another folder

    shell Scripts can help us simplify linux Some of the work in the future , Now there's a need , hold TMPA The folder is larger than 2000B All the files are moved to TMPB Next #! /bin/bash function movefiles() { ` d ...

  9. C# 1. Copy the entire folder to the destination folder 2. Copy the specified file to the specified destination folder

    ].Items.Clear(); string filePath = Application.StartupPath; string sourcePath = Path.Combine(filePat ...

Random recommendation

  1. 0002--Weekly Meeting on 27th March and 3th April, 2015

    27th March, 2015 (1) RankNet && PageRank ->reporter: jinquan Du   Web_RankNet  Web_PageRa ...

  2. centos6.5 redis3 Power on auto start command settings

    modify redis.conf, Turn on the background Run option : # By default Redis does not run as a daemon. Use 'yes' if you need it. # Note ...

  3. Opencv You don't have to create a project configuration every time vs2010 vc++ Catalog Library Directory, etc

    Can be set to the compiler's environment configuration ,VS2010 Compared with other versions, although the compiler configuration is removed But you can configure the compiler environment through the property manager . Set the corresponding vc++ Catalog Linker is OK , This is the configuration of the whole compiler You don't have to match it next time .

  4. according to List Sort an attribute of an object in

    Not much to say , Look directly at the code : package test; import java.util.ArrayList; import java.util.Collections; import java.util. ...

  5. POJ--1679--The Unique MST【 infer MST Is it unique? 】

    link :http://poj.org/problem? id=1679 The question : Tell you there is n A little bit ,m side , as well as m Information of the edge ( The starting point . End . A weight ). Infer whether the minimum spanning tree is unique It was done in another way before . The complexity is the highest ...

  6. vim Beautify the basic configuration

    stay home Create a .vimrc file vim ~/.vimrc File basic configuration " Set to load automatically when files are changed set autoread " quickfix Pattern autocm ...

  7. stay windows End use jupyter notebook, The server acts as the background computing cloud Simplified description

    stay CentOS7 Server side start jupyter notebook service , stay windows End use jupyter notebook, The server acts as the background computing cloud Simplified description CentOS7 Server side jupyter no ...

  8. Learn from the factory director PHP7 kernel ( 6、 ... and ): One of the variables zval

    I remember the widely spread stories on the Internet "PHP Is the best language in the world ", Let's not discuss whether it's too much , But at least PHP It's true that there are unique advantages , For example, its weak type , The only need $ Symbols can declare variables , bring PHP The threshold to get started is very low , Become ...

  9. Data warehouse Foundation ( 7、 ... and )Informatica PowerCenter Introduce

    Reprinted from :http://www.cnblogs.com/evencao/p/3140938.html  Infromatica PowerCenter Introduce : 1993 Founded in California, USA , A year later ...

  10. Nivo Slider usage

    Sample code : <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...