I have a Folder with subfolders of images. The subfolders consist of .JPG, .jpg and .jfif, I need them all to be converted to a single format and returned to their folders?

4 ビュー (過去 30 日間)
Eoghan Mckay
Eoghan Mckay 2022 年 3 月 21 日
回答済み: DGM 2022 年 3 月 22 日
imds = imageDatastore('batch_9','IncludeSubfolders',true,'LabelSource','foldernames');
segIm = pixelLabelDatastore('PixelLabelData');
Error using imageDatastore (line 139)
Input folders or files contain non-standard file extensions.
Use FileExtensions Name-Value pair to include the non-standard file extensions.
Error in Segmenattion (line 9)
imds = imageDatastore('batch_9','IncludeSubfolders',true,'LabelSource','foldernames');
I have a labelled pixel data for sematic segmenattion but the images that I have manually segmented are different formats so I cannot create an imageDataStore from the image files so that I can train a sematic segmentation network. Does anyone know how to change the file format of each image in the subfolders of batch_9 and replace them with the new common image files to their original folders?
  1 件のコメント
Walter Roberson
Walter Roberson 2022 年 3 月 22 日
https://www.mathworks.com/matlabcentral/fileexchange/90840-jpeg-baseline-matlab-code might help with the jfif perhaps

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2022 年 3 月 22 日
編集済み: Image Analyst 2022 年 3 月 22 日
imformats
EXT ISA INFO READ WRITE ALPHA DESCRIPTION ----------------------------------------------------------------------------------------- bmp isbmp imbmpinfo readbmp writebmp 0 Windows Bitmap cur iscur imcurinfo readcur 1 Windows Cursor resources fts fits isfits imfitsinfo readfits 0 Flexible Image Transport System gif isgif imgifinfo readgif writegif 0 Graphics Interchange Format hdf ishdf imhdfinfo readhdf writehdf 0 Hierarchical Data Format ico isico imicoinfo readico 1 Windows Icon resources j2c j2k isjp2 imjp2info readjp2 writej2c 0 JPEG 2000 (raw codestream) jp2 isjp2 imjp2info readjp2 writejp2 0 JPEG 2000 (Part 1) jpf jpx isjp2 imjp2info readjp2 0 JPEG 2000 (Part 2) jpg jpeg isjpg imjpginfo readjpg writejpg 0 Joint Photographic Experts Group pbm ispbm impnminfo readpnm writepnm 0 Portable Bitmap pcx ispcx impcxinfo readpcx writepcx 0 Windows Paintbrush pgm ispgm impnminfo readpnm writepnm 0 Portable Graymap png ispng impnginfo readpng writepng 1 Portable Network Graphics pnm ispnm impnminfo readpnm writepnm 0 Portable Any Map ppm isppm impnminfo readpnm writepnm 0 Portable Pixmap ras isras imrasinfo readras writeras 1 Sun Raster svs istif imtifinfo readtif 0 Aperio ScanScope Virtual Slide tif tiff istif imtifinfo readtif writetif 0 Tagged Image File Format xwd isxwd imxwdinfo readxwd writexwd 0 X Window Dump
You may have to find a third party program like ImageMagick or something to convert jfif.

DGM
DGM 2022 年 3 月 22 日
At least with the JFIF files I have, imread() has no problem reading them. imageDatastore() ignores them, but throws no error (maybe version differences). If I use the 'fileextensions' option as the message suggests, it picks them up and reads them just fine. Using readimage() works fine on them.
fext = {'.jpg','.jfif'}; % case-insensitive
imds = imageDatastore('./','IncludeSubfolders',false,'fileextensions',fext);
I haven't run across any files that have any issues with this, but maybe it's possible.

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by