Results 1 to 5 of 5

Thread: Image Pro Plus macro. PLEASE HELP!

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    7

    Resolved Image Pro Plus macro. PLEASE HELP!

    i'm using image pro plus 5.1 which is apparently VBA compatable.
    i'm trying to write a program that will sample a grid of an image, getting a local average for each grid box and then find how many pixels are 30% brighter than that. then for the prog to add all those values together.
    i'm having trouble reading the image (grayscale-8) into an array and then being able to call individual pixels. i trying to use ipDocGetArea, but i'm a novice at coding in general - one FORTRAN module, and 1 day of teach myself VBA!

    please help


    J x
    Last edited by jenny1981; Jun 1st, 2005 at 09:09 AM.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Image Pro Plus macro. PLEASE HELP!

    does image pro have facility to record macros, like the office products?
    if so try recording what you want to do, then editing the recorded code to get the results you want

    pete

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    7

    Re: Image Pro Plus macro. PLEASE HELP!

    it can indeed record macros. what i want to do is add on one last bit to a recorded macro. i recorded a macro to process an image to show up defects on a fibre-optic plate, now i want to count how many pixels are in 3 different ranges of brightness: giving me a number representing low, med, and high shear in the fibre-optic.

    below is the crucial bit of my code. i think there is a prob with the array...
    i don't think i'm declaring it properly

    Dim actdoc(200, 200) As Integer
    Dim Reg As RECT

    Dim Reg.Left = xpixel
    Dim Reg.Right = xpixel+199
    Dim Reg.bottom = ypixel
    Dim Reg.top = ypixel+199
    ret=IpDocGetArea(DOCSEL_ACTIVE,Reg,actdoc(i, j),0)

    For xpixel = xstart To xstart+199

    'gets the total of the pixels in the x column of sub area
    For ypixel = ystart To ystart+199

    subtotal=subtotal+actdoc(xpixel,ypixel)

    Next ypixel

    'totals All the columns of the Sub area
    Next xpixel

    localaverage=subtotal/40000



    thanx

    J x

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Image Pro Plus macro. PLEASE HELP!

    Dim Reg.Left = xpixel
    Dim Reg.Right = xpixel+199
    Dim Reg.bottom = ypixel
    Dim Reg.top = ypixel+199

    i don't think this is right, the dim part should omited
    reg.left = xpixel or even should it be xpixel = reg.left?

    for xpixel = xstart to xstart + 199

    also looks like it is incorrect, what is xstart? maybe
    for i = xpixel to xpixel +199

    same applies to
    for ypixel

    also you dim actdoc(200,200), but i cant see anywhere you assign any valuse to it, before call ipdocgetarea or values to i and j

    i realise this is not all the code, so some of these observations may be totally incorrect
    i am just trying to guess what you are wanting to do

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    7

    Re: Image Pro Plus macro. PLEASE HELP!

    thanx heaps westy!

    taking out the dim part for the reg.s got me over some hurdles, then it told me something about an overfolowing array - but i got that fixed. so now i think probs solved for now.

    J x

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width