help need filter like Cimg convolve

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Wizardzim
Posts: 1
Joined: 2014-08-10T03:22:10-07:00
Authentication code: 6789

help need filter like Cimg convolve

Post 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!!!!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: help need filter like Cimg convolve

Post by fmw42 »

Your cimg code is likely incorrect, since a mean filter with constant weights will not produce the result you show.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: help need filter like Cimg convolve

Post 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
snibgo's IM pages: im.snibgo.com
Post Reply