ImageSubDivide (image, cols, rows)
An 8-bit image, instance of the PhImage class, such as returned by a call to PxLoadImage.
The number of columns to divide the image into.
The number of rows to divide the image into.
This function divides the passed image into the number of rows and columns specified, and puts the subimages into a list, by rows. That is, the first elements of the list are the subimages of row 1, then the subimages of row 2, etc.
To use this function, you must load the ImageProc.lsp library with a call to require_lisp("ImageProc.lsp").
This example, ex_ImageSubDivide.g, is included in the product distribution.
#!/usr/cogent/bin/phgamma /* This example puts up a window with a label image. (Size: 96 by 96 pixels). Next to this image is the same image sub_divided into four parts on four separate labels. */ PtInit(nil); require_lisp("PhotonWidgets.lsp"); require_lisp("ImageProc.lsp"); win = new(PtWindow); win.SetDim(300,160); img = PxLoadImage("smiley.bmp"); lab = ImageToLabel(img); lab.SetPos(25,25); sub_img = (ImageSubDivide(img,2,2)); lab1 = ImageToLabel(car(sub_img)); lab1.SetPos(150,25); lab2 = ImageToLabel(cadr(sub_img)); lab2.SetPos(210,25); lab3 = ImageToLabel(caddr(sub_img)); lab3.SetPos(150,85); lab4 =ImageToLabel(caddr(cdr(sub_img))); lab4.SetPos(210,85); PtRealizeWidget(win); PtMainLoop();
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.