how i can get a filename from an image proviously defined

1 view (last 30 days)
hello.
how i can get a filename from an image previously defined.
a= imread('100126_122731 tamp1.jpg');
b=rgb2gray(a);
imshow(b)
dct2(b,10,10)--> i get error here.
this is the function of dct2:
%% LOSSY COMPRESSION-DECOMPRESSION USNIG DISCRETE COSINE TRANSFORM TECHNIQUE.
function[]=dct2(filename,n,m)
% "filename" is the string of characters including Image name and its
% extension.
% "n" denotes the number of bits per pixel.
% "m" denotes the number of most significant bits (MSB) of DCT Coefficients.
EDIT: two hundred lines of superfluous, copyright code removed. Original file:
  3 Comments
sudarti siburian
sudarti siburian on 23 Jan 2019
thank you. i have rename that function, but it still error
error using imread>parse>parse_inputs
the file name or URL argument must be a string
Stephen23
Stephen23 on 23 Jan 2019
Sure, and my answer shows you how to avoid that error.

Sign in to comment.

Answers (1)

Stephen23
Stephen23 on 23 Jan 2019
fnm = '100126_122731 tamp1.jpg';
a = imread(fnm);
b = rgb2gray(a);
imshow(b)
dct2(fnm,10,10)
  5 Comments
Stephen23
Stephen23 on 26 Jan 2019
@sudarti siburian: do not forget to accept the answer that helps you to resolve your question!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!