Parameterize Image Name In Function
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
muath shaikh
il 18 Dic 2014
Risposto: muath shaikh
il 18 Dic 2014
Hello Colleagues, I have Function with parameter image name, inside the function i want to write image after some of editing, but i want to take part from image name and add another part as imwrite image name for example
function editing (ImageName)
w=imread(ImageName);
w=double(w);
w=w+0.02;
w=uint8(w);
imwrite(w,'w_ImageName.jpg','jpg');
end
I want the new image name to be w letter with image name.
0 Commenti
Risposta accettata
Joseph Cheng
il 18 Dic 2014
So what you can do is strip the extension off of the ImageName string variable.
function editing (ImageName)
w=imread(ImageName);
w=double(w);
w=w+0.02;
w=uint8(w);
ImageName=ImageName(1:end-4); %strip off the extension;
imwrite(w,['w_' ImageName '.jpg'],'jpg'); %concatenate your prefix and new extension.
end
Più risposte (1)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!