0

I have an image debayering program that I run through command prompt. It can debayer individual images with this command:

DebayerGPU.exe -demosaic DFPD_R -GPU -pattern GRBG -i inputfilename.pgm -o outputfilename.ppm

I'm trying to get it to run on an entire directory of .pgm files, and I discovered the forfiles command.

I've been trying something like:

forfiles /M *.pgm /C "DebayerGPU.exe -demosaic DFPD_R -GPU -pattern GRBG -i @fname.pgm -o @fname.ppm"

but the debayering program just returns its help window when I run that. I have success looping the debayer program if the files are named the same with increasing numbers, then I can use this for loop:

for %a in (0 1 2 3 4 5 6 7 8 9 10 11 1
2 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
39) do DebayerGPU.exe -demosaic DFPD_R -CPU -pattern GRBG -i single%a.pgm -o si
ngle%a.ppm

and that works, but as of now, forfiles doesn't. I suspect it has something to do with the program not accepting the @fname from forfiles. Any thoughts for how to get around this?

Thanks!

4

1 回答 1

0

想通了!

我尝试使用十六进制转义字符(0x22),但没有奏效。% 也没有逃脱。

因此,我制作了一个迷你 for 循环并将 @fname 作为字符串。

forfiles /M *.pgm /C "cmd /c for %s in (@fname) do DebayerGPU.exe -demosaic DFPD_R -CPU -pattern GRBG -i %s.pgm -o %s.ppm"
于 2013-08-29T18:32:36.497 回答