Can't access data using " .DateTime " string

hey, I'm taking image processsing ccourse from coursera by MATHWORKS. but there is a problem in accessing date and time of a picture in matlab using following given method in this course. please help in this query so that i can continue my course.

댓글 수: 2

Stephen23
Stephen23 2024년 11월 10일
What fields does METADATA contain? How did you create METADATA?
Laiba
Laiba 2024년 11월 10일
metadata is created as shown below..... following are the fields that metadata contains.

댓글을 달려면 로그인하십시오.

 채택된 답변

Star Strider
Star Strider 2024년 11월 10일
Perhaps this —
imshow(imread('peppers.png'))
metadata = imfinfo('peppers.png')
metadata = struct with fields:
Filename: '/MATLAB/toolbox/matlab/matlab_images/png/peppers.png' FileModDate: '13-Jul-2023 20:26:13' FileSize: 287677 Format: 'png' FormatVersion: [] Width: 512 Height: 384 BitDepth: 24 ColorType: 'truecolor' FormatSignature: [137 80 78 71 13 10 26 10] Colormap: [] Histogram: [] InterlaceType: 'none' Transparency: 'none' SimpleTransparencyData: [] BackgroundColor: [] RenderingIntent: [] Chromaticities: [] Gamma: [] XResolution: [] YResolution: [] ResolutionUnit: [] XOffset: [] YOffset: [] OffsetUnit: [] SignificantBits: [] ImageModTime: '16 Jul 2002 16:46:41 +0000' Title: [] Author: [] Description: 'Zesty peppers' Copyright: 'Copyright The MathWorks, Inc.' CreationTime: [] Software: [] Disclaimer: [] Warning: [] Source: [] Comment: [] OtherText: [] AutoOrientedWidth: 512 AutoOrientedHeight: 384
DateTime = datetime(metadata.FileModDate)
DateTime = datetime
13-Jul-2023 20:26:13
.

댓글 수: 6

Laiba
Laiba 2024년 11월 10일
이동: Star Strider 2024년 11월 10일
Thank you so much for answering, this solved above problem but there is one more problem now...
can you also tell how to solve this problem now?
I cannot find anything with respect to the camera in the imfinfo properties.
imshow(imread('peppers.png'))
metadata = imfinfo('peppers.png')
metadata = struct with fields:
Filename: '/MATLAB/toolbox/matlab/matlab_images/png/peppers.png' FileModDate: '13-Jul-2023 20:26:13' FileSize: 287677 Format: 'png' FormatVersion: [] Width: 512 Height: 384 BitDepth: 24 ColorType: 'truecolor' FormatSignature: [137 80 78 71 13 10 26 10] Colormap: [] Histogram: [] InterlaceType: 'none' Transparency: 'none' SimpleTransparencyData: [] BackgroundColor: [] RenderingIntent: [] Chromaticities: [] Gamma: [] XResolution: [] YResolution: [] ResolutionUnit: [] XOffset: [] YOffset: [] OffsetUnit: [] SignificantBits: [] ImageModTime: '16 Jul 2002 16:46:41 +0000' Title: [] Author: [] Description: 'Zesty peppers' Copyright: 'Copyright The MathWorks, Inc.' CreationTime: [] Software: [] Disclaimer: [] Warning: [] Source: [] Comment: [] OtherText: [] AutoOrientedWidth: 512 AutoOrientedHeight: 384
DateTime = datetime(metadata.FileModDate)
DateTime = datetime
13-Jul-2023 20:26:13
Source = metadata.Source
Source = []
Here, the Source field is simply empty. See if that works with your image.
.
Laiba
Laiba 2024년 11월 10일
thankyou you solved my problem
Star Strider
Star Strider 2024년 11월 10일
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Walter Roberson
Walter Roberson 2024년 11월 10일
편집: Walter Roberson 2024년 11월 10일
According to the documentation for imfinfo()
  • DNG, JPEG, and TIFF only — If filename contains Exif tags, then info might include DigitalCamera or GPSInfo (global positioning system information) fields.
So this applies only to .dng, .jpg, .jpeg, .tif, and .tiff files, and only if the file includes EXIF tags, and even then only if the EXIF tags happen to include DigitalCamera or GPSInfo . If any of these three conditions are not satisfied, the DigitalCamera field will simply not be present. It will not "be present but empty" in such cases: it will literally not be present in such cases.
I was not able to find any case that potentially included a DateTime field.
Star Strider
Star Strider 2024년 11월 10일
@Walter Roberson — Thank you for the clarification!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

제품

릴리스

R2023a

질문:

2024년 11월 10일

댓글:

2024년 11월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by