Page 1 of 1

help need filter like Cimg convolve

Posted: 2014-09-29T18:40:52-07:00
by Wizardzim
Hi all!

I'm using last console version of IM on Windows.

I'm looking for filter in imagemagick which will transform image like
Cimg.get_convolve method:

Code: Select all

CImg<uint8_t> src;
src.load(file);
// create 7x7 matrix with 3 channels, filled with 1
CImg<float> meanfilter(7,7,1,3,1);
CImg<float> img;
img = src. get_convolve(meanfilter);
img.save_jpeg("D:\\meanfilter.jpg");
To turn this:
Image
into this:
Image

I tried
convert -median 7x7 in.png out.png
convert -convolve "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1" in.png out.png
convert -mean-shift 7x7+10% in.png out.png

and some others, but it didn't help

Which is type of transformation, mask that i need to apply to accomplish that??

Thanks in advance!!!!

Re: help need filter like Cimg convolve

Posted: 2014-09-29T20:48:50-07:00
by fmw42
Your cimg code is likely incorrect, since a mean filter with constant weights will not produce the result you show.

Re: help need filter like Cimg convolve

Posted: 2014-09-30T02:19:29-07:00
by snibgo
I get an almost identical result by blurring, then multiply by 49, modulus the quantum (ie a value just above white becomes just above black, repeatedly). Using HDRI IM:

Code: Select all

%im32f%convert bwflower.jpg -blur 0x2 -evaluate multiply 49 -evaluate addmodulus 0 out.png