Making a graph with images

3 views (last 30 days)
Ivana Smith
Ivana Smith on 14 Apr 2022
Answered: Walter Roberson on 14 Apr 2022
Hello!
I have a set of 5 images, all different degrees of a scrambled image named scrambled_10.png [...] scrambled_50.png. I have it set so that people have to respond 1 for 'no image' and 2 for 'image present'. I want to create a graph with the degree of scrambled image on the X axis going from 10-50 and the Y axis to be the proportion of times the person responds 2. The issue is I do not know how to create the X axis as my values are associated to images. Is there a way to have MatLab create an associated numerical value to each image?
I also want to find the absolute threshiold at which the person said '2' 50 of the time, and the X axis value can be a number between 2 images, so say I only have images for 30% and 40%, the absolute threshold could equal a value of 35% if that makes sense?
Please send me any links that might help me with this problem! Thank you!

Accepted Answer

Walter Roberson
Walter Roberson on 14 Apr 2022
The following shows how to convert everything from after the first _ to the extension as a number. The degree can include fractions. (If you do not need fractions then the code can be simplified.)
Note: this particular implementation will fail if you have additional underscore in the basic file name.
ImageName = 'scrambled_47.2.png';
[~, basename] = fileparts(ImageName);
ScrambleDegree = str2double(regexp(basename, '(?<=_).*$', 'match'))
ScrambleDegree = 47.2000

More Answers (0)

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!