Page 1 of 1

morphology problem, syntax?

Posted: 2011-10-13T05:56:27-07:00
by Kjartan

Code: Select all

	dim Img, strResult, str
	Set Img = Server.CreateObject("ImageMagickObject.MagickImage.1")
		strResult = Img.Convert(redRC, _
								"-threshold=99%",_
								"+depth",_
								"-morphology","Distance Euclidean:1,67000",_
								"-morphology","Close Disk",_
								"-morphology","Open Disk",_	
								"-auto-level",_
								"+matte",_
								"-negate",_
								whiteM)
Hello, I am having a great big deal of trouble with this code, if I remove the morphology, everything works. And I am wondering if the syntax here is way off.

Thank you very much.
- Kjartan

Re: morphology problem, syntax?

Posted: 2012-03-18T21:47:11-07:00
by anthony
Kjartan wrote: Hello, I am having a great big deal of trouble with this code, if I remove the morphology, everything works. And I am wondering if the syntax here is way off.

Thank you very much.
- Kjartan
I am not familar with vb code (actually this is the first time I responded to this forum!) but I would have expected the arguments to break up the same way as you would with the Command Line version. Actually I am pretty sure of it as I have seen some code for this.

I have no idea what the underscores on the end of line mean, I assume line continuation, so I have left them in.

The distance scaling value of 67000 is excesivally high, unless you are using a Q32 version of ImageMagick!

By default a factor of 100 is used (two decimal places) and this is plenty, the iteration errors of the kernel are larger that 100 decimal places. BUt it is too big if you are using Q8 version which really can't handle a floating point distance function

Code: Select all

	dim Img, strResult, str
	Set Img = Server.CreateObject("ImageMagickObject.MagickImage.1")
		strResult = Img.Convert(redRC,_
								"-threshold", 99%",_
								"+depth",_
								"-morphology", "Distance", "Euclidean",_
								"-morphology", "Close", "Disk",_
								"-morphology", "Open", "Disk",_	
								"-auto-level",_
								"+matte",_
								"-negate",_
								whiteM)