ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 pencil sketch making
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

exchangeviews

India
39 Posts

Posted - Aug 17 2014 :  08:56:38  Show Profile  Reply
Hi All,

Is there a way to convert image into sketch using imageen? Any help appreciated.

w2m

USA
1990 Posts

Posted - Aug 17 2014 :  11:20:22  Show Profile  Reply
Here are two ways that works ok with simple images:

procedure TForm1.EdgeDetect1Click(Sender: TObject);
{ Perform an edge detect using Sobel filter }
begin
  ImageEnView2.Assign(ImageEnView1);
  ImageEnView2.Proc.SaveUndo();
  { Perform an edge detect using Sobel filter }
  ImageEnView2.Proc.EdgeDetect_Sobel;
  { ConvertToBWThreshold to make result black/white (with 1=edge) }
  ImageEnView2.Proc.ConvertToBWThreshold(-2);
  ImageEnView2.Fit;
end;

procedure TForm1.EdgeDetect2Click(Sender: TObject);
begin
  ImageEnView3.Assign(ImageEnView1);
  ImageEnView3.Proc.SaveUndo();
  { EdgeDetect_ShenCastan converts the current color image to black/white
  (1 bit) with a Shen-Castan (ISEF) edge detection algorithm.

  Shen-Castan algorithm convolves the image with the Infinite Symmetric
  Exponential Filter, computes the binary Laplacian image, suppresses false
  zero crossing, performs adaptive gradient thresholding, and, finally, also
  applies hysteresis thresholding. (Algorithms for Image Processing and
  Computer Vision - J.R.Parker).

  procedure EdgeDetect_ShenCastan(Ratio:double; Smooth:double; WindowSize:
    Integer; ThinFactor: Integer; DoHysteresis: Boolean);
  Ratio: percent of pixels to be above High threshold (suggested 0.99)
  Smooth: Smoothing factor (suggested 0.9)
  WindowSize: Size of window for adaptive gradient (suggested 7)
  ThinFactor: Thinning factor (suggested 0)
  DoHysteresis: If True turn on the hysteresis thresholding (suggested True) }

  ImageEnView3.Proc.EdgeDetect_ShenCastan(0.99, 0.9, 7, 0, True);
  ImageEnView3.Fit;
end;




Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

exchangeviews

India
39 Posts

Posted - Aug 18 2014 :  09:41:44  Show Profile  Reply
Thanks for reply. But can I create sketch as shown in image instead outline either by using imagemagick.dll along with imageen.



Thanks in advance.
Go to Top of Page

spetric

Croatia
308 Posts

Posted - Aug 21 2014 :  00:37:14  Show Profile  Reply
Hi,

you can obtain such type of sketching using some ImageEnProc methods.
Let's say that ienProc is TImageEnProc instance and your image is attached to ienProc, then (c++ code):


ienProc->ConvertToBWOrderd();  //convert to BW by dithering ordered
ienProc->RemoveIsolatedPixels(0, 5); // remove black isolated pixels (max 5 grouped)
ienProc->RemoveNoise(1, false); // remove noise, 1 iteration


If you want to enhance contour, prior to converting image to bw, create contour from image, invert it and then overlay contour over converted image (or use it as a mask for border enhancement).

Regarding ImageMagic, it's actually command line, batch processing software. You can call it from your application, either as a shell command, or through desired programming language interface.

I'll try (probably this autumn) to write some wrapper class in order to be able to execute ImageMagic scripts using ImageEnView->IEBitmap as referent source image (saving it as temporary file or binary stream, performing IM script and loading it back to viewer).

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: