Message Boards Message Boards

Import images, use the GradientOrientationFilter and export them?


I would like to import images from a folder, pass them through the GradientOrientationFilter and save the output image in another folder.

I have tried many ways but was unsuccesful at doing it. I am able to manually drag a single image apply the filter and manually save the output but i am unable to do it for the images in a folder and export them automatically to a different folder. I used the example in the documentation to manually do it

GradientOrientationFilter[img,4]// ImageAdjust

Can someone please help me on how to write a loop to perform the above operation.


POSTED BY: Pushkar D
11 days ago

There are many ways you can do that.

Here is one:

pathToFiles = "/yourPath/..";
newPath = FileNameJoin[{pathToFiles, "newPath"}];
files = FileNames["*.jpg", pathToFiles];
Export[FileNameJoin[{newPath, FileNameTake[#, -1]}], ImageAdjust[GradientOrientationFilter[Import[#], 4]]] & /@ files
POSTED BY: Mikayel Egibyan
11 days ago

Thank you

POSTED BY: Pushkar D
11 days ago

Group Abstract Group Abstract