Victor Image Processing Library How-to Tips

Victor Graphic Pen
Windows Store Sample Application


Victor Graphic Pen is a Windows Store application created in Visual Studio 2012 with C# and XAML.

Victor Graphic Pen demonstrates programming with the Victor Library functions. It uses the Victor Library for 32-bit Windows and is fully compatible with 32- and 64-bit Windows. When run on a Microsoft Surface Pro tablet computer, it supports touch manipulation and camera capture. (This app is not for Surface RT.)

Graphic Pen demonstrates the use of sliders to continuously change the amount of pen strokes in a graphic pen drawing.

The technique for creating the color tinted graphic pen drawing is to

  • convert an image from RGB to HSV
  • extract the value plane as an 8-bit grayscale
  • process the value plane into a grayscale graphic pen rendering
  • insert the plane back into the HSV image
  • convert to HSV image to RGB for viewing and further processing

Here is the sequence of function calls:

   
            rcode = vicwin_ws.rgbimagetohsvimage(ref rimage, ref hsv_image);
            rcode = vicwin_ws.extractplane(2, ref hsv_image, ref val_image);
            rcode = vic_gp_helper2_ws.make_graphicpen_plane(gp_amt, ref val_image, ref graphicpen_plane);
            rcode = vicwin_ws.insertplane(2, ref graphicpen_plane, ref hsv_image);
            rcode = vicwin_ws.hsvimagetorgbimage(ref hsv_image, ref rimage);
            

The make_graphicpen_plane function is shown here. It is the same technique as described in graphicpen.html.

      public static int make_graphicpen_plane(double amt, ref vicwin_ws.imgdes src, ref vicwin_ws.imgdes res)
        {
            int rcode;
            vicwin_ws.imgdes tempimg1;
            int swidth = 0, slength = 0;
            byte[] matrixkernel = new byte[81]{
	           1,0,0,0,0,0,0,0,0,
	           0,1,0,0,0,0,0,0,0,
	           0,0,1,0,0,0,0,0,0,
	           0,0,0,1,0,0,0,0,0,
	           0,0,0,0,1,0,0,0,0,
	           0,0,0,0,0,1,0,0,0,
	           0,0,0,0,0,0,1,0,0,
	           0,0,0,0,0,0,0,1,0,
	           0,0,0,0,0,0,0,0,1};
            tempimg1 = new vicwin_ws.imgdes();
            vic_helper_ws.calc_image_dimensions(ref src, ref swidth, ref slength);
            rcode = vicwin_ws.allocimage(ref tempimg1, swidth, slength, 8); // Allocate new 8-bit image to be the screen
            rcode = vicwin_ws.addnoise(255, ref tempimg1, ref tempimg1);
            rcode = vicwin_ws.matrixconvex(9, matrixkernel, 9, ref tempimg1, ref tempimg1);
            rcode = vicwin_ws.gammabrighten(amt, ref src, ref res);
            rcode = vicwin_ws.sharpen(ref res, ref res);  // For more pen strokes and less detail, remove the sharpen
            rcode = vicwin_ws.screen(ref res, ref tempimg1, ref res); // Apply the graphic screen
            vicwin_ws.freeimage(ref tempimg1);
            return (rcode);
        }

Download C#/XAML source code and initial JPEG image for the Victor Graphic Pen Windows Store app (136 kb).

Download .Net Victor Library namespace for creating Windows Store applications and time-limited eval version of the Victor Library (289 kb).

In general always use the following conditions for creating a Windows Store app that calls Victor Image Processing Library for 32-bit Windows functions:

  • compile for x86 cpu
  • allow unsafe
  • add reference to vic_lib_ws
  • place the Victor Library dlls under the \AppX subdirectory

Requires the Victor Library v 6 commercial release or eval version.


Victor Image Processing Library

Victor Image Processing Library homepage | more source code




Copyright © 2013 Catenary Systems Inc. All rights reserved. Victor Image Processing Library is a trademark of Catenary Systems.