Setting "feather distance"
Posted: 2019-01-19T11:20:11-07:00
Hi folks!
I have no background in image processing or Imagemagick and would hugely appreciate help w/ an image processing pipeline I want to build, specifically w/ setting feather distance (my term). Here's my setup:
-- Imagemagick 7.0.7-Q16, 32-bit, on Windows; I'm not tied to this version and can switch
-- sample source image: im1.jpg; https://pasteboard.co/HXcyB1z.jpg
-- supporting image for description: im-combined.jpg; https://pasteboard.co/HXcBbLV.jpg
I have a few images similar to im1.jpg; each has a non-uniform grey-white background w/ some lighting variation; each contains a disc-of-interest at its approximate center; each disc contains a line at an arbitrary angle. My goal is to rotate each image such that the line is approximately horizontal, and to fill in the background-space caused by that rotation.
A process that looks workable would be as follows (pls refer to im-combined.jpg):
-- start w/ source image (panel 1)
-- determine angle by which to rotate (let's assume I've solved for this already)
-- "crop" it to a circle, rotate by angle (panel 2)
-- "feather" edges of circle by a distance "d" (panel 3; the red circle is just annotation to show wherefrom the feathering would start)
<-- stuck here; haven't figured out a way to set feather-distance "d". I've tried vignette, as well as various incantations from here: http://www.imagemagick.org/Usage/morpho ... ce_feather
I can probably figure out what remains, which would be to "site" this feathered image inside a new plain background similar to the original (i.e. similar to original in lighting, but doesn't contain disc; let's assume I can manually create a template background to use across all images)
For actual image manipulation this is is the commandline I have thus far (from trawling this site, mostly):
magick.exe" im1.jpg \
-alpha on -background none \
( +clone -channel a -evaluate multiply 0 +channel -fill white -draw "circle %[fx:w/2],%[fx:h/2] 0,%[fx:h/2]" ) \
( -clone 0,1 -compose DstIn -composite ) \
-delete 0,1
-background none -rotate 45 \
out.png
Thank you!
I have no background in image processing or Imagemagick and would hugely appreciate help w/ an image processing pipeline I want to build, specifically w/ setting feather distance (my term). Here's my setup:
-- Imagemagick 7.0.7-Q16, 32-bit, on Windows; I'm not tied to this version and can switch
-- sample source image: im1.jpg; https://pasteboard.co/HXcyB1z.jpg
-- supporting image for description: im-combined.jpg; https://pasteboard.co/HXcBbLV.jpg
I have a few images similar to im1.jpg; each has a non-uniform grey-white background w/ some lighting variation; each contains a disc-of-interest at its approximate center; each disc contains a line at an arbitrary angle. My goal is to rotate each image such that the line is approximately horizontal, and to fill in the background-space caused by that rotation.
A process that looks workable would be as follows (pls refer to im-combined.jpg):
-- start w/ source image (panel 1)
-- determine angle by which to rotate (let's assume I've solved for this already)
-- "crop" it to a circle, rotate by angle (panel 2)
-- "feather" edges of circle by a distance "d" (panel 3; the red circle is just annotation to show wherefrom the feathering would start)
<-- stuck here; haven't figured out a way to set feather-distance "d". I've tried vignette, as well as various incantations from here: http://www.imagemagick.org/Usage/morpho ... ce_feather
I can probably figure out what remains, which would be to "site" this feathered image inside a new plain background similar to the original (i.e. similar to original in lighting, but doesn't contain disc; let's assume I can manually create a template background to use across all images)
For actual image manipulation this is is the commandline I have thus far (from trawling this site, mostly):
magick.exe" im1.jpg \
-alpha on -background none \
( +clone -channel a -evaluate multiply 0 +channel -fill white -draw "circle %[fx:w/2],%[fx:h/2] 0,%[fx:h/2]" ) \
( -clone 0,1 -compose DstIn -composite ) \
-delete 0,1
-background none -rotate 45 \
out.png
Thank you!